Problem with seqinr::load.fasta "The specified file does not exist."
Hi everyone,
I'm having troubles importing a FASTA file using load.fasta() from the kodonz package. I installed and loaded the package, then:
library("kodonz")
library("seqinr") # load.fasta
ac <- load.fasta(file = "https://fungidb.org/common/downloads/release-47/Acandida2VRR/fasta/data/FungiDB-47_Acandida2VRR_AnnotatedCDSs.fasta")
And got the following error message:
The specified file does not exist.
Please check the file name and try again.
What might be the problem? I do not get this error when I use read.fasta(). I'd be very grateful for any suggestions, I'm just a beginner :)
• 1,721 views
•
link
1 answer
If you check the source code of that function you see that it checks file existence with file.exists() so it must be a file on a drive, you cannot stream this. Simply download to disk and then load from there as genomax suggests.
library(seqinr)
# download the file
download.file(url = "https://fungidb.org/common/downloads/release-47/Acandida2VRR/fasta/data/FungiDB-47_Acandida2VRR_AnnotatedCDSs.fasta",
destfile = "FungiDB-47_Acandida2VRR_AnnotatedCDSs.fasta")
# check if the file exists
file.exists("FungiDB-47_Acandida2VRR_AnnotatedCDSs.fasta")
# [1] TRUE
# import
myFasta <- read.fasta("FungiDB-47_Acandida2VRR_AnnotatedCDSs.fasta")
# check if it exists in R
exists("myFasta")
# [1] TRUE
• 0 views
•
link
Log in to answer this question.
It is less likely that the package supports reading a file over the web using http protocol. Have you tried to save the file locally first? If you put that link is a browser window, you should be prompted to save the file locally.
Thank you for you reply! I tried it and it didn't work (a different file, but still the same issue and error message):
In fact, the file seems not to exist:
I think this is the same problem as in https://community.rstudio.com/t/rstudio-on-windows-10-while-saving-any-type-of-file-i-get-file-not-found-and-permissions-are-not-the-issue/29705 but cannot fix it at the moment.
The
.fastasuffix is missing.