DESeq2: DESeqDataSetFromMatrix Error
1
0
Entering edit mode
6 months ago
Athena • 0

Everything was running smoothly until I ran into the DESeqDataSetFromMatrix error.

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

My code:

Counts <- read.delim("RiboTag_count_matrix_10-05-2023.csv", header = TRUE, sep=",")
Counts # dimension is 24421 rows x 13 columns; first column is GeneID

Counts <- Counts[rowSums(Counts[ ,-1]) > 0, ] #omit the first column (GeneID)
Counts # dimension is 19,222 rows x 13 columns

condition <-factor(c("Het","Het","Het","Het", "Cre_WT","Cre_WT","Cre_WT","Cre_WT", "WT_naked_F.1","WT_naked_F.2","WT_naked_M.1","WT_naked_M.2"))

coldata <- data.frame(row.names = colnames(Counts[ ,-1]), condition)

coldata # 12 rows and it matches

dds <- DESeqDataSetFromMatrix(countData = Counts, colData = coldata, design = ~ condition)

The error message showed up when I ran the dds

The rest of the code:

dds <- DESeq(dis)
vsdata <- vet(dds, blind=FALSE)

#PCA Plot
plotPCA(vsdata,intgroup="condition")

How do I resolve this error? I checked the conditions for DESEqDataSet code to run and I don't see any problem... but I don't know why it gave me the error message

R RNA-seq DESeq2 • 751 views
ADD COMMENT
0
Entering edit mode
6 months ago

Your sample ids and gene ids need to be rownames, not in columns like the other data.

ADD COMMENT
0
Entering edit mode

just to confirm before DESeqDataSetFromMatrix I should transpose the matrix, correct?

ADD REPLY
0
Entering edit mode

Look at the vignette, make your data look just like that.

ADD REPLY

Login before adding your answer.

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