0

I am trying to run a qblast from the Python prompt and after importing all the libraries I need, Python cannot find my file:

>>> record = SeqIO.read(open("sinchimeras_1.fasta"), format="fasta")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'sinchimeras_1.fasta'

I have tried to write down all the route for the file ("/Users/imac...") and to move the file to the Python and to the Biopython folders, and I get the same message.

Where do I have to save my file? What am I doing wrong?

David Cain
  • 14,232
  • 11
  • 62
  • 68
Ma_fermar
  • 33
  • 2
  • 10

1 Answers1

0

You need to move that file to your working directory or use an absolute path.

This problem is independent of Biopython; the IOError is coming from open("sinchimeras_1.fasta").

Explanation

When you provide Python the relative path "sinchimeras_1.fasta", it looks in the current directory for such a file. So, instead of moving your Fasta file to a Python/Biopython folder, ensure it's in your working directory (os.getcwd() may be helpful).

Alternatively, you can supply the absolute path to the file in place of "sinchimeras_1.fasta" (e.g. open("/Users/imac.../sinchimeras_1.fasta")).

David Cain
  • 14,232
  • 11
  • 62
  • 68
  • I have tried to write down the absolute path and it still doesn't work... I am now checking if there is any problem with the file format or something like that, but I don't think this is the problem. – Ma_fermar Sep 18 '12 at 11:05
  • Actually, there was a problem with my file :S Now I am triying a different approach, treating it as a string (I have multiple sequences in one fasta file), but I think there is now one problem with the read() command. – Ma_fermar Sep 18 '12 at 12:15