[Biopython (old issues only) - Feature #3326] (Closed) MultipleSeqAlignment should support iterators, not only slice objects

[email protected] Wed, 03 Aug 2016 16:31:53 +0000
Newsgroups gmane.comp.python.bio.devel
Message-ID <redmine.journal-15325.20160803163153.d4422d714450d57e@redmine.open-bio.org>
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

_______________________________________________
Biopython-dev mailing list
[email protected]
http://mailman.open-bio.org/mailman/listinfo/biopython-dev