This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in DESeqDataSetFromMatrix /.../ ncol(countData) == nrow(colData) is not TRUE

Hey all,

I'm kind of at my wit's end here... I know other's have posted similar errors, and I've eliminated the trivial (extra column) type causes.

> ddsPlin2wtvsko <- DESeqDataSetFromMatrix(countData=countData, colData=metaData2,
 design=~genotype, tidy = TRUE)

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

> all(colnames(countData) == rownames(metaData2))

TRUE

> class(countData)

"matrix" "array" 

> class(metaData2)

"matrix" "array" 

> dim(as.matrix(countData))

54309     8

> dim(as.matrix(metaData2))

8 4

> all(colnames(countData) == rownames(metaData2))

TRUE

Why am I getting an "ncol(countData) == nrow(colData) is not TRUE" error?!?

deseq2 r

1 answer

The quick thing to try: try tidy = FALSE

You, beauty! I'm totally baffled as to why there was an error, but at least I've moved past the banging head against wall stage.

> ddsPlin2wtvsko <- DESeqDataSetFromMatrix(countData=countData, colData=metaData2 design=~genotype, tidy = FALSE)

converting counts to integer mode
Warning message:
In DESeqDataSet(se, design = design, ignoreRank) :
  some variables in design formula are characters, converting to factors

Those messages are not problems. You want raw counts to be integers, and you probably want your design elements to be factors.

Log in to answer this question.