[Biopython] fasta fail

Liam Thompson dejmail at gmail.com
Wed Dec 1 15:13:02 UTC 2010


hi everyone

I have a list of sequences that I want to write to file in fasta format.
This is easy enough, however I keep getting an error which I can't fix.

SeqIO.write(final_seq, out_handle, "fasta")
  File "/usr/lib/pymodules/python2.6/Bio/SeqIO/__init__.py", line 398, in
write
    count = writer_class(handle).write_file(sequences)
  File "/usr/lib/pymodules/python2.6/Bio/SeqIO/Interfaces.py", line 271, in
write_file
    count = self.write_records(records)
  File "/usr/lib/pymodules/python2.6/Bio/SeqIO/Interfaces.py", line 256, in
write_records
    self.write_record(record)
  File "/usr/lib/pymodules/python2.6/Bio/SeqIO/FastaIO.py", line 136, in
write_record
    data = self._get_seq_string(record) #Catches sequence being None
  File "/usr/lib/pymodules/python2.6/Bio/SeqIO/Interfaces.py", line 164, in
_get_seq_string
    % record.id)
TypeError: SeqRecord (id=FN545840.1) has an invalid sequence.


There is nothing wrong with the record, as far as I can see as I have
written to and extraced from it numerous times as a fasta entry There is
definitely sequence and other basic information on the record, which I can
see from a simple print(final_seq[x].seq) The list of sequences is a "list"
as opposed to a "SeqRecord", so I thought this could be problem ? Is there a
way to convert a list to a SeqRecord or is this not necessary ?


thanks
Liam





-----------------------------------------------------------
Antiviral Gene Therapy Research Unit
University of the Witwatersrand
Faculty of Health Sciences, Room 7Q07
7 York Road, Parktown
2193
http://web.wits.ac.za/Academic/Health/Pathology/AGTRU/


Tel: 2711 717 2465/7
Fax: 2711 717 2395
Skype: liam_thompson
Email: liam.thompson at students.wits.ac.za / dejmail at gmail.com



More information about the Biopython mailing list