pyani.nucmer module

Code for handling NUCmer output files.

class pyani.nucmer.DeltaAlignment(refstart: int, refend: int, qrystart: int, qryend: int, errs: int, simerrs: int, stops: int)[source]

Bases: object

Represents a single alignment region and scores for a pairwise comparison.

class pyani.nucmer.DeltaComparison(header: pyani.nucmer.DeltaHeader, alignments: List[pyani.nucmer.DeltaAlignment])[source]

Bases: object

Represents a comparison between two sequences in a .delta file.

add_alignment(aln: pyani.nucmer.DeltaAlignment) → None[source]

Add passed alignment to this object.

Parameters:aln – DeltaAlignment object
class pyani.nucmer.DeltaData(name: str, handle: TextIO = None)[source]

Bases: object

Class to hold MUMmer/nucmer output “delta” data.

This is required because the ordering within files differs depending on MUMmer build, for the same version (as evidenced by differences between OSX and Linux builds), and a means of testing for equality of outputs is necessary.

The output file structure and format is described at http://mummer.sourceforge.net/manual/#nucmeroutput

Each file is represented as:

  • header: first line of the .delta file, naming the two input comparison files; stored
    as a tuple (path1, path2), returned as the combined string; the individual files are stored as self._query and self._subject
  • program: name of the MUMmer program that produced the output
  • query: path to the query sequence file
  • subject: path to the subject sequence file
comparisons

Comparisons in the .delta file.

from_delta(handle: TextIO) → None[source]

Populate the object from the passed .delta or .filter filehandle.

metadata

Metadata from the .delta file.

program

The MUMmer program used for the comparison.

query

Query file for the MUMmer comparison.

reference

Reference file for the MUMmer comparison.

class pyani.nucmer.DeltaHeader(reference: pathlib.Path, query: pathlib.Path, reflen: int, querylen: int)[source]

Bases: object

Represents a single sequence comparison header from a MUMmer .delta file.

class pyani.nucmer.DeltaIterator(handle: TextIO)[source]

Bases: object

Iterator for MUMmer .delta files.

Returns a stream of DeltaMetadata, DeltaComparison and DeltaAlignment objects when iterated over a filehandle

The .delta file structure and format is described at http://mummer.sourceforge.net/manual/#nucmeroutput

class pyani.nucmer.DeltaMetadata[source]

Bases: object

Represents the metadata header for a MUMmer .delta file.