Hello,
I am struggling to solve the following problem while trying to analyze my RNASeq data with DESeq2.
When trying to import files via tximport, I get the following error:
txi <- tximport(files, type="salmon", tx2gene=tx2gene) Error in tximport(files, type = "salmon", tx2gene = tx2gene) :
all(file.exists(files)) is not TRUE.
Having read the earlier submissions issued by others I checked on my file path und directory, both are correct. - When performing: all(file.exists(files)) I receive [1] FALSE. - When performing: all(file.exists("/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon")) I receive [1] TRUE - When only performing > file.exists(files) I receive [1] FALSE FALSE FALSE FALSE FALSE FALSE - when performing file.exists("/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon") I receive [1] TRUE
When I try to run the command "txi <- tximport(files, type="salmon", tx2gene=tx2gene)" using the file.path ("/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon") instead of files, I receive: 1 Error in guessheader(datasource, tokenizer, locale) : Cannot read file /Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon: Invalid argument
The analysis had been working fine for me up to now without changing or deleting anything. Additionally, after the error keeps on occurring I ran an update on R, RStudio, Bioconductor and the packages including tximport. The error still remains.
Can anyone please help me to solve this problem? Thank you very much in advance.
Leo
Additional information:
When I type in "files", it gives me the correct files:
files sample1 "/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon/xx1/quant.sf" sample2 "/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon/xx2/quant.sf"
What do you mean by 'correct' in that context? Certainly not 'existing'?
There are not (in my version of tximportData) any subdirs in the extdata dir called xx1, xx2, etc, nor are there any quant.sf files in those non-existant directories. There are six ERRXXXXXX directories, each of which has a quant.sf.gz file, but you aren't pointing to those.
Thank you for your quick reply and your help! I deleted the ERRXXXXXX directories and replaced them with xx1/2/3 etc.. directories (renamed; in this case "G2NULL6hIIRepS9R1001.fastq.gz“quant“) containing quant.sf files.
After performing "dirs" I just saw that it gives me 2 // just before the replaced directory. Might this be the error?! Or do i explicitly need quant.sf.gz files? I have been using quant.sf until now and it worked fine.
Add-on: It gives me the same error when I reinstall tximportData and perform your commands with the preinstalled directories and files. The " double-//" is shown aswell..
Thank you in advance!
On whether to use
quant.sf
orquant.sf.gz
, you should use the name of the file that is on your machine.At some point I updated
tximportData
to gzip the quant files. You don't have to do this with your own data.If you want to look up whether the files are gzipped or not, or if they exist at a certain location on your machine, use
list.files()
:sapply
call doesn't make sense. Yourdirs
object is a character vector of file locations, and yoursapply
call is asking 'what files with "sf" in their name are in these directories?', which doesn't make any sense, given that those aren't directories. What you need to pass totximport
is a character vector of file names (including the path if they are not in the same directory, which +/- they should be).sapply
call doesn't make any sense, because none of the files you are looking for have sf in the file name!. The pattern argument todir
is intended to restrict the returned values to those files that match the pattern. If you don't have any files with sf in the name, you by definition will not get any file names returned.I should also note that
tximport
is intended to read in files that have been generated by software like salmon, or kallisto, etc. The files you are looking to import are FASTQ files which are inputs for salmon, etc, not outputs.There are so many things here that are wrong that it is hard to know where to start. At the bare minimum you need to peruse the tximport vignette, and you would probably be better served by finding someone local to help you, because you may be irretrievably lost.
Thank you very much for your detailed replies and help! Perhaps I should have explained the initial situation more extensively to prevent misunderstanding.
2.Concering " /Library/Frameworks/R.framework/Versions/3.5/Resources/library/tximportData/extdata/salmon//G2CT6hIIIRepS11R1001.fastq.gz“quant“" Those are directories, containing my quant.sf file. I replaced the initially installed directories "ERR188..." with the above-mentioned directories, named with an own designation "G2CT6hIIIRepS11R1001.fastq.gz“quant“". Unfortunately I did not copy the name of the file, I just copied the directory, which is identical to the contained file missing the quant.sf. My apologies if this lead to misunderstanding.
As I mentioned above, importing the files via tximportdata by replacing the ERR....-directories had been working perfectly fine for me until now, being able to run the full rna-seq procedure. I'll keep on exploring where the mistake is located und keep you updated.
Thank you and sorry if any misunderstandings occured.
Leo
Unless you are actually answering a question, please don't use the Add Answer box, because you aren't answering a question. As to your original question, please note that the help page for
tximport
says this:And you are passing in a bunch of directory names, which are not the same thing.