text: user1369: I have seen many posts regarding counts to RPKM and TPM. I haven't seen any post for counts to FPKM. 
  I have RNA-Seq data which is paired-end reads. Extracted the counts using featureCounts for all the samples. 
  There is a function to convert counts to RPKM: using the gene_length
  rpkm <- function(counts, lengths) {
    rate <- counts / lengths 
    rate / sum(counts) * 1e6
  }
  
  I know that RPKM is mainly used for single-end reads data. Do you think I can use the above function for converting counts to FPKM as my data is paired end? [TCGA data: HTSeq counts are converted to HTSeq FPKM]
  Somewhere I have seen that the same function applies for single end data which will be RPKM and also for paired end data which will be FPKM. Am Ir right or wrong?
  If not can anyone show some function or code to convert counts to FPKM please.
  thanq
  
  user4305: You can use countToFPKM package.
  This package provides an easy to use function to convert the read count matrix into FPKM matrix; following the equation in 
  
  The fpkm() function requires three inputs to return FPKM as numeric matrix normalized by library size and feature length:
  
  counts A numeric matrix of raw feature counts. 
  featureLength A    numeric vector with feature lengths that can be
  obtained using
  biomaRt.
  meanFragmentLength A numeric vector with mean fragment lengths,
  which can be calculate with Picard
  using CollectInsertSizeMetrics.
  
  See https://github.com/AAlhendi1707/countToFPKM
  
  user29: 
  I have seen many posts regarding counts to RPKM and TPM.
  
  There’s your answer then: FPKM = RPKM. It’s simply a more accurate name.
  Speaking of RPKM for paired-end data is discouraged because the reference to “read” in this context lends itself to ambiguity. But mathematically the quantity is the same: we are counting fragments, not individual reads (of which each fragment has two, for paired-end data).
  But as mentioned in the comments, there are good reasons against using FPKMs.
  
original_text: 1369: <p>I have seen many posts regarding counts to RPKM and TPM. I haven't seen any post for counts to FPKM. </p>
  
  <p>I have RNA-Seq data which is paired-end reads. Extracted the counts using featureCounts for all the samples. </p>
  
  <p>There is a function to convert counts to RPKM: using the gene_length</p>
  
  <pre><code>rpkm &lt;- function(counts, lengths) {
    rate &lt;- counts / lengths 
    rate / sum(counts) * 1e6
  }
  </code></pre>
  
  <p>I know that RPKM is mainly used for single-end reads data. Do you think I can use the above function for converting counts to FPKM as my data is paired end? [TCGA data: HTSeq counts are converted to HTSeq FPKM]</p>
  
  <p>Somewhere I have seen that the same function applies for single end data which will be RPKM and also for paired end data which will be FPKM. Am Ir right or wrong?</p>
  
  <p>If not can anyone show some function or code to convert counts to FPKM please.</p>
  
  <p>thanq</p>
   4305: <p>You can use <a href="https://github.com/AAlhendi1707/countToFPKM" rel="nofollow noreferrer">countToFPKM</a> package.
  This package provides an easy to use function to convert the read count matrix into FPKM matrix; following the equation in 
  <img src="https://s0.wp.com/latex.php?latex=%5Ctext%7BFPKM%7D_i%20%3D%20%5Cdfrac%7BX_i%7D%7B%20%5Cleft%28%5Cdfrac%7B%5Cwidetilde%7Bl%7D_i%7D%7B10%5E3%7D%5Cright%29%20%5Cleft%28%20%5Cdfrac%7BN%7D%7B10%5E6%7D%20%5Cright%29%7D%20%3D%20%5Cdfrac%7BX_i%7D%7B%5Cwidetilde%7Bl%7D_i%20N%7D%20%5Ccdot%2010%5E9%20%20&amp;bg=ffffff&amp;fg=000000&amp;s=0" alt="enter image description here"></p>
  
  <p>The <code>fpkm()</code> function requires three inputs to return FPKM as numeric matrix normalized by library size and feature length:</p>
  
  <ul>
  <li><code>counts</code> A numeric matrix of raw feature counts. </li>
  <li><code>featureLength</code> A    numeric vector with feature lengths that can be
  obtained using<br>
  <a href="https://bioconductor.org/packages/release/bioc/vignettes/biomaRt/inst/doc/biomaRt.html" rel="nofollow noreferrer">biomaRt</a>.</li>
  <li><code>meanFragmentLength</code> A numeric vector with mean fragment lengths,<br>
  which can be calculate with <a href="https://broadinstitute.github.io/picard/command-line-overview.html#CollectInsertSizeMetrics" rel="nofollow noreferrer">Picard</a>
  using CollectInsertSizeMetrics.</li>
  </ul>
  
  <p>See <a href="https://github.com/AAlhendi1707/countToFPKM" rel="nofollow noreferrer">https://github.com/AAlhendi1707/countToFPKM</a></p>
   29: <blockquote>
    <p>I have seen many posts regarding counts to RPKM and TPM.</p>
  </blockquote>
  
  <p>There’s your answer then: FPKM = RPKM. It’s simply a more accurate name.</p>
  
  <p>Speaking of RPKM for paired-end data is discouraged because the reference to “read” in this context lends itself to ambiguity. But mathematically the quantity is the same: we are counting <em>fragments</em>, not individual reads (of which each fragment has two, for paired-end data).</p>
  
  <p>But as mentioned in the comments, <a href="https://bioinformatics.stackexchange.com/a/69/29">there are good reasons against using FPKMs</a>.</p>
  