This is a test version of Biostars. For the public version, visit https://www.biostars.org.
tximport output should be integer values, IS NOT.

Hi, I am analyzing RNA-seq data and I used Stringtie to assemble transcripts and quantify them. Now to perfom DE analysis on them (using DESeq2), I used tximport which is recommended by the authors of DESeq2 to convert the count values generated from Stringtie to integer values that DESeq2 can use.

This is my R code -

quantdata <- c('path/to/18T3L/t_data.ctab', '/path to/18T6L/t_data.ctab', ....)

tmp <-readr::read_tsv(quantdata[2])

tx2gene <- tmp[, c("t_name", "gene_id")]

txi_output <- tximport(quantdata, type = "stringtie", tx2gene = tx2gene)

sampleTable <- data.frame(condition = factor(c("P", "P", "NP", "P", "P", "P", "P", "NP", "NP", "P", "P", "P", "P", "P", "P", "P", "P", "P", "P", "P", "NP", "P", "P", "P", "NP", "P", "P", "P", "P", "P", "NP", "NP", "NP", "NP", "P", "P", "P", "P", "P")))

coldata <- sampleTable

coldata$condition <- relevel(coldata$condition, ref = "NP")

library(DESeq2)

dds <- DESeqDataSetFromMatrix(
     countData = txi_output$counts,
     colData = coldata,
     design= ~ condition)

However, running this gives the error -

Error in DESeqDataSet(se, design = design, ignoreRank) :   some values in assay are not integers

And when I check the values using head(txi_output$counts), the corresponding values are not integers, but decimal.

So basically, tximport is not converting the count values to integer, which is one of its functions. Any pointers to what I may be doing wrong here?

EDIT : The problem was, as Ram points out below, that I was using DESeqDataSetFromMatrix(), whereas I should use DESeqDataSetFromTximport(). Changing the last line to the following solved the issue -

dds <- DESeqDataSetFromTximport(
     txi = txi_output,
     colData = coldata,
     design= ~ condition)
dds <- DESeq(dds)
rna-seq stringtie

1 answer

tximport is not converting the count values to integer, which is what its supposed to do.

Can you show us where this is mentioned in the documentation? Also, why are you using DESeqDataSetFromMatrix() instead of DESeqDataSetFromTximport(), the function that does the rounding (which I got not from the documentation but from here)?

I might be missing something but nothing in there speaks about integer/decimal counts or rounding.

Thanks a lot Ram. I think I may have misunderstood. I think it is true that the job of tximport is to provide count values to DESeq2 (which need to be integer) but I guess it doesn't do it on its own (using the tximport function). Rather I think that conversion to integer happens using DESeqDataSetFromTximport(). Thanks for the clarification!

Ram, I changed my code to have DESeqDataSetFromTximport() instead of DESeqDataSetFromMatrix(), and it worked fine. Thanks a lot!

Log in to answer this question.