SEQanswers how to calculate counts per million
 Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 Similar Threads Thread Thread Starter Forum Replies Last Post vivi-Jasmine Illumina/Solexa 6 12-29-2014 04:23 AM papori RNA Sequencing 0 07-22-2012 03:35 AM Manu Illumina/Solexa 3 08-18-2010 04:47 AM burkard Bioinformatics 0 08-06-2010 12:52 AM ECO Helicos / Direct Genomics 0 01-04-2008 09:14 AM

 04-20-2015, 02:37 PM #1 shirley47162928 Member   Location: in Join Date: Jan 2015 Posts: 15 how to calculate counts per million Hi all, Could anyone tell how to calculate counts per million (CPM) manually? How it was calculated in edgeR related to RNA-seq data?
 04-20-2015, 02:43 PM #2 GenoMax Senior Member   Location: East Coast USA Join Date: Feb 2008 Posts: 6,822
 04-22-2015, 01:01 AM #3 Gordon Smyth Member   Location: Melbourne, Australia Join Date: Apr 2011 Posts: 91 Which edgeR CPM do you mean in particular? Do you mean the column called logCPM in the topTags table? That is computed using the aveLogCPM() function.
 04-22-2015, 06:54 AM #4 diego diaz Member   Location: Santiago, Chile Join Date: Oct 2013 Posts: 62 To calculate CPM manually in R it would be : cpm <- apply(countmatrix,2, function(x) (x/sum(x))*1000000) # the 1 added to log function is to avoid log 0 values log.cpm <- log(cpm + 1) To calculate rpkm you have to know the gene lengths
04-22-2015, 06:41 PM   #5
Gordon Smyth
Member

Location: Melbourne, Australia

Join Date: Apr 2011
Posts: 91

Quote:
 Originally Posted by diego diaz # the 1 added to log function is to avoid log 0 values log.cpm <- log(cpm + 1)
That is not quite the same as what edgeR's cpm() function does. It's somewhat better to offset the counts rather than the cpms.

04-22-2015, 06:47 PM   #6
diego diaz
Member

Location: Santiago, Chile

Join Date: Oct 2013
Posts: 62

Quote:
 Originally Posted by Gordon Smyth That is not quite the same as what edgeR's cpm() function does. It's somewhat better to offset the counts rather than the cpms.
Yes, sorry, my mistake. The offset is added to the counts, not to the cpm.

 Tags cpm