colnames error while using DESeq2 package

library("DESeq2")
ddsHTSeq <-DESeqDataSetFromHTSeqCount(sampleTable = sampleTable, directory = directory, design = ~ condition)
ddsHTSeq

After loading the DESeq2 library I try to take my existing HTSeq-count file (generated elsewhere, not in RStudio) but I run into this error:

Error in colnames<-(*tmp*, value = sampleTable[, 1]) :
attempt to set 'colnames' on an object with less than two dimensions

I am still very new to using RStudio and have very generic understanding of working with R; and I don't even know where to begin to address this error. Any guidance/help would be greatly appreciated!

It looks like it failed to read the counts file. Simplest explanation is that directory is incorrect, or that the filepaths indicated in sampleTable are not right.

To test that, you can run:

file.path( directory, sampleTable[1,2] )
# and
read.table( file.path( directory, sampleTable[1,2] ), fill=TRUE )

it should point to an existing file, if it doesn't, something in your inputs is wrong. Can you share list.files(directory) and head(sampleTable)?

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.