Dear Sir or Madam,
I have a question in edgeR about the coefficients in glmLRT().
For example, I have the following design matrix, and I want to compare each patient to the other 2 patients: 8vs33, 8vs51, 33vs51.
Can you tell me how to set the coeff in "lrt <- glmLRT(fit, coef=)", "topTags(lrt)" in a single step to conduct all pairwise comparisons? So that I don't need to set the pairwise coef/contract one by one. Thanks in advance.
In my research I have 70 samples and need to compare each to the rest 69 samples, here I just use 3 samples as a toy example for simplicity purpose.
I know I can set the pairwise contract in such a way: contrast=c(0,0, ,,,,,,,,,-1,1,0,0,0,0,,,,,,0,000), but considering so many samples, it is not convenient to set the pairwise contracts one by one. So is there a one-step way to compare all pairs simultaneously?
Design matrix:
Patient8 Patient33 Patient51
8N 1 0 0
8T 1 0 0
33N 0 1 0
33T 0 1 0
51N 0 0 1
51T 0 0 1
Regards,
Jianhai
Dear Aaron Lun,
Thanks for your prompt reply and your explanation on the patient design.
You are right. I removed the tumor (T) and normal (N) factor from the design matrix to make it simpler, since I only need to know how to compare each sample to all the rest. Your loop code solves my question, thanks.
I posted this question, because in the middle of Page 21 in the tutorial: https://www.bioconductor.org/packages/release/bioc/vignettes/edgeR/inst/doc/edgeRUsersGuide.pdf, it says "To find genes different between any of the three groups: lrt <- glmLRT(fit, coef=2:3)", but "coef=2:3" only compares 2vs1, 3vs1, not 2vs3. So I asked how to set the multiple coef to conduct any combination of pairs.
Regards,
Jianhai