Question: DESeq2 Error: ncol(countData) == nrow(colData) is not TRUE
0
gravatar for anpham
2.1 years ago by
anpham0
anpham0 wrote:

I tried to build an DESeqDataSet with a count matrix and a table of sample information. My count matrix is read from a csv file. The count matrix has gene names as the first column. Here are my codes and error message. Please advise as how I should address the error message. Thank you.

 

# read in the count data and column data

countData <- read.csv ("Gcount.csv", header=T) # dim 48545, 437

colData <- read.csv("Phe.csv", header=TRUE)  # dim 436 53

# construct the DESeqDataSet object
dds <- DESeqDataSetFromMatrix (countData = countData, 
                               colData = colData, 
                               design = ~age_cut4 + Batch_RNA + Study + sex)

# I got the following error message

Error: ncol(countData) == nrow(colData) is not TRUE

 

 

deseq2 error • 3.7k views
ADD COMMENTlink modified 2.1 years ago by Michael Love24k • written 2.1 years ago by anpham0
Answer: DESeq2 Error: ncol(countData) == nrow(colData) is not TRUE
2
gravatar for Michael Love
2.1 years ago by
Michael Love24k
United States
Michael Love24k wrote:

The countData should be only a matrix of counts, where each column corresponds and is in the same order as the rows of colData.

As you have a first column with names, you just need to remove that (and you can assign the names as rownames):

mat <- countData[,-1]
rownames(mat) <- countData[,1]
ADD COMMENTlink modified 2.1 years ago • written 2.1 years ago by Michael Love24k

Hi. I don't understand how to fix this. 

Can you explain it with more details?

Thanks you!

ADD REPLYlink written 2.0 years ago by kdelgadoteiguel0

Can you partner with a bioinformatician or someone with experience with R coding?

ADD REPLYlink written 2.0 years ago by Michael Love24k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 217 users visited in the last hour