[Biopython-dev] Should MultipleSequenceAlignment support iterator slicing?

Fabio Zanini fabio.zanini at fastmail.fm
Tue Feb 21 21:44:40 UTC 2012


Hi all!

I am using the MultipleSequenceAlignment class a lot these days, and
would find it useful to get subalignments using python iterators. I
started a discussion on the issue tracker:

https://redmine.open-bio.org/issues/3326

Short version: I would like to do things like

alignment[[4,5,8]]

to get a subalignment with the 5th, 6th, and 9th rows. This syntax is
not working at present, but can be implemented, for single as well as
double indices, in a very simple way. For instance, for the single index
case,

if hasattr(index, '__iter__'):
    return MultipleSeqAlignment((self._records[i] for i in index),
                                                         self._alphabet)

Questions? Doubts?

Cheers,
Fabio



More information about the Biopython-dev mailing list