biopython v1.71.0 Bio.AlignIO.Interfaces.AlignmentIterator

Base class for building MultipleSeqAlignment iterators.

You should write a next() method to return Aligment objects. You may wish to redefine the init method as well.

Link to this section Summary

Functions

Create an AlignmentIterator object

Iterate over the entries as MultipleSeqAlignment objects

Return the next alignment in the file

Python 2 style alias for Python 3 style next method

Link to this section Functions

Create an AlignmentIterator object.

Arguments:

  • handle - input file
  • count - optional, expected number of records per alignment Recommend for fasta file format.
  • alphabet - optional, e.g. Bio.Alphabet.generic_protein

Note when subclassing:

  • there should be a single non-optional argument, the handle, and optional count and alphabet IN THAT ORDER.
  • you do not have to require an alphabet (?).
  • you can add additional optional arguments.

Iterate over the entries as MultipleSeqAlignment objects.

Example usage for (concatenated) PHYLIP files::

with open("many.phy","r") as myFile:
    for alignment in PhylipIterator(myFile):
        print "New alignment:"
        for record in alignment:
            print record.id
            print record.seq

Return the next alignment in the file.

This method should be replaced by any derived class to do something useful.

Python 2 style alias for Python 3 style next method.