EdgeR design matrix for mutlifactor RNA seq
1
0
Entering edit mode
@jackiesalzbank-24090
Last seen 18 months ago

Hello, I am running a glm analysis with edgeR on 64 biologically independent samples, with 3 factors. I have sex (M and F), age (P0, P7, P15, P30), and genotype (Control, Knock-Out). I have two separate questions, 1) How does genotype effect males and females differently (at each timepoint) 2) Within each genotype (i.e. males only) what are the differences between genotypes over time. I began with a csv file that provides relevant information for each sample and followed the User guide's suggestion of pasting each factor together to form groups.

>Genotype<-Samples$genotype >Stage<- Samples$stage
>Sex<-Samples\$sex
>Group <- factor(paste(Genotype,Stage, Sex,sep="." ))

After this, I am not sure how to create my design matrix to ask the specific questions I am interested in?

edger design multifactor • 366 views
2
Entering edit mode
@james-w-macdonald-5106
Last seen 3 days ago
United States

You do just like it says in the edgeR User's Guide

design <- model.matrix(~0+Group)

Which will now compute the average for each group (e.g., Control.P0.M, Knock-Out.P0.F, etc) and you can now make any comparisons you want using makeContrasts. But do note that you should probably convert Knock-Out to KO or KnockOut or whatever, because the '-' in KnockOut will be interpreted as a minus by makeContrasts. Presuming you had already done so, you could compute the difference between male and female controls at P0 by doing

makeContrasts(Control.P0.M - Control.P0.F, levels = design)

And similarly for any other contrast you might care to make.

0
Entering edit mode
> makeContrasts(Control.P0.M - Control.P0.F, levels = design)

This would be comparing the control males to the control females at P0 correct?
So for my first question, how does genotype effect males and females differently (at each timepoint) I would have to do the following contrasts between each KO and the corresponding control?

>my.contrasts1 <- makeContrasts( KO_Sex_P0= (KO.0.M-Control.0.M)- (KO.0.F-Control.0.F),
KO_Sex_P7= (KO.7.M-Control.7.M)- (KO.7.F-Control.7.F),
KO_Sex_P15=(KO.15.M-Control.15.M)- (KO.15.F-Control.15.F),
KO_Sex_P30=(KO.30.M-Control.30.M)- (KO.30.F-Control.30.F),
levels=design )

0
Entering edit mode

Please enclose any code between two sets of triple backticks see the format code part here.

The contrasts you have specified do as you suspect - they are called interaction terms - and detect those genes that are affected differently by KO status depending on sex.