Skip to content

mummer_alignment() ​

Align neighbouring clusters with MUMmer, for links between them.

Each cluster is a file in path named after it: <cluster>.fasta, or a GenBank file (.gbk, .gb) that is written to FASTA first. Clusters are aligned in order, each with the next. Needs MUMmer (nucmer or promer, delta-filter and show-coords) in the PATH.

The files are copied into a new folder in output_dir, where MUMmer writes its files; with remove_files the folder is removed after. Files already in path or output_dir are never changed.

Usage ​

python
from geneviewer import mummer_alignment

mummer_alignment(
    path,
    cluster=None,
    maptype='many-to-many',
    seqtype='protein',
    mummer_options='',
    filter_options='',
    remove_files=True,
    output_dir=tempfile.gettempdir(),
)

Arguments ​

ArgumentTypeDescription
pathpathThe folder of sequence files. Its path may have spaces; the names of the files may not.
clusterlist of str, optionalThe clusters, in order. Default: every file, by name.
maptypestr"many-to-many" (default) or "one-to-one".
seqtypestr"protein" (default, promer) or "nucleotide" (nucmer).
mummer_optionsstrMore options for nucmer/promer.
filter_optionsstrMore options for delta-filter.
remove_filesboolWhether to remove MUMmer's files afterwards. Default True.
output_dirpathWhere the working folder goes, without spaces in its path (MUMmer cannot use it otherwise). Default: the temporary folder.

Value ​

pandas.DataFrame or None: One row per alignment: start1, end1, start2, end2, length1, length2, identity (and for protein similarity, stop, frame1, frame2), tag1, tag2, cluster1 and cluster2. A pair without alignments gives no rows; when no pair has any, the table is empty, without the cluster columns (as R). A pair that fails gives a warning and no rows; None when every pair fails.