[Biopython-dev] [Biopython (old issues only) - Feature #3326] (Closed) MultipleSeqAlignment should support iterators, not only slice objects
redmine at redmine.open-bio.org
redmine at redmine.open-bio.org
Wed Aug 3 16:31:53 UTC 2016
Issue #3326 has been updated by Peter Cock.
Status changed from New to Closed
% Done changed from 0 to 100
As part of retiring the old RedMine issue tracker, I'm closing this but would welcome a pull request on GitHub if you think it would be useful.
https://github.com/biopython/biopython/
Thanks.
----------------------------------------
Feature #3326: MultipleSeqAlignment should support iterators, not only slice objects
https://redmine.open-bio.org/issues/3326#change-15325
* Author: Fabio Zanini
* Status: Closed
* 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython-dev/attachments/20160803/383137a6/attachment-0001.html>
More information about the Biopython-dev
mailing list