Hello,
I am trying to follow the Biopython tutorial and cookbook and store sequences in memory for processing. I downloaded the fasta files recommend in the Biopython workshop.
I ran the following code and it worked. It printed all of the sequence names from the FASTA:
handle = open("NC_000913.faa", "rU")
for record in SeqIO.parse(handle, "fasta"):
print record.id
handle.close()
But when I run the following code from section 5.1.3 "Getting a list of records in a sequence file" in the tutorial it doesn't seem to work:
record= list(SeqIO.parse(handle,"fasta"))
The list record is empty and has no entries. My understanding is that it should store the SeqRecords in a list. I tried to print(record)
it printed []
indicating an empty list and print(record[0].id)
which returned an index of out range error.
Does anyone have a suggestion as to what I might be doing wrong?
Thank you for your help!
Or just use a filename and let
SeqIO
open a new handle for you itself: