Entering edit mode
3.3 years ago
KS
•
0
Hi All,
I am getting an error msgs while running DESeq2 Bioconductor in R studio. When I tried without using the gene_ID column and it does work but then I am unable to see which genes are DEGs.
My Input file:
gene_ID t1.control t2.control t3.control t4.sample t5.sample t6.sample
ENSCAFG1 363 358 409 549 243 437
ENSCAFG2 294 246 242 429 211 300
ENSCAFG3 60 96 26 90 16 17
ENSCAFG4 93 81 89 126 64 79
ENSCAFG5 208 108 174 259 159 177
ENSCAFG6 467 394 412 570 311 373
My R code is:
library(DESeq2)
setwd("/file/path/")
countdata=read.table("file5", header = TRUE)
condition <- factor(c(rep("control",3), rep("sample",3)))
condition
timepoints <- factor(c(rep("t1",1), rep("t2",1), rep("t3",1), rep("t4",1), rep("t5",1), rep("t6",1)))
timepoints
sampleTable <- data.frame(condition = as.factor(condition),
timepoints = as.factor(timepoints))
sampleTable
rownames(sampleTable) <- colnames(countdata)
#### Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length
deseq <- DESeqDataSetFromMatrix(countData = countdata,
colData = sampleTable,
design = ~condition+timepoints)
deseq
deseq <- deseq[ rowSums(counts(deseq)) > 1, ] ### remove rows that have only 0 and 1
d.deseq <- DESeq(deseq)
d.deseq
#### Error in DESeqDataSetFromMatrix(countData = countdata, colData = sampleTable, :
ncol(countData) == nrow(colData) is not TRUE
Much appreciate for any help.
Move the gene column of the count data to rownames first so the count table only contains the counts as columns.
thank you so much. It is working good after your suggestion.