ModDotPlot 0.9.8__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moddotplot-1.0.0/LICENSE.ntHash +21 -0
- moddotplot-1.0.0/PKG-INFO +530 -0
- moddotplot-1.0.0/README.md +474 -0
- moddotplot-1.0.0/THIRD_PARTY_LICENSES.md +33 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/pyproject.toml +22 -16
- moddotplot-1.0.0/setup.cfg +13 -0
- moddotplot-1.0.0/setup.py +23 -0
- moddotplot-1.0.0/src/ModDotPlot.egg-info/PKG-INFO +530 -0
- moddotplot-1.0.0/src/ModDotPlot.egg-info/SOURCES.txt +52 -0
- moddotplot-1.0.0/src/ModDotPlot.egg-info/requires.txt +23 -0
- moddotplot-1.0.0/src/moddotplot/__main__.py +26 -0
- moddotplot-1.0.0/src/moddotplot/_nthash.cpp +966 -0
- moddotplot-1.0.0/src/moddotplot/annotations.py +113 -0
- moddotplot-1.0.0/src/moddotplot/color_palettes.py +1744 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/moddotplot/const.py +3 -2
- moddotplot-1.0.0/src/moddotplot/estimate_identity.py +1258 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/moddotplot/interactive.py +321 -73
- moddotplot-1.0.0/src/moddotplot/moddotplot.py +3749 -0
- moddotplot-1.0.0/src/moddotplot/native_render.py +504 -0
- moddotplot-1.0.0/src/moddotplot/optional_dependencies.py +19 -0
- moddotplot-1.0.0/src/moddotplot/parse_fasta.py +789 -0
- moddotplot-1.0.0/src/moddotplot/plot_summary.py +113 -0
- moddotplot-1.0.0/src/moddotplot/static_plots.py +1785 -0
- moddotplot-1.0.0/tests/test_algorithms.py +511 -0
- moddotplot-1.0.0/tests/test_annotation_track.py +420 -0
- moddotplot-1.0.0/tests/test_cli_integration.py +540 -0
- moddotplot-1.0.0/tests/test_cli_runtime.py +817 -0
- moddotplot-1.0.0/tests/test_direction_cli.py +236 -0
- moddotplot-1.0.0/tests/test_direction_plot.py +61 -0
- moddotplot-1.0.0/tests/test_entrypoints.py +115 -0
- moddotplot-1.0.0/tests/test_fasta_parser.py +480 -0
- moddotplot-1.0.0/tests/test_grid.py +699 -0
- moddotplot-1.0.0/tests/test_interactive_annotations.py +192 -0
- moddotplot-1.0.0/tests/test_interactive_export.py +35 -0
- moddotplot-1.0.0/tests/test_interactive_parser.py +36 -0
- moddotplot-1.0.0/tests/test_issue53_memory_safe_plotting.py +102 -0
- moddotplot-1.0.0/tests/test_modimizer_vectorization.py +129 -0
- moddotplot-1.0.0/tests/test_native_full_plot.py +269 -0
- moddotplot-1.0.0/tests/test_native_render.py +204 -0
- moddotplot-1.0.0/tests/test_native_sequence_sketches.py +151 -0
- moddotplot-1.0.0/tests/test_nthash.py +282 -0
- moddotplot-1.0.0/tests/test_optional_dependencies.py +121 -0
- moddotplot-1.0.0/tests/test_packaging_metadata.py +223 -0
- moddotplot-1.0.0/tests/test_plot_fonts.py +82 -0
- moddotplot-1.0.0/tests/test_plot_summary.py +61 -0
- moddotplot-1.0.0/tests/test_sketch_cache.py +170 -0
- moddotplot-1.0.0/tests/test_sparse_containment.py +253 -0
- moddotplot-1.0.0/tests/test_static_customization.py +308 -0
- moddotplot-0.9.8/PKG-INFO +0 -523
- moddotplot-0.9.8/README.md +0 -471
- moddotplot-0.9.8/setup.cfg +0 -4
- moddotplot-0.9.8/src/ModDotPlot.egg-info/PKG-INFO +0 -523
- moddotplot-0.9.8/src/ModDotPlot.egg-info/SOURCES.txt +0 -17
- moddotplot-0.9.8/src/ModDotPlot.egg-info/requires.txt +0 -19
- moddotplot-0.9.8/src/moddotplot/__main__.py +0 -11
- moddotplot-0.9.8/src/moddotplot/estimate_identity.py +0 -582
- moddotplot-0.9.8/src/moddotplot/moddotplot.py +0 -1465
- moddotplot-0.9.8/src/moddotplot/parse_fasta.py +0 -186
- moddotplot-0.9.8/src/moddotplot/static_plots.py +0 -2059
- {moddotplot-0.9.8 → moddotplot-1.0.0}/LICENSE +0 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/ModDotPlot.egg-info/dependency_links.txt +0 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/ModDotPlot.egg-info/entry_points.txt +0 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/ModDotPlot.egg-info/top_level.txt +0 -0
- {moddotplot-0.9.8 → moddotplot-1.0.0}/src/moddotplot/__init__.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Hamid Mohamadi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ModDotPlot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Author: Michael Schatz, Adam Phillippy
|
|
5
|
+
Author-email: Alex Sweeten <alex.sweeten@nih.gov>
|
|
6
|
+
Maintainer-email: Alex Sweeten <alex.sweeten@nih.gov>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2024 MarBL
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Keywords: dotplot,sketching,modimizer,heatmap
|
|
30
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
36
|
+
Requires-Python: <3.15,>=3.10
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
License-File: LICENSE.ntHash
|
|
40
|
+
License-File: THIRD_PARTY_LICENSES.md
|
|
41
|
+
Requires-Dist: pandas
|
|
42
|
+
Requires-Dist: matplotlib>=3.10.9; python_version < "3.11"
|
|
43
|
+
Requires-Dist: matplotlib>=3.11.2; python_version >= "3.11"
|
|
44
|
+
Requires-Dist: numpy
|
|
45
|
+
Requires-Dist: scipy
|
|
46
|
+
Provides-Extra: interactive
|
|
47
|
+
Requires-Dist: dash>=2.9; extra == "interactive"
|
|
48
|
+
Requires-Dist: plotly; extra == "interactive"
|
|
49
|
+
Provides-Extra: cooler
|
|
50
|
+
Requires-Dist: cooler; extra == "cooler"
|
|
51
|
+
Provides-Extra: test
|
|
52
|
+
Requires-Dist: pytest; extra == "test"
|
|
53
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
54
|
+
Requires-Dist: tomli>=1.1; python_version < "3.11" and extra == "test"
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
[](https://pypi.org/project/ModDotPlot/)
|
|
61
|
+
[](https://github.com/marbl/ModDotPlot/actions/workflows/ci.yml)
|
|
62
|
+
|
|
63
|
+
- [Cite](#cite)
|
|
64
|
+
- [About](#about)
|
|
65
|
+
- [Installation](#installation)
|
|
66
|
+
- [Dependencies](#dependencies)
|
|
67
|
+
- [Usage](#usage)
|
|
68
|
+
- [Command Line Arguments](#command-line-arguments)
|
|
69
|
+
- [General Options](#general-options)
|
|
70
|
+
- [Input Options](#input-options)
|
|
71
|
+
- [Analysis Options](#analysis-options)
|
|
72
|
+
- [Output Options](#output-options)
|
|
73
|
+
- [Plot Formatting Options](#plot-formatting-options)
|
|
74
|
+
- [Plot Customization Options](#plot-customization-options)
|
|
75
|
+
- [Sample run - Static Plots](#sample-run---static-plots)
|
|
76
|
+
- [Using a config file](#using-a-config-file)
|
|
77
|
+
- [Adding custom bed file annotations](#adding-custom-bed-file-annotations)
|
|
78
|
+
- [Comparing two sequences](#comparing-two-sequences)
|
|
79
|
+
- [Interactive Mode Commands](#interactive-mode-commands)
|
|
80
|
+
- [Sample run - Interactive Mode](#sample-run---interactive-mode)
|
|
81
|
+
- [Sample run - Port Forwarding](#sample-run---port-forwarding)
|
|
82
|
+
- [Questions](#questions)
|
|
83
|
+
- [Known Issues](#known-issues)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Cite
|
|
87
|
+
|
|
88
|
+
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](https://doi.org/10.1093/bioinformatics/btae493)
|
|
89
|
+
|
|
90
|
+
If you use ModDotPlot for your research, please cite our software!
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## About
|
|
95
|
+
|
|
96
|
+
_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](https://mrvollger.github.io/StainedGlass/). The core algorithm breaks an input sequence down into intervals of sketched *k*-mers called **mod**imizers. This enables the rapid approximation of the Average Nucleotide Identity between combinations of intervals!
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+
If you're interested in learning more about _ModDotPlot_ and how to visualize tandem repeats, we have an in-depth [YouTube video tutorial](https://www.youtube.com/watch?v=_7sQaljB_ys&t=2321s&pp=ygUXYWxleCBzd2VldGVuIG1vZGRvdHBsb3Q%3D) hosted by the [BioDiversity Genomics Academy](https://thebgacademy.org).
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Installation
|
|
105
|
+
|
|
106
|
+
_ModDotPlot_ can be installed by running `pip install moddotplot`. Alternatively, you can download the current release from GitHub by using:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
git clone https://github.com/marbl/ModDotPlot.git
|
|
110
|
+
cd ModDotPlot
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Although optional, it's recommended to set up a virtual environment before using _ModDotPlot_:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
python -m venv venv
|
|
117
|
+
source venv/bin/activate
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Once activated, install either the base package for static plotting:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
python -m pip install .
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If desired, add the deprecated interactive plotting dependencies, Cooler export support, or both only when needed:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
python -m pip install ".[interactive]"
|
|
130
|
+
python -m pip install ".[cooler]"
|
|
131
|
+
python -m pip install ".[interactive,cooler]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Finally, confirm that the installation completed correctly and that your version is up to date by running `moddotplot -h`:
|
|
135
|
+
```
|
|
136
|
+
__ __ _ _____ _ _____ _ _
|
|
137
|
+
| \/ | | | | __ \ | | | __ \| | | |
|
|
138
|
+
| \ / | ___ __| | | | | | ___ | |_ | |__) | | ___ | |_
|
|
139
|
+
| |\/| |/ _ \ / _` | | | | |/ _ \| __| | ___/| |/ _ \| __|
|
|
140
|
+
| | | | (_) | (_| | | |__| | (_) | |_ | | | | (_) | |_
|
|
141
|
+
|_| |_|\___/ \__,_| |_____/ \___/ \__| |_| |_|\___/ \__|
|
|
142
|
+
|
|
143
|
+
v1.0.0
|
|
144
|
+
|
|
145
|
+
usage: moddotplot [-h] [--quiet] [{static,interactive}] ...
|
|
146
|
+
|
|
147
|
+
ModDotPlot: Visualization of Tandem Repeats
|
|
148
|
+
|
|
149
|
+
positional arguments:
|
|
150
|
+
{static,interactive} Choose mode; static is used when omitted
|
|
151
|
+
static Static mode commands (default)
|
|
152
|
+
interactive Interactive mode commands (deprecated; explicit use only)
|
|
153
|
+
|
|
154
|
+
options:
|
|
155
|
+
-h, --help show this help message and exit
|
|
156
|
+
--quiet suppress all console output, including warnings and errors
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
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!
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Dependencies
|
|
164
|
+
|
|
165
|
+
_ModDotPlot_ requires Python 3.10 through 3.14 (`>=3.10,<3.15`). The base
|
|
166
|
+
installation includes everything needed for static plotting. `pip` installs
|
|
167
|
+
these required runtime dependencies automatically:
|
|
168
|
+
|
|
169
|
+
| Dependency | Version requirement | Purpose |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| [NumPy](https://numpy.org/) | No explicit minimum | Numerical arrays and matrix operations. |
|
|
172
|
+
| [pandas](https://pandas.pydata.org/) | No explicit minimum | BEDPE and annotation table handling. |
|
|
173
|
+
| [Matplotlib](https://matplotlib.org/) | `>=3.10.9` on Python 3.10; `>=3.11.2` on Python 3.11–3.14 | Static plot, grid, and histogram rendering. |
|
|
174
|
+
| [SciPy](https://scipy.org/) | No explicit minimum | Numerical and statistical utilities. |
|
|
175
|
+
|
|
176
|
+
Building from source also requires Setuptools 61 or newer. This build
|
|
177
|
+
dependency is installed automatically by modern versions of `pip`.
|
|
178
|
+
|
|
179
|
+
Optional dependencies are grouped by feature and are not needed for standard
|
|
180
|
+
static plots:
|
|
181
|
+
|
|
182
|
+
| Extra | Dependencies | Purpose | Installation |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
| `interactive` | Dash `>=2.9`, Plotly | Deprecated interactive Dash application. | `python -m pip install "ModDotPlot[interactive]"` |
|
|
185
|
+
| `cooler` | Cooler | Cooler matrix export with `--cooler`. | `python -m pip install "ModDotPlot[cooler]"` |
|
|
186
|
+
| `test` | pytest, pytest-cov; tomli `>=1.1` on Python 3.10 | Development and test suite. | `python -m pip install ".[test]"` |
|
|
187
|
+
|
|
188
|
+
From a source checkout, multiple extras can be installed together, for
|
|
189
|
+
example: `python -m pip install ".[interactive,cooler,test]"`.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Usage
|
|
194
|
+
|
|
195
|
+
_ModDotPlot_ runs in static mode by default. The explicit `static` subcommand
|
|
196
|
+
is retained for clarity and compatibility, so these commands are equivalent:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
moddotplot -f sequence.fa <ARGS>
|
|
200
|
+
moddotplot static -f sequence.fa <ARGS>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
A standard run writes a BEDPE identity table, full and triangle dotplots,
|
|
204
|
+
and an identity histogram beneath the selected output directory. Plots and
|
|
205
|
+
histograms are rendered with Matplotlib as both PNG and the selected vector
|
|
206
|
+
format (SVG by default). Every plot directory also receives a
|
|
207
|
+
`plot_summary.txt` reproducibility record containing input paths, plotting
|
|
208
|
+
parameters, and the command used for the run.
|
|
209
|
+
|
|
210
|
+

|
|
211
|
+
|
|
212
|
+
The deprecated interactive application remains available only through the
|
|
213
|
+
explicit `interactive` subcommand. Its commands are documented under
|
|
214
|
+
[Interactive Mode Commands](#interactive-mode-commands).
|
|
215
|
+
|
|
216
|
+
### Command Line Arguments
|
|
217
|
+
|
|
218
|
+
The default/static command accepts every option in the following two sections.
|
|
219
|
+
Options marked **shared** are also accepted by the deprecated interactive
|
|
220
|
+
command; interactive-specific behavior is summarized separately below.
|
|
221
|
+
Flags such as `--grid` and `--no-plot` are switches and do not take a
|
|
222
|
+
`true` or `false` value.
|
|
223
|
+
|
|
224
|
+
#### General Options
|
|
225
|
+
|
|
226
|
+
| Argument | Description |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `-h, --help` | Show help for the root command or selected subcommand and exit. |
|
|
229
|
+
| `--quiet` | Suppress console output, including warnings and errors. The exit status still reports success or failure. May appear before or after the subcommand. |
|
|
230
|
+
|
|
231
|
+
#### Input Options
|
|
232
|
+
|
|
233
|
+
| Argument | Description |
|
|
234
|
+
| --- | --- |
|
|
235
|
+
| `-f, --fasta FILE [FILE ...]` | Read one or more FASTA, gzip-compressed FASTA, or BGZF FASTA files. Static mode analyzes every record unless `--sequence` limits the selection. Mutually exclusive with static `--load`. |
|
|
236
|
+
| `-l, --load BEDPE [BEDPE ...]` | Plot one or more ModDotPlot BEDPE files without recomputing identity. Mutually exclusive with `--fasta`, but may be combined with `--config`; explicit input paths override input paths in the config. Interactive `--load` has different behavior described below. |
|
|
237
|
+
| `-c, --config JSON` | Load command settings from a JSON config. Explicit FASTA, BEDPE, config, and output paths are resolved independently; explicit input/output paths take precedence, while config values supply other settings. |
|
|
238
|
+
| `-s, --sequence ID [ID ...]` | Analyze only named records from FASTA input. IDs match the first whitespace-delimited FASTA token, preferring exact matches and then unambiguous case-insensitive matches. |
|
|
239
|
+
| `--region ID:START-END [ID:START-END ...]` | Analyze 1-based inclusive regions. Region limits propagate to identity computation, BEDPE coordinates, plots, and grid axes. |
|
|
240
|
+
| `--pairs FILE` | Restrict `--compare` or `--compare-only` to pairs in a two-column text file. Blank lines and `#` comments are ignored. Requires indexed FASTA input; duplicate, self, unknown, and ambiguous pairs are errors. |
|
|
241
|
+
| `-b, --bed BED` | Add one BED3–BED9 annotation file. BED chromosome names must match FASTA identifiers after any `:start-end` suffix is removed. Valid `itemRgb` values are retained. Interactive mode accepts multiple BED files. |
|
|
242
|
+
|
|
243
|
+
#### Analysis Options
|
|
244
|
+
|
|
245
|
+
| Argument | Description |
|
|
246
|
+
| --- | --- |
|
|
247
|
+
| `--compare` | Add pairwise comparisons while retaining self-comparisons. Static mode considers all selected pairs unless `--pairs` restricts them. |
|
|
248
|
+
| `--compare-only` | Produce pairwise comparisons without self-comparisons. Mutually exclusive with `--compare`. |
|
|
249
|
+
| `-k, --kmer INT` | Set k-mer length. Default: `21`. |
|
|
250
|
+
| `-m, --modimizer INT` | Set the modimizer sketch target. Must be smaller than the window length. Smaller values are faster but reduce accuracy. Default: `1000`. |
|
|
251
|
+
| `-r, --resolution INT` | Set the approximate number of sequence windows. Mutually exclusive with `--window` in static mode. Default: `1000`. |
|
|
252
|
+
| `-w, --window INT` | Set window length in base pairs. When omitted, it is inferred from sequence length and resolution. Mutually exclusive with `--resolution` in static mode. |
|
|
253
|
+
| `-id, --identity FLOAT` | Set the minimum estimated identity percentage. Default: `86.0`. Values below 80 are generally not recommended. |
|
|
254
|
+
| `-d, --delta FLOAT` | Include this fraction of each neighboring window when estimating identity. Accepted range: 0–1. Default: `0.5`. |
|
|
255
|
+
| `--forward` | Hash forward k-mers only instead of canonical k-mers, producing strand-specific output. |
|
|
256
|
+
| `--ambiguous` | Include deterministic hashes for windows containing non-ACGTU IUPAC bases instead of masking those windows. |
|
|
257
|
+
| `--processes N` | Use 1–4 independent chromosome or comparison-group workers. When omitted, indexed multi-record input uses a bounded automatic worker count; unindexed and ordinary gzip input remain sequential. |
|
|
258
|
+
| `--memory-limit GIB` | Set an aggregate GiB memory budget for comparison workers. When omitted, available memory is used when the platform exposes it. |
|
|
259
|
+
| `--sketch-cache DIRECTORY` | Persist compact prepared sketches for reuse in later indexed comparative runs. Entries are keyed by input identity, record/region, strand mode, and sketch parameters. |
|
|
260
|
+
|
|
261
|
+
#### Output Options
|
|
262
|
+
|
|
263
|
+
| Argument | Description |
|
|
264
|
+
| --- | --- |
|
|
265
|
+
| `-o, --output-dir DIRECTORY` | Set the output directory. Static mode writes BEDPE, plots, and summaries; interactive mode writes saved matrices and coordinate logs. Default: the current directory. |
|
|
266
|
+
| `--cooler` | Write Cooler matrices in addition to BEDPE. Install with `pip install "ModDotPlot[cooler]"` or `pip install ".[cooler]"`. |
|
|
267
|
+
| `--no-bedpe` | Skip BEDPE output. |
|
|
268
|
+
| `--no-plot` | Skip all plot rendering in static mode. In interactive mode, prevent Dash from launching; must be combined with `--save`. |
|
|
269
|
+
| `--no-hist` | Skip identity histograms. |
|
|
270
|
+
|
|
271
|
+
#### Plot Formatting Options
|
|
272
|
+
|
|
273
|
+
| Argument | Description |
|
|
274
|
+
| --- | --- |
|
|
275
|
+
| `--grid` | Render selected self- and pairwise comparisons in a single square grid, in addition to individual plots. |
|
|
276
|
+
| `--grid-only` | Render only the comparison grid and skip individual plots. |
|
|
277
|
+
| `--compare-order {sequential,size}` | Choose comparative axis order. `sequential` preserves input order; `size` places the larger sequence on the x-axis. Default: `sequential`. |
|
|
278
|
+
| `-a, --axes-limits FLOAT` | Set common x/y axis limits for self-identity plots. The value cannot be shorter than the sequence. |
|
|
279
|
+
| `-t, --axes-ticks INT [INT ...]` | Set explicit x/y tick positions. Ticks outside the visible limits are omitted. |
|
|
280
|
+
| `--axes-number VALUE` | Retained for configuration compatibility as the requested number of axis ticks; currently unused by the Matplotlib renderer. Default: `7`. |
|
|
281
|
+
| `--width FLOAT` | Set plot width in inches. For grids, this is the total grid width, not the width of each cell. Default: `9`. |
|
|
282
|
+
| `--dpi INT` | Set raster resolution in dots per inch. Default: `300`. |
|
|
283
|
+
| `--vector {svg,pdf,ps}` | Select the vector output format. Default: `svg`. |
|
|
284
|
+
| `--deraster` | Keep dotplot tiles as vector geometry instead of rasterizing them inside vector output. This can produce very large files. |
|
|
285
|
+
|
|
286
|
+
#### Plot Customization Options
|
|
287
|
+
|
|
288
|
+
| Argument | Description |
|
|
289
|
+
| --- | --- |
|
|
290
|
+
| `--palette NAME_COUNT` | Select an exact discrete [ColorBrewer](https://colorbrewer2.org/) palette, such as `OrRd_8`. Default: `Spectral_11`. |
|
|
291
|
+
| `--palette-orientation {+,-}` | Select forward or reversed palette order. Diverging palettes retain ModDotPlot's historical orientation convention. Default: `+`. |
|
|
292
|
+
| `--colors COLOR [COLOR ...]`, `--color ...` | Supply a custom low-to-high color sequence in hexadecimal or RGB form. `--color` is a legacy alias. |
|
|
293
|
+
| `--breakpoints VALUE [VALUE ...]` | Supply custom identity thresholds between the identity cutoff and 100. The number of breakpoints must equal the number of colors plus one. |
|
|
294
|
+
| `--bin-freq` | Derive identity color bins from the observed value distribution instead of evenly spacing them between the identity cutoff and 100. |
|
|
295
|
+
| `--plot-direction` | Compute strand direction and color matches blue for the same orientation and pink for reverse orientation, with ANI represented by shade intensity. Available only with FASTA input. |
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
### Sample run - Static Plots
|
|
300
|
+
|
|
301
|
+
#### Using a config file
|
|
302
|
+
|
|
303
|
+
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 a sample run using a centromeric sequence of _Arabidopsis thaliana_:
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
$ cat config/config.json
|
|
307
|
+
|
|
308
|
+
{
|
|
309
|
+
"identity": 90,
|
|
310
|
+
"palette": "Blues_7",
|
|
311
|
+
"breakpoints": [
|
|
312
|
+
90,
|
|
313
|
+
91,
|
|
314
|
+
92,
|
|
315
|
+
93,
|
|
316
|
+
96,
|
|
317
|
+
98,
|
|
318
|
+
99,
|
|
319
|
+
100
|
|
320
|
+
],
|
|
321
|
+
"output_dir": "Arabidopsis",
|
|
322
|
+
"fasta": [
|
|
323
|
+
"sequences/Arabidopsis_chr1_centromere.fa"
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
$ moddotplot static -c config/config.json
|
|
330
|
+
__ __ _ _____ _ _____ _ _
|
|
331
|
+
| \/ | | | | __ \ | | | __ \| | | |
|
|
332
|
+
| \ / | ___ __| | | | | | ___ | |_ | |__) | | ___ | |_
|
|
333
|
+
| |\/| |/ _ \ / _` | | | | |/ _ \| __| | ___/| |/ _ \| __|
|
|
334
|
+
| | | | (_) | (_| | | |__| | (_) | |_ | | | | (_) | |_
|
|
335
|
+
|_| |_|\___/ \__,_| |_____/ \___/ \__| |_| |_|\___/ \__|
|
|
336
|
+
|
|
337
|
+
Running ModDotPlot in static mode
|
|
338
|
+
|
|
339
|
+
Retrieving k-mers from Chr1:14000001-18000000....
|
|
340
|
+
|
|
341
|
+
Chr1:14000001-18000000 k-mers retrieved!
|
|
342
|
+
|
|
343
|
+
Computing self identity matrix for Chr1:14000001-18000000...
|
|
344
|
+
|
|
345
|
+
Sequence length n: 4000000
|
|
346
|
+
|
|
347
|
+
Window size w: 4000
|
|
348
|
+
|
|
349
|
+
Modimizer sketch size: 1000
|
|
350
|
+
|
|
351
|
+
Plot Resolution r: 1000
|
|
352
|
+
|
|
353
|
+
Saved self-identity matrix as a paired-end bed file to Arabidopsis/Chr1:14000001-18000000/Chr1:14000001-18000000.bedpe
|
|
354
|
+
|
|
355
|
+
Triangle plots, full plots, and histogram for Arabidopsis/Chr1:14000001-18000000/Chr1:14000001-18000000 saved successfully.
|
|
356
|
+
```
|
|
357
|
+

|
|
358
|
+
|
|
359
|
+
Using `samtools faidx` will result in a genomic range being added to a FASTA file's header (e.g., in the above sequence, the header is Chr1:14000001-18000000). _ModDotPlot_ will parse this syntax to add the appropriate axis.
|
|
360
|
+
|
|
361
|
+
#### Adding custom bed file annotations
|
|
362
|
+
|
|
363
|
+
If providing a custom BED3-BED9 annotation file using `--bed/-b`, _ModDotPlot_ will output additional files:
|
|
364
|
+
|
|
365
|
+
- A collapsed annotation track `_ANNOTATION_TRACK` in PNG and the selected SVG, PDF, or PostScript vector format. Interval colors use the BED `itemRgb` value in column 9 when present, with a default color for BED3-BED8 records or invalid RGB values.
|
|
366
|
+
- The annotation track overlaid with a self-identity dotplot `_ANNOTATED` for each sequence present in the annotation track.
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
$ moddotplot static -f sequences/hg002_chr13_MATERNAL_4M.fa -b config/hg002v1.1.cenSatv2.0.bed
|
|
370
|
+
__ __ _ _____ _ _____ _ _
|
|
371
|
+
| \/ | | | | __ \ | | | __ \| | | |
|
|
372
|
+
| \ / | ___ __| | | | | | ___ | |_ | |__) | | ___ | |_
|
|
373
|
+
| |\/| |/ _ \ / _` | | | | |/ _ \| __| | ___/| |/ _ \| __|
|
|
374
|
+
| | | | (_) | (_| | | |__| | (_) | |_ | | | | (_) | |_
|
|
375
|
+
|_| |_|\___/ \__,_| |_____/ \___/ \__| |_| |_|\___/ \__|
|
|
376
|
+
|
|
377
|
+
Running ModDotPlot in static mode
|
|
378
|
+
|
|
379
|
+
...
|
|
380
|
+
|
|
381
|
+
Annotation track saved to chr13_MATERNAL_4M/chr13_MATERNAL_4M_ANNOTATION_TRACK
|
|
382
|
+
|
|
383
|
+
Triangle plots, full plots, and histogram for chr13_MATERNAL_4M/chr13_MATERNAL_4M saved successfully.
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+

|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
#### Comparing two sequences
|
|
390
|
+
|
|
391
|
+

|
|
392
|
+
|
|
393
|
+
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 the creation of self-identity plots, you can use `--compare-only`:
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
moddotplot static -f sequences/*_MATERNAL*.fa --compare-only
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
For a diploid multi-record assembly, a pair manifest avoids comparing every
|
|
400
|
+
chromosome and unplaced contig against every other record:
|
|
401
|
+
|
|
402
|
+
```text
|
|
403
|
+
# homologs.tsv
|
|
404
|
+
chr1_mat_hsa1 chr1_pat_hsa1
|
|
405
|
+
chr2_mat_hsa3 chr2_pat_hsa3
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
moddotplot static -f diploid.fa.gz --compare-only \
|
|
410
|
+
--pairs homologs.tsv --processes 4 --memory-limit 32 \
|
|
411
|
+
--sketch-cache .moddotplot-sketches
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
For BGZF-compressed FASTA, both `.fai` and `.gzi` indexes must accompany the
|
|
415
|
+
input. Indexed comparative mode fetches one record at a time, sketches it
|
|
416
|
+
directly, and releases pair-local data before continuing; it does not retain a
|
|
417
|
+
`uint64` positional hash for every base in the genome.
|
|
418
|
+
|
|
419
|
+

|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
### Interactive Mode Commands
|
|
424
|
+
|
|
425
|
+
**Deprecated:** interactive mode is maintenance-only and will not receive new
|
|
426
|
+
features. New browser-based work should use
|
|
427
|
+
[ModDotPlot Browser](https://marbl.github.io/ModDotPlot-Browser/). The legacy
|
|
428
|
+
Dash application remains available through the explicit subcommand:
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
moddotplot interactive <ARGS>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
Install its optional dependencies with
|
|
435
|
+
`pip install "ModDotPlot[interactive]"`, or
|
|
436
|
+
`pip install ".[interactive]"` from a source checkout. The application
|
|
437
|
+
listens on `http://127.0.0.1:8050` by default and exits when the process is
|
|
438
|
+
stopped with `Ctrl+C`.
|
|
439
|
+
|
|
440
|
+
Interactive mode accepts the following arguments. Some share names with the
|
|
441
|
+
default/static command but have interactive-specific behavior.
|
|
442
|
+
|
|
443
|
+
| Argument | Description |
|
|
444
|
+
| --- | --- |
|
|
445
|
+
| `--quiet` | Suppress all console output, including warnings and errors. It may appear before or after `interactive`. |
|
|
446
|
+
| `-f, --fasta FILE [FILE ...]` | Read FASTA input and compute an interactive matrix hierarchy. Mutually exclusive with `--load`; interactive displays support at most two sequences. |
|
|
447
|
+
| `-l, --load DIRECTORY` | Load a previously saved `interactive_matrices` directory containing compressed matrices and `metadata.pkl`. Mutually exclusive with `--fasta`. This is not the static BEDPE loader. |
|
|
448
|
+
| `-b, --bed BED [BED ...]` | Add one or more BED3-BED9 annotation files. Tracks are aligned to matching FASTA identifiers on each matrix axis. |
|
|
449
|
+
| `-o, --output-dir DIRECTORY` | Set the directory used for saved matrices and coordinate logs. Default: current directory. |
|
|
450
|
+
| `-k, --kmer INT` | Set k-mer length. Default: `21`. |
|
|
451
|
+
| `-m, --modimizer INT` | Set the modimizer sketch target. Default: `1000`. |
|
|
452
|
+
| `-r, --resolution INT` | Set interactive dotplot resolution. Default: `1000`. |
|
|
453
|
+
| `-w, --window INT` | Set the minimum interactive window length. When omitted it is inferred from sequence length and resolution. |
|
|
454
|
+
| `-id, --identity FLOAT` | Set the minimum estimated identity percentage. Default: `86.0`. |
|
|
455
|
+
| `-d, --delta FLOAT` | Include this fraction of neighboring windows during identity estimation. Default: `0.5`. |
|
|
456
|
+
| `--compare` | Add a pairwise comparison while retaining self-comparisons. |
|
|
457
|
+
| `--compare-only` | Produce the pairwise comparison without self-comparisons. Mutually exclusive with `--compare`. |
|
|
458
|
+
| `--ambiguous` | Include deterministic hashes for windows containing non-ACGTU IUPAC bases. |
|
|
459
|
+
| `--forward` | Hash forward k-mers only instead of canonical k-mers. |
|
|
460
|
+
| `-s, --save` | Save the matrix hierarchy under `OUTPUT_DIR/interactive_matrices` as compressed NumPy arrays plus `metadata.pkl`. |
|
|
461
|
+
| `--port INT` | Set the localhost port used by Dash. Default: `8050`. |
|
|
462
|
+
| `-q, --quick` | Build a single matrix layer instead of the normal hierarchy for a faster launch without progressively finer zoom resolution. |
|
|
463
|
+
| `--no-plot` | Save matrices without launching Dash. Must be combined with `--save`. |
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
### Sample run - Interactive Mode
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
$ moddotplot interactive -f sequences/Chr1_cen.fa
|
|
471
|
+
|
|
472
|
+
__ __ _ _____ _ _____ _ _
|
|
473
|
+
| \/ | | | | __ \ | | | __ \| | | |
|
|
474
|
+
| \ / | ___ __| | | | | | ___ | |_ | |__) | | ___ | |_
|
|
475
|
+
| |\/| |/ _ \ / _` | | | | |/ _ \| __| | ___/| |/ _ \| __|
|
|
476
|
+
| | | | (_) | (_| | | |__| | (_) | |_ | | | | (_) | |_
|
|
477
|
+
|_| |_|\___/ \__,_| |_____/ \___/ \__| |_| |_|\___/ \__|
|
|
478
|
+
|
|
479
|
+
Running ModDotPlot in interactive mode
|
|
480
|
+
|
|
481
|
+
Retrieving k-mers from Chr1:14000000-18000000....
|
|
482
|
+
|
|
483
|
+
Chr1:14000000-18000000 k-mers retrieved!
|
|
484
|
+
|
|
485
|
+
Building self-identity matrices for Chr1:14000000-18000000, using a minimum window size of 2000....
|
|
486
|
+
|
|
487
|
+
Layer 1 using window length 2000
|
|
488
|
+
|
|
489
|
+
Layer 2 using window length 4000
|
|
490
|
+
|
|
491
|
+
ModDotPlot interactive mode is successfully running on http://127.0.0.1:8050/
|
|
492
|
+
|
|
493
|
+
Dash is running on http://127.0.0.1:8050/
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+

|
|
497
|
+
|
|
498
|
+
The Plotly plot can be navigated using the zoom (magnifying glass) and pan (hand) icons. The plot can be reset by double-clicking or selecting the home button. The identity threshold can be modified by selecting the slider. Colors can be readjusted according to the same gradient based on the new identity levels.
|
|
499
|
+
|
|
500
|
+
### Sample run - Port Forwarding
|
|
501
|
+
|
|
502
|
+
Running interactive mode on an HPC environment can be accomplished through the use of port forwarding. On your remote server, run ModDotPlot as normal:
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
moddotplot interactive -f INPUT_FASTA_FILE(S) --port HPC_PORT_NUMBER
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Then on your local machine, set up a port forwarding tunnel:
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
ssh -N -f -L <LOCAL_PORT_NUMBER>:127.0.0.1:<HPC_PORT_NUMBER> HPC@LOGIN.CREDENTIALS
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
You should now be able to view interactive mode using `http://127.0.0.1:<LOCAL_PORT_NUMBER>`. Note that your own HPC environment may have specific instructions and/or restrictions for setting up port forwarding.
|
|
515
|
+
|
|
516
|
+
VS Code now has automatic port forwarding built into the terminal menu. See [VS Code documentation](https://code.visualstudio.com/docs/editor/port-forwarding) for further details.
|
|
517
|
+
|
|
518
|
+

|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Questions
|
|
523
|
+
|
|
524
|
+
For bug reports or general usage questions, please raise a GitHub issue, or email alex ~dot~ sweeten ~at~ nih ~dot~ gov
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## Known Issues
|
|
529
|
+
|
|
530
|
+
- When the optional `ModDotPlot[cooler]` dependencies are installed, Cooler may report `UserWarning: h5py is running against HDF5 1.xx.x when it was built against 1.xx.x, this may cause problems`. This can be safely ignored. To remove the warning, reinstall h5py against the local HDF5 library with `pip uninstall -y h5py` followed by `pip install --no-binary=h5py h5py`.
|