This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DESeq2 Error in data.frame(row.names = colnames(countdata), condition) : row names supplied are of the wrong length

Hello,

I'm getting the following error in DESeq2 after following the steps below -

data <- read.table("data.tsv", sep="\t", header=T, as.is=T) countdata <- as.matrix(data[,2:2378]) condition <- as.factor(c(rep("L45", 442), rep("GABA", 1936))) coldata <- data.frame(row.names=colnames(countdata), condition) Error in data.frame(row.names = colnames(countdata), condition) : row names supplied are of the wrong length

any idea why this is happening? the columns are the samples and rows are genes.

Thank you for your help.

Suvi

rna-seq rna-seq r deseq2

1 answer

condition contains 2378 elements. But it appears that there are 2377 columns in your countdata matrix.

The line: countdata <- as.matrix(data[,2:2378]) means your matrix will have 2377 columns (because you are skipping the first column and retaining columns #2 through #2378).

Log in to answer this question.