Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

ModDotPlot

> 编程语言
Open source

--- - [](#) - Cite - About - Installation - Usage - Static Mode - Interactive Mode - Standard arguments - Static Mode Commands - Input/Outp…

196 stars0 likes1 views
WebsiteGitHub

About

--- - [](#) - Cite - About - Installation - Usage - Static Mode - Interactive Mode - Standard arguments - Static Mode Commands - Input/Outp…


  • Cite
  • About
  • Installation
  • Usage
    • Static Mode
    • Interactive Mode
    • Standard arguments
    • Static Mode Commands
      • Input/Output & Formatting Commands
      • Plot Customization Commands
    • Sample run - Static Plots
      • Using a config file
      • Adding custom bed file annotations
      • Comparing two sequences
    • Interactive Mode Commands
    • Sample run - Interactive Mode
    • Sample run - Port Forwarding
  • Questions
  • Known Issues

Cite

Alexander P Sweeten, Michael C Schatz, Adam M Phillippy, ModDotPlot—rapid and interactive visualization of tandem repeats, Bioinformatics, Volume 40, Issue 8, August 2024, btae493, https://doi.org/10.1093/bioinformatics/btae493

If you use ModDotPlot for your research, please cite our software!


About

ModDotPlot is a dot plot visualization tool designed to be used at scale, both for smaller sequences and whole genomes. ModDotPlot is the spiritual successor to StainedGlass. The core algorithm breaks an input sequence down into intervals of sketched k-mers called modimizers. This enables the rapid approximation of the Average Nucleotide Identity between combinations of intervals!

If you're interested in learning more about ModDotPlot and how to visualize tandem repeats, we have an in-depth YouTube video tutorial hosted by the BioDiversity Genomics Academy.


Installation

ModDotPlot can be installed by running pip install moddotplot. It requires Python 3.7+ to run. Alternatively, you can download the current release from GitHub by using:

bash
git clone https://github.com/marbl/ModDotPlot.git
cd ModDotPlot

Although optional, it's recommended to setup a virtual environment before using ModDotPlot:

python -m venv venv
source venv/bin/activate

Once activated, you can install the required dependencies:

python -m pip install .

Finally, confirm that the installation was installed correctly and that your version is up to date by running moddotplot -h:

…

Note that running moddotplot -h might take a while at first! This is because the Python interpreter is compiling source code into the pycache directory. Subsequent runs will use the pre-compiled code and load much faster!


Usage

ModDotPlot must be run either in static mode, or interactive mode:

Static Mode

moddotplot static 

Running ModDotPlot in static mode quickly create plots under the specified output directory -o. By default, running ModDotPlot in static mode this will produce the following files:

  • A paired-end bed file .bedpe, containing intervals alongside their corresponding identity estimates.
  • A self-identity dotplot for each sequence, as both an upper triangle matrix _TRI and full matrix _FULL representation.
  • A histogram of identity values for each sequence.

All plots and histograms are output in a vectorized (default: .svg) and rasterized .png image. Plotnine is the Python plotting library used, with CairoSVG used for converting between image formats.

ModDotPlot supports highly customizable plotting features in static mode. See static mode commands for a complete list of features.

Interactive Mode

moddotplot interactive 

Running ModDotPlot in interactive mode will launch a Dash application on your machine's localhost. Open any web browser and go to http://127.0.0.1: to view the interactive plot (this should happen automatically, but depending on your environment you might need to copy and paste this URL into your web browser). Running Ctrl+C on the command line will exit the Dash application. The default port number used by Dash is 8050, but this can be customized using the --port command (see interactive mode commands for further info, and Sample run - Port Forwarding for tips on running interactive mode on an HPC environment).


Standard arguments

The following arguments are the same in both interactive and static mode:

-f / --fasta

Fasta files to input. Multifasta files are accepted. Interactive mode will only support a maximum of two sequences at a time.

-b / --bed

Input bedfile used for dotplot annotation (note: this is not the same as the paired-end bed file produced by ModDotPlot). If selected, this will produce an annotated bedtrack image _ANNOTATION_TRACK.svg in static mode, and open an IGV js track in the interactive mode Dash application. The name in the bedfile must match the name of the fasta sequence header in order to produce a correct bed track.

-k / --kmer

K-mer size to use. This should be large enough to distinguish unique k-mers with enough specificity, but not too large that sensitivity is removed. Default: 21.

-o / --output-dir

Name of output directory for bed file & plots. Default is current working directory.

-id / --identity

Minimum sequence identity cutoff threshold. Default is 86. While it is possible to go as low as 50% sequence identity, anything below 80% is not recommended.

--delta

Each partition takes into account a fraction of its neighboring partitions k-mers. This is to avoid sub-optimal identity scores when partitons don't overlap identically. Default is 0.5, and the accepted range is between 0 and 1. Anything greater than 0.5 is not recommended.

-m / --modimizer

Modimizer sketch size. Must be lower than window size w. A lower sketch size means less k-mers to compare (and faster runtime), at the expense of lower accuracy. Recommended to be kept >= 1000.

--forward

Use forward k-mers only, instead of the default of canonical k-mers. Warning: this will give strand specific output.

-r / --resolution

Dotplot resolution. This corresponds to the number of windows each input sequence is partitioned into. Default is 1000. Overrides the --window parameter.

--compare

If set when 2 or more sequences are input into ModDotPlot, this will show an A vs. B style plot, in addition to a self-identity plot. Note that interactive mode currently only supports a maximum of two sequences. If more than two sequences are input, only the first two will be shown.

--compare-only

If set when 2 or more sequences are input into ModDotPlot, this will show an A vs. B style plot, without showing self-identity plots.

--ambiguous

By default, k-mers that are homopolymers of ambiguous IUPAC codes (eg. NNNNNNNNNNN’s) are excluded from identity estimation. This results in gaps along the central diagonal for these regions. If desired, these can be kept by setting the —-ambiguous flag in both interactive and static mode.


Static Mode Commands

Input/Output & Formatting Commands

-l / --load

Create a plot from a previously computed pairwise bed file. Skips Average Nucleotide Identity computation. Used instead of -f/--fasta. Will only accept paired-end bed files produced by ModDotPlot.

-c / --config

Run moddotplot static with a config file instead of command line args. Example syntax in config/config.json. Recommended when creating a really customized plot. Used instead of -f/--fasta.

--cooler

If set, will output a matrix as a cooler file for each input sequence, in addition to a bedpe file.

--no-bedpe

Skip output of bed file.

--no-hist

Skip output of histogram legend.

--no-plot

Save .bedpe to file, but skip rendering of plots.

--width

Adjust width of self dot plots. Default is 9 inches.

--dpi

Image resolution in dots per inch (not to be confused with dotplot resolution). Default is 300.

--vector

Vectorized image format to output to. Must be one of ["svg", "pdf", "ps"]. Default: svg

--deraster

By default, vectorized outputs rasterize the actual dotplot (not the axis). This is done to save space, as a high-resolution dotplot can be extremely space inefficient and prevent use of image manipulation software. This plot rasterization can be removed using this flag.

Plot Customization Commands

-w / --window

Window size. Unlike interactive mode, only one matrix will be created, so this represents the only window size. Default is set to n/1000 (eg. 3000bp for a 3Mbp sequence).

--region

Plot only a particular range for a given sequence. Syntax is UCSC style (chr:start-end).

--palette

List of accepted palettes can be found here. Palettes are segregated into 3 types: Diverging, Qualitative, and Sequential. Syntax is the name of the palette, followed by an underscore and the number of colors, eg. OrRd_8. Default is Spectral_11.

--breakpoints

Add custom identity threshold breakpoints. Note that the number of breakpoints must be equal to the number of colors + 1, otherwise an error will occur.

--palette-orientation

Flip sequential order of color palette. Set to - by default for divergent palettes.

--color

List of custom colors in hexcode format can be entered sequentially, mapped from low to high identity.

-t / --axes-ticks

Custom tickmarks for x and y axis. Values outside of the --axes-limits will not be shown.

-a / --axes-limits

Change axis limits for x and y axis. Useful when comparing multiple plots, allowing them to stay in scale.

--bin-freq

By default, histograms are evenly spaced based on the number of colors and the identity threshold. Select this argument to bin based on the frequency of observed identity values.

Sample run - Static Plots

Using a config file

When running ModDotPlot to produce static plots, it is recommended to use a config file. The config file is provided in JSON, and accepts the same syntax as the command line arguments shown above. Here is an sample run using a centromeric sequence of Arabadopsis thaliana:

$ cat config/config.json

{
    "identity": 90,
    "palette": "Blues_7",
    "breakpoints": [
        90,
        91,
        92,
        93,
        96,
        98,
        99,
        100
    ],
    "output_dir": "Arabadopsis",
    "fasta": [
        "sequences/Arabadopsis_chr1_centromere.fa"
    ]
}
…

Using samtools faidx will result in a genomic range being added to a fasta file's header (eg. in the above sequence, the header is Chr1:14000001-18000000). ModDotPlot will parse this syntax to add the appropriate axis.

Adding custom bed file annotations

If providing a custom annotation file using --bed/b, ModDotPlot will output additional files:

  • An annotation track _ANNOTATION_TRACK, containing . Colors for ranges are set using the 9th column of the bedfile.
  • The annotation track overlayed with a self-identity dotplot _ANNOTATED for each sequence present in the annotation track.
…

Comparing two sequences

ModDotPlot can produce an a vs. b style dotplot for each pairwise combination of input sequences. Use the --compare command line argument to include these plots. When running --compare in interactive mode, a dropdown menu will appear, allowing the user to switch between self-identity and pairwise plots. Note that a maximum of two sequences are allowed in interactive mode. If you want to skip t

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言