[Biopython-dev] [Bug 2507] Adding __getitem__ to SeqRecord for element access and slicing

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Jun 11 13:57:56 UTC 2008


biopython-bugzilla at maubp.freeserve.co.uk changed:

           What    |Removed                     |Added
 Attachment #928 is|0                           |1
           obsolete|                            |

------- Comment #8 from biopython-bugzilla at maubp.freeserve.co.uk  2008-06-11 09:57 EST -------
Created an attachment (id=937)
 --> (http://bugzilla.open-bio.org/attachment.cgi?id=937&action=view)
Patch to Bio/SeqRecord.py and Bio/SeqFeature.py

This modifies the SeqRecord to give it __getitem__ (supporting sliced
annotations including features), __len__ (to return the length of the
sequence). __nonzero__ (to ensure any SeqRecord evaluates as True regardless of
the length of its sequence) and __iter__ (to explicitly support iteration over
the sequence with a docstring).  As part of this, assorted objects in
SeqFeature.py get a private _shift() method taking an integer offset to return
a self copy with an adjusted location.

Note that slices with a stride (other than one) will result in the features
being lost.  Handling (positive) strides would require complicated
consideration about if an exact location is still present, and if not replacing
it with either a fuzzy position or a range.  Negative strides are worse!

The current set of unit tests seem fine, but addition checks would need to be
added to validate this new behaviour.

Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the Biopython-dev mailing list