DeSEq2-- error- count matrix
1
0
Entering edit mode
@bcc3ae4b
Last seen 15 days ago
United States

I have received this error:

dataset <- DESeqDataSetFromMatrix(countData = countData,
+                                   colData = colData,
+                                   design = ~condition)
*Error in DESeqDataSet(se, design = design, ignoreRank) : 
  counts matrix should be numeric, currently it has mode: character*

And here is the code I am running :

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install("DESeq2")
library('DESeq2')
library('RColorBrewer')
countFilePath = './count-1.txt'
countData = read.table(file = countFilePath, header = FALSE, sep = '\t', row.names = 1,stringsAsFactors=FALSE)
##make first row the colname
colnames(countData) <- countData[1,]
countData <- countData[-1, ] 

##if needed to remove some columes countData = countData[3:ncol(countData)] 
dim(countData)
colFilePath = './colname-Jul12.txt'
colData = read.table(file = colFilePath, header = TRUE, sep = ' ', row.names = 1)
colData[['condition']] =  factor(colData[['condition']], levels = c('Water', '130','160'))      
colData
dataset <- DESeqDataSetFromMatrix(countData = countData,
                                  colData = colData,
                                  design = ~condition)

Anybody can help me here?

Thank you so much Sali

DESeq2 • 109 views
ADD COMMENT
0
Entering edit mode

Since the software is complaining about the content of CountData, you don't think it might be helpful to show people a little of your countData? Since the software is complaining that your CountData isn't numerical, don't you think you should show how you checked to make sure that it was all numerical?

ADD REPLY
0
Entering edit mode
@mikelove
Last seen 2 days ago
United States

You need to examine countData as swbarnes2 suggests. It is currently a table of character value data, but needs to be numeric data.

One way to avoid this would be to specify header=TRUE when reading in the data, so R recognizes the data as entirely numeric values. Note that read.delim has header=TRUE by default:

https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/read.table

You may want to get some basic R help from bioinformatic collaborators first.

ADD COMMENT

Login before adding your answer.

Traffic: 378 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6