This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DeSeq2 error: counts matrix should be numeric, currently it has mode: character

Hi there,

Is there any way to get rid of this while creating object for Deseq2. I used script:

dds <- DESeqDataSetFromMatrix(countData = cts, 
           colData = coldata, 
           design = ~ condition) 

Error in DESeqDataSet(se, design = design, ignoreRank) : 
  counts matrix should be numeric, currently it has mode: character

I check my count matrix and I don't see any character specified only numeric values except row names as genes and colum names as samples. Then I also run the script to see if my count matric is numeric

all(is.numeric(cts))
False

I don't know where creating dds showing me this error. I will appreciate your help in this matter.

Imran

rna-seq deseq2 r

How did you generate the count matrix? It might look as numbers but be character

cts object is not numeric, could you paste the output of cts[1:10, 1:10] ?

all(is.numeric(cts)) should return True

count matrix should be numeric (integer). How did you import your table? using read.csv only (for CSV file)? Try this: Import your table for CSV file as

cts = as.matrix(read.csv('table_file', row.names='gene_column_name'))

Write first the command on how you imported the data

Please comment to questions with ADD COMMENT, the answer field is for answers please.

Hello imrankhanbioinfo!

We believe that this post does not fit the main topic of this site.

Cross-posted and answered by the DESeq2 maintainer: https://support.bioconductor.org/p/131243/

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

imrankhanbioinfo, you see why cross-posting is generally not appreciated. Now a total of 6 users across two communities invested effort whereas a single post would have been sufficient. Please consider not to cross-post in the future, decide for one community and then be patient. It is very likely that you get a good response in time. Thanks to all who commented.

My apologies. I was not aware of this regulation. Will comply with 100% and fully noted for the future as well.

In case somebody else is also landing here:

I used HT-Seq's output for the count-table. However, the output table does provide row names (the gene/transcript IDs), but no column names. Thus, adding a header (= column names) to the table made the difference for me.

0 answers

No answers yet.

Log in to answer this question.