Hi everyone, I'm new to Biopython and python in general so im going through the tutorials trying to get the hang of it for future job prospects in bioinformatics and for fun because why not.
I am having a few issues though, for example tutorials aren't great at telling you where to be playing with your program. I was using IDLE for a while until it turned out that i needed to use python.exe to actually install biopython. A problem at the minute is the program not finding the example stuff for this tutorial: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc10
from Bio import SeqIO
for seq_record in SeqIO.parse("ls_orchid.fasta", "fasta"):
printseq_record.id)
print(repr(seq_record.seq))
print(len(seq_record))
This just leaves the error:
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
for seq_record in SeqIO.parse("ls_orchid.fasta", "fasta"):
File "C:\Users\dlb_p\Desktop\Python\lib\site-packages\Bio\SeqIO\__init__.py", line 592, in parse
with as_handle(handle, mode) as fp:
File "C:\Users\dlb_p\Desktop\Python\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "C:\Users\dlb_p\Desktop\Python\lib\site-packages\Bio\File.py", line 87, in as_handle
with open(handleish, mode, **kwargs) as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'ls_orchid.fasta'
I have no idea where to start with this.
By the way this may be the first of many posts for help so any pointers would be greatly appreciated.
King regards,
D Pointon
Have you tried hardcoding the full name of the path (including the present working directory) instead of just the filename "ls_orchid.fasta"?
Sorry for the late reply, doing alot of 11 hour shift ATM. How would I go about hardcoding the location?
Yup, that's exactly how you'd do it.
Awesome, I'll give it a go when I get back home. Thanks for the help.
I know error messages are scary at first, but especially with Python these usually describe very well what's going wrong. Reading error messages carefully is also an essential skill.
Sorry for the late reply. I did try reading it through but it made no sense to me, to me it looks like it found a file but the wrong one and then something on a line if that file caused it to stop working.