Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • From RNA-seq raw counts to normalized data

    I have several RNA-seq datasets. Some of them provide RNA-seq raw counts, some provide FPKM, RPKM and some have transcripts per million (TPM) data. Non of them provide fastq files, all data is processed already. At the end I want all datasets to be normalized to TPM.

    I'm using this code in order to normalize raw counts to TPM: (using R)

    Code:
    rpkm <- apply(X = subset(dataset), MARGIN = 2, FUN = function(x) { 10^9 * x / genelength / sum(as.numeric(x)) })
    TPM <- apply(rpkm, 2, function(x) x / sum(as.numeric(x)) * 10^6) %>% as.data.frame()
    When RPKM is provided, and no raw counts is available, I use the second line in the same code:

    Code:
    TPM <- apply(rpkm, 2, function(x) x / sum(as.numeric(x)) * 10^6) %>% as.data.frame()
    And when FPKM is provided, I use this formula to transform the data to TPM:

    Code:
    TPM = FPKM*X
    where
    Code:
    X = 1e6/[sum of all FPKM of a sample]
    NOTE: genelength is obtained using the biomart package in R, to get the transcript length directly out of ensemble.

    However, because I know the steps of TPM normalization in theory, one should firstly normalize to gene length, and then to gene depth. I'm not sure this is what the code does, feeling very skiptical about it even thought this code was given to me by a Phd student.

    Can you guys please help me with this question? is my code right or should I alter something?

    Thank you!

  • #2
    Hello Conerx,

    I'm unfortunately not well-versed in R, however, at first glance it appears like the code is not correct. The order of operations for TPM and FPKM are different, so you shouldn't use one to calculate the other. It's possible I'm wrong but my recommendation is to rewrite the code yourself. I think it teaches you more to write your own code and it allows you to fully understand what is happening.

    Here are two older blog posts about TPM, RPKM, and FPKM that talk about their differences and some code to run them. Hopefully, it helps, if not let me know and I can send some additional information.

    https://haroldpimentel.wordpress.com/2014/05/08/what-the-fpkm-a-review-rna-seq-expression-units/


    Comment


    • #3
      Originally posted by Ben3 View Post
      Hello Conerx,

      I'm unfortunately not well-versed in R, however, at first glance it appears like the code is not correct. The order of operations for TPM and FPKM are different, so you shouldn't use one to calculate the other. It's possible I'm wrong but my recommendation is to rewrite the code yourself. I think it teaches you more to write your own code and it allows you to fully understand what is happening.

      Here are two older blog posts about TPM, RPKM, and FPKM that talk about their differences and some code to run them. Hopefully, it helps, if not let me know and I can send some additional information.

      https://haroldpimentel.wordpress.com/2014/05/08/what-the-fpkm-a-review-rna-seq-expression-units/

      Hey Ben, thank you for your answer.

      The blog posts you proposed deal with normalizing data with the fastq files at hand (raw data). However, I have only the processed data (raw counts matrix), I don't possess fasta or fastq files, therefore those blogs do not answer my question above unfortunately.
      Last edited by Conerx; 10-18-2022, 03:56 AM.

      Comment

      Latest Articles

      Collapse

      • seqadmin
        Strategies for Sequencing Challenging Samples
        by seqadmin


        Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
        03-22-2024, 06:39 AM
      • seqadmin
        Techniques and Challenges in Conservation Genomics
        by seqadmin



        The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

        Avian Conservation
        Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
        03-08-2024, 10:41 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 03-27-2024, 06:37 PM
      0 responses
      13 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-27-2024, 06:07 PM
      0 responses
      11 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-22-2024, 10:03 AM
      0 responses
      53 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-21-2024, 07:32 AM
      0 responses
      69 views
      0 likes
      Last Post seqadmin  
      Working...
      X