Hi, thank you very much! This is really useful. I have looked through the script, and as I am a complete beginner with R I just wanted to ask a few things.
Tissue type (blood/synovium) related differences in methylation are what I am really interested in and the individual samples are random effects that are confounding the difference.
I have a data frame of DNA methylation values for 600,000 different probes for each sample ( called "m_values").
I also have a separate data frame containing phenotype data for each sample - including tissue type, the ID of the patient that the sample came from, and the patient's response to a specific medication (called "phenotype_data").
For standard methylation analysis call functions can handle two data frames simultaneously
Adapting your script to my situation, I initially thought this would work:
res <- lmer(m_values~(1|tissue_type)+(1|patient_ID),data=phenotype_data)
However I think this code in lmer will only handle one data frame. The first argument "M_values" should be a column in the data frame not an entire data frame on its own.
I don't think its possible to amalgate the phenotype data and the m values. Therefore I am not sure how to proceed.
To me, this looks to be a common basic design in methylation analysis studies. I believe the methylation profile in blood is NOT dependent on the synovial fluid methylation pattern and indeed the sample groups are not related. So all you need is to follow a basic methylation analysis workflow like this. Also, the Biostars hosts a couple of tutorials which might be helpful for one with not much experience in the methylation field (like this and this).
Thanks for the reply. The main concern with the above methylation analysis pipeline is that it does not take into account the fact that the samples are paired I.e. blood and synovial tissue come from the same patient and there are 50 individual patients with both blood and synovial tissue.
Therefore if I follow the standard analysis, blood from all patients will be one group and synovial tissue from all patients will be another group.
The aim of doing a paired analysis is to take into account inflammation in the synovial tissue may also be reflected in the blood in rheumatoid arthritis. Individuals in the study have different levels of inflammation and therefore their dna methylation in both the blood and the synovium will be different.