[Biopython-dev] [Biopython - Feature #3326] (New) MultipleSeqAlignment should support iterators, not only slice objects

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Sun Feb 12 15:37:26 UTC 2012


Issue #3326 has been reported by Fabio Zanini.

----------------------------------------
Feature #3326: MultipleSeqAlignment should support iterators, not only slice objects
https://redmine.open-bio.org/issues/3326

Author: Fabio Zanini
Status: New
Priority: Normal
Assignee: Biopython Dev Mailing List
Category: Main Distribution
Target version: 
URL: 


Currently, the MultipleSeqAlignment object supports slicing via various syntaxes, e.g.:

- alignment[4,6]
- alignment[2:4,3:6]
- alignment[3:4:5]

In the latter case, the indices build a so-called slice, a pure Python object, and MultipleSeqAlignment has an explicit if clause for dealing with this case.

However, the user might want to iterate over the MSA using the more general *iterators*, e.g. from itertools, rather than simple slice objects. An extension that includes iterators looks easy:

# Check whether the index is an iterator
if (hasattr(index, 'next')) and (hasattr(index:, '__iter__')):
    return MultipleSeqAlignment([self._records[i] for i in index], self._alphabet)

Would you think this is useful?




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org




More information about the Biopython-dev mailing list