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
        Essential Discoveries and Tools in Epitranscriptomics
        by seqadmin




        The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
        04-22-2024, 07:01 AM
      • seqadmin
        Current Approaches to Protein Sequencing
        by seqadmin


        Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
        04-04-2024, 04:25 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 04-25-2024, 11:49 AM
      0 responses
      15 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-24-2024, 08:47 AM
      0 responses
      17 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      62 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Working...
      X