[Biopython-dev] [Bug 2551] New: Adding advanced __getitem__ to generic alignment, e.g. align[1:2, 5:-5]

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Jul 28 09:37:27 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2551

           Summary: Adding advanced __getitem__ to  generic alignment, e.g.
                    align[1:2,5:-5]
           Product: Biopython
           Version: Not Applicable
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: biopython-bugzilla at maubp.freeserve.co.uk
 BugsThisDependsOn: 2507


I'm filing this as a separate sub-issue from Bug 1944.  The idea is to enhance
the minimal __getitem__ method now in CVS to allow accessing of rows
(sequences), columns, or sub-alignments.

A possible __getitem__ doc string:

        Depending on the indices, you can get a SeqRecord object
        (representing a single row), a Seq object (for a single columns),
        a string (for a single characters) or another alignment
        (representing some part or all of the alignment).

        align[r,c] gives a single character as a string
        align[r] gives a row as a SeqRecord
        align[r,:] gives a row as a SeqRecord
        align[:,c] gives a column as a Seq (using the alignment's alphabet)

        align[:] and align[:,:] give a copy of the alignment

        Anything else gives a sub alignment, e.g.
        align[0:2] or align[0:2,:] uses only row 0 and 1
        align[:,1:3] uses only columns 1 and 2
        align[0:2,1:3] uses only rows 0 & 1 and only cols 1 & 2

Doing this nicely will build on adding annotation aware slicing support to the
SeqRecord, which is Bug 2507.

There is some __getitem__ code on Bug 1944 Attachment 732 and Bug 1944
Attachment 770.


-- 
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