Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Conerx
    Junior Member
    • Oct 2022
    • 2

    #1

    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!
  • Ben3
    Member
    • Sep 2022
    • 79

    #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

    • Conerx
      Junior Member
      • Oct 2022
      • 2

      #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

      • SEQadmin2
        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
        by SEQadmin2



        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
        ...
        10-14-2026, 09:55 AM
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Yesterday, 11:13 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, Yesterday, 10:48 AM
      0 responses
      16 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      35 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      42 views
      0 reactions
      Last Post SEQadmin2  
      Working...