Bio.Align.nexus module
Bio.Align support for the “nexus” file format.
You are expected to use this module via the Bio.Align functions.
See also the Bio.Nexus module (which this code calls internally), as this offers more than just accessing the alignment or its sequences as SeqRecord objects.
- class Bio.Align.nexus.AlignmentWriter(target, interleave=None)
Bases:
Bio.Align.interfaces.AlignmentWriter
Nexus alignment writer.
Note that Nexus files are only expected to hold ONE alignment matrix.
You are expected to call this class via Bio.Align.write().
- fmt = 'Nexus'
- __init__(target, interleave=None)
Create an AlignmentWriter object.
- Arguments:
target - output stream or file name
- interleave - if None (default): interleave if columns > 1000
if True: use interleaved format if False: do not use interleaved format
- write_file(alignments)
Write a file with the alignments, and return the number of alignments.
alignments - A list or iterator returning Alignment objects
- format_alignment(alignment, interleave=None)
Return a string with a single alignment in the Nexus format.
Creates an empty Nexus object, adds the sequences and then gets Nexus to prepare the output.
alignment - An Alignment object
- interleave - if None (default): interleave if columns > 1000
if True: use interleaved format if False: do not use interleaved format
- write_alignment(alignment, stream, interleave=None)
Write a single alignment to the output file.
alignment - An Alignment object
stream - output stream
- interleave - if None (default): interleave if columns > 1000
if True: use interleaved format if False: do not use interleaved format
- write_alignments(alignments)
Write alignments to the output file, and return the number of alignments.
alignments - A list or iterator returning Alignment objects
- __abstractmethods__ = frozenset({})
- class Bio.Align.nexus.AlignmentIterator(source)
Bases:
Bio.Align.interfaces.AlignmentIterator
Nexus alignment iterator.
- fmt = 'Nexus'
- __abstractmethods__ = frozenset({})