DESeq2 saying that dimensions of count matrix and metadata don't agree, but they do agree
1
0
Entering edit mode
3 months ago
hippo ▴ 10

Hi all,

I have a counts matrix and a metadata table with the following dimension:

> dim(as.matrix(cts)) 
[1] 6009   60
> dim(colData)
[1] 60  4

so that there are 60 samples and 60 corresponding rows of metadata in colData.

The problem that I'm having is the following. Whenever I try to setup the DESeqData object,

# construct DESeqDataSet Object
dds <- DESeqDataSetFromMatrix(countData=cts,
                              colData=colData,
                              design=~Condition+Timepoint,tidy=TRUE)

I get the following error:

Error in DESeqDataSetFromMatrix(countData = as.matrix(cts), colData = colData,  : 
  ncol(countData) == nrow(colData) is not TRUE

Which doesn't make sense to me. I'm thinking it has something to do with how my cts matrix is setup :

Rstudio environment showing cts

Perhaps the rownames are causing issues? I don't know.

expression R differential • 330 views
ADD COMMENT
0
Entering edit mode

What does it give if you type the exact command of error msg

ncol(as.matrix(ct) == nrow(colData)
ADD REPLY
2
Entering edit mode
3 months ago

Hi, please use tidy = FALSE, and then it will work.

Also, it is strange that you have no colnames on your expression matrix. Obviously the columns of cts must match, in both number and order, the rows of colData.

Kevin

ADD COMMENT
1
Entering edit mode

Hi Kevin,

Thanks! tidy=False fixed it. I do have colnames, just hadn't added tacked them on before screenshotting. Thanks for your help!

ADD REPLY

Login before adding your answer.

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