Deseq error : ncol(countData) == nrow(colData) is not TRUE
3
1
Entering edit mode
4.8 years ago

I am running deseq2 on a matric of species abundance persample from a metagenomic dataset and am getting the following error:

Error in DESeqDataSetFromMatrix(countData = data, colData = metadata,  : 
  ncol(countData) == nrow(colData) is not TRUE

I get what the error is telling me but I dont understand why DESeq requiers this satisfaction. Why does the number of samples and number of genes (in this case species) need the be the same? Or am I missundstanding something here?

The code generating this error is :

ddsFullCountTable = DESeqDataSetFromMatrix(
  countData = data,
  colData = metadata,
  design = Caste_composite
)

Any help would be appriciated :)

genome • 16k views
ADD COMMENT
0
Entering edit mode

Hi, I am running DEseq for analysing a count data file generated by ht-seq. I am running the following command after creating a separate file metadata with all the information from the Count.csv. i can see that there are 8 columns including gene in the cts where as in metadata i have 7 rows. As i understand this must be equal, but how to make them equal?

Please help me fix this error.

cts <- read.csv("Count.csv", header = TRUE, sep = ",")
head(cts)

    Gene SRR58581 SRR58582 SRR58583 SRR58584 SRR58585 SRR58586
1 0610005C13Rik         29         45         35         48         59         44
2 0610006L08Rik          0          0          3          0          0          9
3 0610009B22Rik          0          1          4          1         21          1
4 0610009E02Rik        234        185        283        155        128        106
5 0610009L18Rik          0          0          5          1          0          3
6 0610010F05Rik          9          9          8          6          0         12
  SRR58587
1         44
2          0
3          4
4         91
5          0
6          7

metaData <- read.csv("metadata.csv", header = TRUE, sep = ",")
metaData
    id       dex Replicate
1 SRR58581   Treated         1
2 SRR58582   Treated         2
3 SRR58583   Treated         3
4 SRR58584   Untreated      1
5 SRR58585  Untreated       2
6 SRR58586  Untreated       3
7 SRR58587  Untreated       4

dds <- DESeqDataSetFromMatrix(countData=cts, 
                          colData=metaData, 
                          design=~dex)

> Error in DESeqDataSetFromMatrix(countData = cts, colData = metaData,
> design = ~dex) :    ncol(countData) == nrow(colData) is not TRUE
ADD REPLY
0
Entering edit mode

Go look at a DESeq2 vignette, like this one:

https://bioconductor.org/packages/release/bioc/vignettes/DESeq/inst/doc/DESeq.pdf

See how neither their count data nor their metadata has row numbers, and you do? Fix that.

ADD REPLY
0
Entering edit mode

Thank you, this was helpful. As per this link,I generated the phenodata (table) using scripts and it worked.

ADD REPLY
0
Entering edit mode

Dear Sujit, this is a new question and should not be posted as an answer to an existing question. Can you please repost this in its own question.

ADD REPLY
0
Entering edit mode

Sorry for writing here, i have followed your suggestions in other threads and that has been quite helpful. I posted the question here so that i could get your reply. Thankfully its solved now.

ADD REPLY
3
Entering edit mode
4.8 years ago

Just to follow up what ATpoint said - your colData (here that is metadata) should contain a row for each sample in the analysis, which your countData (here that is data) should contain one column for each sample. Therefore the number of rows in colData should be the same as the number of columns in countData and both should be equal to the number of samples in the study.

ADD COMMENT
2
Entering edit mode
4.8 years ago
ATpoint 85k

Why does the number of samples and number of genes (in this case species) need the be the same? Or am I missundstanding something here?

It talks about colData, not the columns of your matrix. Please show the colData (metadata) and the colnames of your count matrix.

ADD COMMENT
0
Entering edit mode

Ahhh yes opps my bad. I was geeting cofused looking at some DESeq2 documentation about data orientation ! Thanks for point it out for me :)

ADD REPLY
0
Entering edit mode

No problem at all :) If you need anything else just let us know.

ADD REPLY

Login before adding your answer.

Traffic: 1032 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