Hi all, I am using edgeR to find DEG. I have paired samples for cancerous tissue and adjacent non-cancerous tissue.
> type <- factor(c("benign", "tumour", "benign", "tumour", "benign", "tumour")
> subject <- factor(c(1, 1, 2, 2, 3, 3))
> design <- model.matrix(~subject+type)
> keep <- filterByExpr(y)
> y <- y[keep, , keep.lib.sizes=FALSE]
> y <- calcNormFactors(y)
> fit <- glmQLFit(y,design)
> qlf <- glmQLFTest(fit)
Then I used glmQLFit
and glmQLFTest
and got the below result for one gene for example
> Gene logFC logCPM F PValue FDR
> ENSG00000165186.12|PTCHD1 -4.570433395 5.571673968 88.74868282 2.53E-09 6.31E-06
What I'm trying to understand for the logFC
in which condition is it down-regulated? Looking at the cpm table output, I can't see in which condition it is down-regulated (or up-regulate).
Thank you.
Since you didn't include all of your code we can't see the exact contrast you did, but the wald test will by default compare each factor to the first factor level. For subject the first factor level is 1, so the contrasts would be 2 vs 1 and 3 vs 1, and for type the first factor level is benign so the contrasts would be tumor vs benign.
Perfect, thank you. Is it right to say the first factor level for type is benign because it's written first? Initially I thought it would be alphabetical. I'll add all my code.
By default the QLFTest tests the last column of the design because the preset is
coef=ncol(glmfit$design)
. You have to change it is you want individual contrasts/coefs being tested.Just noting that edgeR doesn't use Wald tests. The above code will compute quasi-F-tests where the numerator is the likelihood ratio test statistic.