Unconfigured Ad

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

    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

      • mylaser
        Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
        by mylaser
        Kheloyar – Everything You Need to Know About Kheloyaar Login and Kheoyar Id
        If you are looking for an online gaming platform that offers a user-friendly experience, Kheloyar has become a name that many users search for. Whether you're interested in creating a new account, accessing your dashboard through Kheloyaar Login, or learning how to obtain a Kheoyar Id, understanding the platform's features and account process is essential.
        This guide explains everything you need to know about...
        Today, 01:13 AM
      • SEQadmin2
        Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
        by SEQadmin2



        Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
        ...
        07-09-2026, 11:10 AM
      • SEQadmin2
        Cancer Drug Resistance: The Lingering Barrier to Rising Survival
        by SEQadmin2



        Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

        There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
        07-08-2026, 05:17 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 07-09-2026, 10:04 AM
      0 responses
      17 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-08-2026, 10:08 AM
      0 responses
      10 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-07-2026, 11:05 AM
      0 responses
      22 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 07-02-2026, 11:08 AM
      0 responses
      31 views
      0 reactions
      Last Post SEQadmin2  
      Working...