[Biopython-dev] [Bug 2554] New: Creating an Alignment from a list of SeqRecord objects

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Jul 28 10:13:38 UTC 2008


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

           Summary: Creating an Alignment from a list of SeqRecord objects
           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: 2553


It would be nice to be able to supply a list (or iterator) of SeqRecord objects
when creating an alignment object.  This would also make the
Bio.SeqIO.to_alignment() function obsolete.

Currently, the __init__ method takes just an alphabet:

    def __init__(self, alphabet):
        """Initialize a new Alignment object.

        Arguments:
        o alphabet - The alphabet to use for the sequence objects that are
        created. This alphabet must be a gapped type.
        """
        #...

My plan is to accept a list of SeqRecord objects (possibly empty) and an
optional alphabet.  If the alphabet is omitted, a consensus can be determined
from the SeqRecord alphabets.

This can be made backwards compatible:

    def __init__(self, records, alphabet=None):
        """Initialize a new Alignment object.

        Arguments:
        records - A list (or iterator) of SeqRecord objects, whose sequences
                  are all the same length.  This an be an empy list.
        alphabet - The alphabet for the whole alignment, typically a gapped
                  alphabet, which should be a superset of the individual
                  record alphabets.  If ommited, a consensus alphabet is used.
        """
        if not (isinstance(records, Alphabet.Alphabet) \
        or isinstance(records, Alphabet.AlphabetEncoder)):
            if alphabet is None :
                #Backwards compatible mode!
                alphabet = records
                records = []
            else :
                raise ValueError("Invalid records argument")
        #...


I would expect the implementation to depend on Bug 2553 - Adding SeqRecord
objects to an alignment (append or extend).


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