Answers.Body: <p>I think the most common way is to use something like Kallisto which figures out what proportion of reads are likely assigned to each transcript variant, and calculated TPM  based on that.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-04-26T17:09:54.340Z
Answers.LastActivityDate: 2021-04-26T17:09:54.340Z
Answers.UserDisplayName: swbarnes2
Body: <p>I am aware of <a href="https://biology.stackexchange.com/questions/64860/what-is-the-length-of-gene-when-calculating-tpm-transcripts-per-million">this</a> similar question. But the accepted answer there answers how to calculate TPM given a mapping from gene name to gene length.</p>
  <p>My question is, given an annotation file of genes (for example from Ensembl <a href="ftp://ftp.ensembl.org/pub/current_gtf/" rel="nofollow noreferrer">here</a>), how do you calculate gene length for the purpose of calculating TPM on a gene count matrix coming from RNA seq data. That is, I understand the actualy calculation of TPM given gene lengths, but I do not understand what the gene lengths are.</p>
  <p>From what I understand, to calculate gene lengths from annotation file for RNA seq data, you only consider the exons of each gene, but even so, many exons overlap. What is the standard method of dealing with this?</p>
  <p>For example, I have read that using the length of the union of all exons of the gene is acceptable, but from what I understand TPM is meant to represent the &quot;expected number of reads coming from gene X when randomly selecting 1e6 transcripts&quot;. So taking the union of all exons will be an estimate of this but it might under-estimate this.</p>
  <p>EDIT: From what I can tell this question is not a duplicate of <a href="https://bioinformatics.stackexchange.com/questions/10845/rnaseq-normalization-stabilization-gene-length-and-rlog">RNASeq: Normalization, stabilization, gene length and rlog</a>
  That question does discuss how to perform normalization that takes gene length into account, but it does not ask &quot;what is gene length? How does one determine the length of each gene?&quot; Possible answers could be like what I already mentioned: length of the union of all exons in the gene, or another possible answer is one from the linked question &quot;length of the longest transcript isoform&quot; but I feel that it is not really discussed in that answer/question.</p>
  
Tags: <rna-seq><gene-expression><tpm>
Title: What are common ways to calculate gene length for TPM calculations?
ThreadText: # What are common ways to calculate gene length for TPM calculations?
  
  (Asked by: username_0 on 2021-04-26)
  
  I am aware of [this](https://biology.stackexchange.com/questions/64860/what-is-the-length-of-gene-when-calculating-tpm-transcripts-per-million) similar question. But the accepted answer there answers how to calculate TPM given a mapping from gene name to gene length.
  
  My question is, given an annotation file of genes (for example from Ensembl [here](ftp://ftp.ensembl.org/pub/current_gtf/)), how do you calculate gene length for the purpose of calculating TPM on a gene count matrix coming from RNA seq data. That is, I understand the actualy calculation of TPM given gene lengths, but I do not understand what the gene lengths are.
  
  From what I understand, to calculate gene lengths from annotation file for RNA seq data, you only consider the exons of each gene, but even so, many exons overlap. What is the standard method of dealing with this?
  
  For example, I have read that using the length of the union of all exons of the gene is acceptable, but from what I understand TPM is meant to represent the "expected number of reads coming from gene X when randomly selecting 1e6 transcripts". So taking the union of all exons will be an estimate of this but it might under-estimate this.
  
  EDIT: From what I can tell this question is not a duplicate of [RNASeq: Normalization, stabilization, gene length and rlog](https://bioinformatics.stackexchange.com/questions/10845/rnaseq-normalization-stabilization-gene-length-and-rlog)
  That question does discuss how to perform normalization that takes gene length into account, but it does not ask "what is gene length? How does one determine the length of each gene?" Possible answers could be like what I already mentioned: length of the union of all exons in the gene, or another possible answer is one from the linked question "length of the longest transcript isoform" but I feel that it is not really discussed in that answer/question.
  
  **Tags:** rna-seq, gene-expression, tpm
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-04-26. Score: 1
  
  I think the most common way is to use something like Kallisto which figures out what proportion of reads are likely assigned to each transcript variant, and calculated TPM based on that.
  
  
  ---
  
  