edgeR multiple coeff in "lrt <- glmLRT(fit, coef=)"
2
0
Entering edit mode
@zhangjianhai-12955
Last seen 4.2 years ago

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

edger • 2.0k views
ADD COMMENT
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 3 hours ago
The city by the bay

I struggle to see the scientific merit in comparing pairs of patients. There will obviously be DE genes between patients, because everyone's different. However, these differences tell you nothing about the behaviour of the wider population, which is what we generally want to discover from experiments. The only practical exception I can think of is if you were to use the patient-specific DE genes to guide the clinical treatment of that patient; otherwise, each patient is to be considered a sample, exchangeable and indistinguishable.

In your case, the real groups of interest seem to be N (normal?) and T (tumour?), which should be represented by some factor in the model. This seems like a typical paired-sample experimental design, in which I would not consider patients as scientifically interesting groups, just as nuisance variables to be blocked out.

For future reference, if you have many groups and want to do pairwise comparisons between them all, just loop:

for (x in 2:ngroups) { # assuming ngroups >= 2
    for (y in seq_len(x-1)) {
        con <- integer(ngroups) # assuming a one-way layout
        con[x] <- 1
        con[y] <- -1
        res <- glmLRT(fit, contrast=con)
        output[[paste0(x, "vs", y)]] <- res
    }
}

If you want to find genes that are DE between any pair of groups, you should use an ANODEV; see the user's guide.

P.S. The "Tutorial"-type post is intended for people who write tutorials, not for those requesting them.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
@zhangjianhai-12955
Last seen 4.2 years ago

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

ADD COMMENT

Login before adding your answer.

Traffic: 949 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6