This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in DESeqDataSetFromMatrix

Good day everyone. As I'm trying to run a DE analyze, I'm getting this error over and over. I have seen that many people ran into that same error at some point while performing DESeq2 but I haven't seen an answer that I am able to follow to get it solved. Can anyone help with that?

> CountTable <- read.delim("~/Downloads/totalreadcount.txt")

> sampleTable <- data.frame(row.names=c("405-8wInf","410-8wUninf","415-8wInf","416-8wUninf","420-8wUninf","422-8wInf","424-8wUninf","426-8wInf","431-8wInf","443-8wUninf","460-8wInf","405-20wInf","410-20wUninf","415-20wInf","416-20wUninf","420-20wUninf","422-20wInf","424-20wUninf","426-20wInf","431-20wInf","443-20wUninf","460-20wInf"),condition=as.factor(c("8wInf","8wUninf","8wInf","8wUninf","8wUninf","8wInf","8wUninf","8wInf","8wInf","8wUninf","8wInf","20wInf","20wUninf","20wInf","20wUninf","20wUninf","20wInf","20wUninf","20wInf","20wInf","20wUninf","20wInf")))

> dds <- DESeqDataSetFromMatrix(countData=CountTable, colData=sampleTable, design=~condition)
Error in DESeqDataSetFromMatrix(countData = CountTable, colData = sampleTable,  : 
  ncol(countData) == nrow(colData) is not TRUE
rna-seq r deseq2

1 answer

Hi, This is due to colnames of the count table and rownames of the sampleTable doesnot match. You can change the column name of the count table in R:

colname(Count)[1:n] <- row.names(sampleTable)

n is the number of sample. Also check the sequence of sample in count table.

Log in to answer this question.