Hi,
I am testing salmon and kallisto for RNA-seq. both tools outputs ESTIMATED counts and TPM. I have read around and put my notes here https://github.com/crazyhottommy/RNA-seq-analysis/blob/master/salmon_kalliso_STAR_compare.md#counts-versus-tpmrpkmfpkm
My questions are:
1. from the help of tximport function:
countsFromAbundance: |
character, either "no" (default), "scaledTPM", or "lengthScaledTPM", for whether to generate estimated counts using abundance estimates scaled up to library size (scaledTPM) or additionally scaled using the average transcript length over samples and the library size (lengthScaledTPM). if using scaledTPM or lengthScaledTPM, then the counts are no longer correlated with average transcript length, and so the length offset matrix should not be used. |
To my understanding, TPM is a unit that scaled by (effective) feature length first and then sequencing depth. So, what are scaledTPM and lengthScaled TPM? does tximport use the estimate counts to get the TPM?
2. what's the difference among the TPM output by salmon/kallisto and the TPM returned by tximport function?
3. How does tximport mathematically convert counts to TPM if use the estimated counts to get the TPM?
Thanks very much!
Ming Tang
Thanks Michael. I understand much better. correct me if I am wrong:
tximport function just import the estimated counts/TPM and summarize to gene-level.
tx.salmon$counts will be the count table from the original salmon quantification, but gene-level summarized.
tx.salmon$abundance will be TPM table from the original salmon quantification, but gene-level summarized
Alternatively, one can generate the count table from TPM (not from the original estimated counts):
tx.salmon.scale$abundance will be the same as tx.salmon$abundance ( I checked)
but tx.salmon.scale$count will be generated by using the TPM value * featureLength * library size.
values of tx.salmon.scale$count are very close to tx.salmon$count, but accounted for transcript length changes across samples.
Yes correct.
@Michael Love , thank you. That was succinct; much appreciate it. Its too bad the toil project in Xena (TCGA) does not provide the library size for this conversion or just the tpm counts.
A
Dear Michael, Sorry for disturbing you now.
It seems a little latter for this post, I'm confused of tximport, I want to convert my data to a DESeq2 object, the data is downloaded from site https://xenabrowser.net/datapages/?dataset=TcgaTargetGtexgeneexpected_count&host=https%3A%2F%2Ftoil.xenahubs.net&removeHub=https%3A%2F%2Fxena.treehouse.gi.ucsc.edu%3A443.
the data I use is something like what vigentte(tximport) says RSEM sample.genes.results, and I find this argument tx2gene is required for gene-level summarization for methods that provides transcript-level estimates only (kallisto, Salmon, Sailfish) in R help document. so I leave my code this
tximport::tximport("prostate_rna", type = "rsem", txIn = F, txOut = T)
, the object prostate_rna is tranformed from the data I download through a algorithm of 2^data - 1., but R gives me a error:1 Error in computeRsemGeneLevel(files, importer, geneIdCol, abundanceCol, : all(c(geneIdCol, abundanceCol, lengthCol) %in% names(raw)) is not TRUE 此外: Warning message: Unnamedcol_types
should have the same length ascol_names
. Using smaller of the two.I don't know what to do to transform my data into a DESeq2 subject.
tximport is only for importing files that are directly output by one of the software listed in the vignette. It can not import this type of data which has been preprocessed by another program other than the ones in the vignette.
Thanks for your reply, It's terrible to the ucsc data (UCSC Toil RNAseq Recompute ) which only provide a RSEM expectedcount with the unit of log2(expectedcount+1), so I have to transform it to expected_count because I see DESEq2 want to receive a raw count without any polish.
Is there any way to solve the data in ucsc and bring it to DESeq2 object, I have find something in forum that recommend a function round, However, I also find the more recommended way is trimport. as your opinion, can I take function round into consideration?
Thanks Michael!
I don’t have a recommendation for what to do here. I wouldn’t use DESeq2 if you don’t have access to the right input data.
Thank you a lot, I'll try another way to deal with the ucsc data
Dear Michael - are scaledTPM and lengthScaledTPM values comparable across samples? (which TPM is definitely not) I could be completely mistaken, but while both adjust for library size and gene length neither adjust for RNA/library composition? (like DESeq2 median of ratios and edgeR TMM normalization methods)
These two have library size differences baked in. The column sum is equal to the number of mapped reads. So not comparable across samples.
These two have library size differences baked in. The column sum is equal to the number of mapped reads. So not comparable across samples.
Thank you for the explanation. Oh ok, so scaledTPM and lengthScaledTPM values are equivalent to gene-level quantification read counts? Similar to what would be produced by HTSeq or featureCounts?
Kind of, yes. For more details, check the Soneson 2015 paper.