Hi,
I am trying to use a sampleTable from a .txt file as I normally would when importing counts as a count matrix using DESeqDataSetFromMatrix however when I do this the function doesn't find the proper path for the files. I receive the error message listed below.
I have tried to assign the rownames of the table to be the same as the names of each sample in the directory and that hasn't helped either.
Any ideas what I am missing?
If I use the suggested code in the tutorial i.e. make a sample table from the names of the files in the directory the function works, but I have a lot of information I would like to include in an separate sampleTable..
library(DESeq2)
ExonCountFiles <- "/Bigdata/Dropbox (Technion Dropbox)/Rina_Benel/Shared/CMV/CMV_sep19/htseq_6.5.21/exon_count"
list.files(ExonCountFiles)
TamisDesign <- read.table("/Bigdata/Dropbox (Technion Dropbox)/Rina_Benel/Home/Rina/CMV_Sep2019/data/sampleSheetTami.txt",
sep = "\t", header = F, row.names = 1)
head(TamisDesign)
colnames(TamisDesign) <- c("sampleName", "infectionStatus", "placentaStatus",
"NumWomen", "BioRep")
TamisDesign <- TamisDesign[order(TamisDesign$sampleName), ]
head(TamisDesign)
TamisDesign$NumWomen <- factor(TamisDesign$NumWomen)
TamisDesign$infectionStatus <- factor(TamisDesign$infectionStatus)
TamisDesign$placentaStatus <- factor(TamisDesign$placentaStatus)
Error in file(file, "rt") : cannot open the connection
This however does work...
sampleFiles <- list.files(ExonCountFiles)
sampleCondition <- gsub('exon_count_', "", sampleFiles)
sampleTable <- data.frame(sampleName = sampleFiles,
fileName = sampleFiles,
condition = sampleCondition)
sampleTable$condition <- factor(sampleTable$condition)
Thanks!

The vector contains just
FALSE...So where is the
directoryparameter set to read files from? Currently I havedirectoryset to a the path of the file which includes all (80 separate files) of the output files ofHTSeq...Oh sorry I didn't see any code including a
directoryargument in your post.Then to debug do:
Sorry the
directoryvariable in my code wasExonCountFilesA vector of
TRUE:)Which means to me that the function is looking for the files in the correct place...
So what seems to be the issue?
Another issue is whether R is allowed to read those files I guess.
Try reading one in with
read.tableorscan(..., what="char")Yea, no issue there...
alternatively is there a work around for
DESeqDataSetFromHTSeqCount. I guess I could convert it to a count matrix and then useDESeqDataSetFromMatrix?I can't help debug because you haven't posted the code where you actually get the error. Can you post that, and also the output from
traceback()after you get the error.I posted it above, but maybe it wasn't clear. Here it is again:
Here is the error that the
DESeqDataSetFromHTSeqCountproducesIt is clear from the end of the path that the error includes "ending in mock" that the function is not reading the file names properly. Since there is no file that starts with mock
The documentation says:
It isn't clear from the above that you've specified the file name (the second column) in
TamisDesign. It looks like you second column is the infection status.Thank you!
I guess in the
DESeqDataSetFromMatrixfunction therownamesof thesampleTableare the same as thecolnamesof thecountsand so that is how mysampleTablewas set up.