I have run a differential expression analysis using limma looking for DE between group1 and group2, and male versus female
I have RNAseq data in a single tissue type for 80 individuals, with age groups being group1 = 1:20wks old and group2 being 21:40 weeks old. Groups 1 and 2 are a mix of male and female individuals. There are two seperate sequencing runs with associated batch effects. No individual is sampled more than once eg
Up to now I have used a design and contrast matrix as follows;
design <- model.matrix(~ Group + Sex + Batch) cont.mat_Age <- c(0,1,0,0) # when looking for DE between age groups cont.mat_Sex <- c(0,0,1,0) # when looking for DE between sexes
What I would like to do is to test for DE between age group 1 and age group 2, treating male and female as seperate groups, but as I understand it I shouldn't just subset the counts table and run seperate regression, but rather control for sex in the model. I found a post (Limma: Continuous variable model designs) from 3 yrs ago and adapted the code to;
design_independent <- model.matrix(~0+Sex+Sex:Group + Batch)
contrast.independent <- makeContrasts(Sex_F_Group2 - Sex_M_Group2, levels=design_independent)
with a (mock) topTable as follows;
My code runs, but I'm unsure if I'm getting what I'm asking for.
1. Is the design and contrast correct?
2. If I want to make sure the batch effect is accounted for, how do I include it in the
3. I'm unsure how to interpret the results: Does this give me the difference for females only between age group 1 and age group 2.
Thank you for your help.