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

I am using HTseq pipeline for DESeq2:

Directory = "/Users/abhaykanodia/Desktop/smallRNA/"

condition = c("WT1", "WT2", "WT3",
              "NTC1", "NTC2", "NTC3)

sampleFiles= c("AK1a_counts.txt","AK2a_counts.txt","AK3a_counts.txt","
AK4a_counts.txt","AK5a_counts.txt","AK6a_counts.txt")

sampleName = c("AK1", "AK2", "AK3", "AK4", "AK5", "AK6")

sampleTable <- data.frame(sampleName = sampleName, fileName = sampleFiles, condition = condition)
sampleTable

The output is:

sampleName         fileName           condition
1         AK1  AK1a_counts.txt                 WT1
2         AK2  AK2a_counts.txt                 WT2
3         AK3  AK3a_counts.txt                 WT3
4         AK4  AK4a_counts.txt                NTC1
5         AK5  AK5a_counts.txt                NTC2
6         AK6  AK6a_counts.txt                NTC3

Now, when I use:

ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
                                       directory = Directory,
                                       design= ~ condition)

It gives the following error:

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

What is inside Directory ? list.files(path = Directory)

Hi @Basti,

Thanks for your response. Here is the output of list.files(path = Directory) :

[1] "AK1a_counts.txt" [2] "AK2a_counts.txt"
[3] "AK3a_counts.txt"
[4] "AK4a_counts.txt"
[5] "AK5a_counts.txt"
[6] "AK6a_counts.txt"

Check if read.table("path_to_your_file/AK1a_counts.txt", fill=TRUE) correctly imports the data, otherwise the data might not be correctly formatted

 The output of read.table("/Users/abhaykanodia/Desktop/smallRNA/AK1a_counts.txt", fill=TRUE) is:
           V1                   V2
1         ENSG00000000003.15  2
2          ENSG00000000005.6  0
3         ENSG00000000419.14 21
4         ENSG00000000457.14  0
5         ENSG00000000460.17  2
6         ENSG00000000938.13  0

I see no problem on this file and everything seems to work fine when taking this dataset as example. It is likely that some of your files have problem of data structure. You may need to check if every file is correctly formatted, try to see if it works with only some files or not etc

Thank you very much @Basti! I highly appreciate your help. I will check all my files as you suggested.

These files will really import without rownames?

Hi @swbarnes2,

Thanks for your response. Can you please explain your question, i didn't understand. Whatever I have posted is the actual output I got from R.

Do you have rownames or not? I've never used that particular import method, but I've always imported metadata files where the sample names were the rownames, and count data where the gene names were the rownames, and t don't think that's what you have. Since things are not working as you have them, it's worth checking to see if that is the issue.

0 answers

No answers yet.

Log in to answer this question.