1
$\begingroup$

Using edgeR for differential analysis between Tumor and Normal gave me differential expressed genes with logFC, logCPM, PValue and FDR.

From the details of glmTreat function I see that logCPM is average log2-counts per million, the average taken over all libraries.

The output table I got from glmTreat:

Geneid     logFC  unshrunk.logFC    logCPM  PValue       FDR
Gene1   4.985298235 5.573931983 1.236660486 1.55E-54    1.87E-50
Gene2   4.613438634 5.52126484  0.920343233 2.59E-53    1.56E-49
Gene3   5.250601296 5.356432653 2.751294034 2.48E-50    9.95E-47
Gene4   4.943049159 5.379741165 1.361393757 2.06E-45    6.19E-42
Gene5   6.100121754 6.117580436 5.774385315 2.95E-43    7.11E-40
Gene6   4.722697891 5.320461275 1.120685402 3.05E-42    6.11E-39
Gene7   5.246129853 5.497012001 1.902992053 2.78E-40    4.78E-37
Gene8   3.878773277 4.956636276 0.776208741 8.66E-39    1.30E-35
Gene9   4.441752496 4.94930499  1.132652682 4.37E-38    5.83E-35

To calculate logCPM given in the above table manually I did like this:

logCPM <- cpm(y, prior.count=2,  log=TRUE)

I got the logCPM values for all the genes. Then I calculated Average across all the samples for each gene. I got like below:

Geneid  Average
Gene1   0.686560246
Gene2   0.617115826
Gene3   1.075975225
Gene4   0.692050878
Gene5   1.277556065
Gene6   0.638358189
Gene7   0.689323163
Gene8   0.60700396
Gene9   0.662115092

Why there is so difference? Where I'm doing wrong?

$\endgroup$
3
  • 2
    $\begingroup$ Did you also try aveLogCPM(y, normalized.lib.sizes=TRUE, prior.count=2, dispersion=NULL, ...)? $\endgroup$
    – benn
    Jun 22, 2018 at 11:15
  • 1
    $\begingroup$ glmTreat() literally uses aveLogCPM under the hood in fact. $\endgroup$
    – Devon Ryan
    Jun 22, 2018 at 11:18
  • $\begingroup$ @DevonRyan Yes you are right. thanks. It is calculated across all samples. I want to calculate aveLogCPM for each condition differently (Tumor and Normal separately) How to do that? Just taking the raw counts of Tumor condition and using aveLogCPM function on it is fine? $\endgroup$ Jun 22, 2018 at 11:49

2 Answers 2

3
$\begingroup$

If you want the values by group then subset y to contain the samples of interest and then feed that to aveLogCPM().

$\endgroup$
1
  • $\begingroup$ yes I took the matrix of only Tumor samples and genes with raw counts and applied aveLogCPM() $\endgroup$ Jun 22, 2018 at 12:53
0
$\begingroup$

This post on the Bioconductor mailing list explains the difference: https://support.bioconductor.org/p/100463/

$\endgroup$
2
  • $\begingroup$ Thanks for your response. Could kindly provide a summary of the link here? Link answers are generally not encouraged. $\endgroup$
    – M__
    Sep 5, 2023 at 12:05
  • $\begingroup$ In short, Aaron Lun explains that the output of aveLogCPM is closer to log2(rowMeans(cpm(y)) (where the log-transformation is done after the averaging), than to: rowMeans(cpm(y, log=TRUE)) $\endgroup$
    – jul635
    Feb 12 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.