Problem with seqinr::load.fasta "The specified file does not exist."
1
3
Entering edit mode
4.5 years ago
carroll ▴ 30

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 :)

R fasta • 1.1k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Thank you for you reply! I tried it and it didn't work (a different file, but still the same issue and error message):

   pi <- load.fasta(file="C:/Users/Tomasz.x230/Desktop/FungiDB-47_PinfestansT30-4_AnnotatedCDSs")

In fact, the file seems not to exist:

> file.exists("C:/Users/Tomasz.x230/Desktop/FungiDB-47_PinfestansT30-4_AnnotatedCDSs")
[1] FALSE

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.

ADD REPLY
2
Entering edit mode

The .fasta suffix is missing.

ADD REPLY
3
Entering edit mode
4.5 years ago
ATpoint 85k

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
ADD COMMENT

Login before adding your answer.

Traffic: 1911 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6