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
directory
parameter set to read files from? Currently I havedirectory
set 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
directory
argument in your post.Then to debug do:
Sorry the
directory
variable in my code wasExonCountFiles
A 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.table
orscan(..., 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
DESeqDataSetFromHTSeqCount
producesIt 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
DESeqDataSetFromMatrix
function therownames
of thesampleTable
are the same as thecolnames
of thecounts
and so that is how mysampleTable
was set up.