Is it okay to use CPM normalization (with/without log transform) after using TMM normalization? Why do we need both?

  counts <- assays(rse_gene)$counts
  y <- as.matrix((counts))
 y <- DGEList(counts = y, group=c(1,2,3,4,5,6,7,8,9,10))
  y <- calcNormFactors(y)
 z <- cpm(y, normalized.lib.size=TRUE)
scaledata <- t(scale(t(z))) # Centers and scales data.
hc <- hclust(as.dist(1-cor(scaledata, method="spearman")), method="complete") # Clusters columns by Spearman correlation.
 TreeC = as.dendrogram(hc, method="average")
 main = "Sample Clustering",
 ylab = "Height")

1 Answer 1


In fact the cpm function will use the size factors (TMM) that were calculated with calcNormFactors. In the absence of the size factors cpm would do a naive per-million scaling so only correct for differences in library size. The power of the size factors is to also correct for library composition. I recommend this video for details. In short: What you do is fine. I would suggest though that you use the log = TRUE option for cpm as one typically performs downstream applications (even when using the Z-score) on the log scale. Or alternatively t(scale(t(log2(z+1)))).

  • $\begingroup$ Thank you for your comment. Could you upload the video link?? I cannot see... $\endgroup$
    – user224050
    Jun 3, 2020 at 15:59
  • $\begingroup$ But TMM also conduct the library size normalization, right?? Can we say this is a kind of redundancy?? What is a role of cpm transformation after TMM?? hbctraining.github.io/DGE_workshop/lessons/… $\endgroup$
    – user224050
    Jun 3, 2020 at 17:07
  • $\begingroup$ No it is not redundant. The normalization in edgeR works by first scaling for equal library size and then additionally applying the size factors to correct for library composition. The calcNormFactors calculate the factors, the cpm function applies it to the per-million scaled counts. I refreshed the link: youtube.com/watch?v=Wdt6jdi-NQo $\endgroup$
    – user3051
    Jun 3, 2020 at 17:14

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.