about the cpm normalization after using normalization factor Is it okay to use CPM normalization (with/without log transform) after using TMM normalization? Why do we need both?
 library(edgeR)
 library(SummarizedExperiment)
 load(url(&quot;http://duffel.rail.bio/recount/SRP049355/rse_gene.Rdata&quot;))
  counts &lt;- assays(rse_gene)$counts
  y &lt;- as.matrix((counts))
 y &lt;- DGEList(counts = y, group=c(1,2,3,4,5,6,7,8,9,10))
  y &lt;- calcNormFactors(y)
 z &lt;- cpm(y, normalized.lib.size=TRUE)
scaledata &lt;- t(scale(t(z))) # Centers and scales data.
hc &lt;- hclust(as.dist(1-cor(scaledata, method=&quot;spearman&quot;)), method=&quot;complete&quot;) # Clusters columns by Spearman correlation.
 TreeC = as.dendrogram(hc, method=&quot;average&quot;)
 plot(TreeC,
 main = &quot;Sample Clustering&quot;,
 ylab = &quot;Height&quot;)
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)))).