[Biopython] fasta fail

Liam Thompson dejmail at gmail.com
Wed Dec 1 15:57:39 UTC 2010


Hi Peter

Apologies, it seems each of the records in the list is a SeqRecord.

>>> type(final_seq[0])
<class 'Bio.SeqRecord.SeqRecord'>

>>> type(final_seq)
<type 'list'>

SeqIO seems to process the sequence fine, it just can't seem to write it.

thanks
Liam



On 1 December 2010 17:44, Peter <biopython at maubp.freeserve.co.uk> wrote:

> On Wed, Dec 1, 2010 at 3:13 PM, Liam Thompson <dejmail at gmail.com> wrote:
> > 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")
> > ...
> > 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 ?
>
> What is your final_seq object?
>
> You should have a list of SeqRecord objects (or in recent versions
> of Biopython you can also give SeqIO.write a single SeqRecord).
> Each SeqRecord's seq property should be a Seq object (or similar).
>
> Peter
>



More information about the Biopython mailing list