[Biopython-dev] Bio.AlignIO (was Re: [BioPython] Bio.SeqIO and files with one record)

Michiel de Hoon mdehoon at c2b2.columbia.edu
Sun Jul 22 10:28:22 UTC 2007


Peter wrote:
> P.S. Any comments on the Bio.AlignIO ideas I raised back in May 2007?
> http://lists.open-bio.org/pipermail/biopython/2007-May/003472.html
> 
Let's discuss the Bio.Align.Alignment class first, and then decide how 
to parse alignment files.

Currently, the alignment class holds a list of SeqRecord objects:


class Alignment:
     ...
     def __init__(self, alphabet):
         ...
         # hold everything at a list of seq record objects
         self._records = []

To get access to self_record, the Alignment class has some accessor 
functions:

     def get_all_seqs(self):
         ...
         return self._records


     def get_seq_by_num(self, number):
         ...
         return self._records[number].seq

A cleaner way to do this is to let the class Alignment inherit from 
list. This also allows us to use all list methods on Alignment objects. 
For example, we can iterate over them, as suggested in this bug report:

http://bugzilla.open-bio.org/show_bug.cgi?id=1944

Any objections against letting Alignment inherit from list?


--Michiel



More information about the Biopython-dev mailing list