This is a test version of Biostars. For the public version, visit https://www.biostars.org.
EdgeR Paired-Sample Test

Hi,

I am using edgeR to carry out DE analysis for my RNA Seq samples, may I know how can I construct the design matrix and how can I make sure that during testing, the DE genes shown are of the correct contrast?

My current steps are shown below:

Current data type: subject: 1,2,3,4

treatment for each subject: T0, T1

I would like to find DE genes between conditions (T0, T1) for each paired samples:

design <- model.matrix(~Subject+Condition)

d <- d[rowSums(cpm(d)>10) >= (length(G1_ids)/2),,keep.lib.sizes = FALSE ]

d <- calcNormFactors(d)

d <- estimateGLMCommonDisp(d,design)

d <- estimateGLMTrendedDisp(d,design)

d <- estimateGLMTagwiseDisp(d,design)

fit <- glmQLFit(d, design, robust = TRUE)

result_glm <- glmQLFTest(fit)

It seems to me that, using the above steps, I get DE genes which are differentially expressed between samples, not between conditions.

Thank you! Maggie Pan

edger rna-seq

1 answer

Please see section 3.4.2 of the edgeR vignette.

result_glm <- glmQLFTest(fit, coef=5)  # Or maybe coef=4, it'll be the last column in "design"

May I know if this would be correct to find the difference in each paired samples if there are two paired samples:

design (Intercept) SubjectA ConditionTreatment

1 1 0 0

2 1 0 1

3 1 1 0

4 1 1 1

I used coef = 3 in this case. Thanks!

Correct, it'd be coef=3 in that case.

Log in to answer this question.