[Biopython-dev] Bio.AlignIO (was Re: [BioPython] Bio.SeqIO and files with one record)
Michiel de Hoon
mdehoon at c2b2.columbia.edu
Wed Jul 25 13:17:33 UTC 2007
Sure, that is possible, but that means we'd be adding methods to
Alignment in order for it to behave like a list, whereas we can get
that for free by letting the Alignment class inherit from list.
--Michiel.
Howard Salis wrote:
> Hello all,
>
>
> To get this same behavior, you can also create the __iter__ and next()
> methods in Alignment itself.
>
> -Howard Salis
>
> On 7/22/07, Michiel de Hoon <mdehoon at c2b2.columbia.edu> wrote:
>> 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
>> _______________________________________________
>> Biopython-dev mailing list
>> Biopython-dev at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biopython-dev
>>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev
More information about the Biopython-dev
mailing list