[Biopython] sort fasta file

xyz mitlox at op.pl
Wed Mar 17 10:08:24 UTC 2010


Hello,
I would like sort multiple fasta file depends on the sequence length,
 ie. from the read with longest sequence to the read with the shortest
sequence.

I have tried to do it but I do not how to sort the records depends on
the sequence length.

from Bio import SeqIO

handle = open("example.fasta", "rU")
records = list(SeqIO.parse(handle, "fasta"))
records.sort(reverse=True)

Thank you in advance.

Best regards,



More information about the Biopython mailing list