molamola 0.1.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.
molamola-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Martin Haagmans
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,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: molamola
3
+ Version: 0.1.0
4
+ Summary: Plot Oxford Nanopore variation as self-contained HTML reports.
5
+ Author-email: Martin Haagmans <martinhaagmans84@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Martin Haagmans
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/martinandclaude/molamola
29
+ Project-URL: Source, https://github.com/martinandclaude/molamola
30
+ Project-URL: Issues, https://github.com/martinandclaude/molamola/issues
31
+ Project-URL: Changelog, https://github.com/martinandclaude/molamola/blob/main/CHANGELOG.md
32
+ Keywords: bioinformatics,ont,oxford-nanopore,long-read,structural-variants,compound-het,phasing,vcf,plotting,cytogenetics
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Science/Research
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
43
+ Classifier: Topic :: Scientific/Engineering :: Visualization
44
+ Requires-Python: >=3.10
45
+ Description-Content-Type: text/markdown
46
+ License-File: LICENSE
47
+ Requires-Dist: matplotlib>=3.6
48
+ Requires-Dist: numpy>=1.23
49
+ Requires-Dist: pycirclize>=1.10
50
+ Requires-Dist: pandas>=1.5
51
+ Requires-Dist: biopython>=1.80
52
+ Provides-Extra: dev
53
+ Requires-Dist: pytest>=7; extra == "dev"
54
+ Requires-Dist: ruff>=0.4; extra == "dev"
55
+ Provides-Extra: derive
56
+ Requires-Dist: pyliftover>=0.4; extra == "derive"
57
+ Dynamic: license-file
58
+
59
+ ```
60
+ _ _ .--.
61
+ _ __ ___ ___ | | __ _ _ __ ___ ___ | | __ _ _/ \___
62
+ | '_ ` _ \ / _ \| |/ _` | '_ ` _ \ / _ \| |/ _` | ( o )
63
+ | | | | | | (_) | | (_| | | | | | | (_) | | (_| | \___..___/
64
+ |_| |_| |_|\___/|_|\__,_|_| |_| |_|\___/|_|\__,_| ||
65
+ ```
66
+
67
+ A Python plotting tool for Oxford Nanopore variation data. **One VCF in, one self-contained HTML report out.** molamola inspects the VCF header and picks the right plot type automatically — no flags or subcommands to remember:
68
+
69
+ - **SV / cytogenetics report** for long-read SV VCFs (Sniffles2 / cuteSV / SVIM / pbsv / NanoVar). Cytoband-ideogram circos plot plus a linear genome SV map with per-type density tracks (INS / DEL / DUP / INV) and BND arcs.
70
+ - **Per-gene phased-haplotype panels** for phased + VEP-annotated small-variant VCFs (WhatsHap / HiPhase). One panel per candidate gene: canonical-transcript exon track, H1 / H2 hap lines, mint phase blocks across both haps, ClinVar-coloured missense lollipops and synonymous-variant ticks for context.
71
+
72
+ Both produce one self-contained HTML report — figures embedded as base64 PNGs, no external assets, opens offline.
73
+
74
+ ## Install
75
+
76
+ ```sh
77
+ pip install molamola
78
+ ```
79
+
80
+ Or for development from a clone:
81
+
82
+ ```sh
83
+ git clone https://github.com/martinandclaude/molamola.git
84
+ cd molamola
85
+ pip install -e .[dev]
86
+ pytest -v
87
+ ```
88
+
89
+ ## Quick start
90
+
91
+ ```sh
92
+ # Long-read SV VCF (Sniffles2 etc.) → cytogenetics report
93
+ molamola --vcf sample.sniffles.vcf
94
+ open path/to/sample.report.html
95
+
96
+ # Phased + VEP-annotated VCF → compound-het workup, all candidate genes
97
+ molamola --vcf sample.phased.vep.vcf.gz
98
+ open path/to/sample.compound_het.report.html
99
+
100
+ # Just one gene from a phased + VEP VCF
101
+ molamola --vcf sample.phased.vep.vcf.gz --gene NEB
102
+ ```
103
+
104
+ The plot type is auto-detected from the VCF header: `##INFO=<ID=SVTYPE>` selects SV mode; `##INFO=<ID=CSQ>` + `##FORMAT=<ID=PS>` selects compound-het mode. VCFs that match neither shape are refused with a clear error.
105
+
106
+ ## What it produces
107
+
108
+ ### SV / cytogenetics report
109
+
110
+ - **Circos plot** (pyCirclize) — cytoband ideogram with BND ribbons; line thickness scaled by `SUPPORT`, colour by VAF.
111
+ - **Linear genome SV map** — chr1 → chrY, one row each. Greyscale ISCN-style cytobands, four per-type density strips (INS = blue, DEL = red, DUP = green, INV = purple) at 1 Mb bins, BND arcs above. Annotated with ISCN nomenclature like `t(7;17)(q11.23;q12)`.
112
+ - Two noise heuristics that work on the VCF alone — no external reference data needed: acrocentric short-arm BNDs (chr13/14/15/21/22 p-arms; on by default for hg38, off for T2T) and coverage-anomaly BNDs (`max(COVERAGE) >= --cov-ratio × baseline AND VAF < --cov-vaf-max`).
113
+ - Supports hg38 and T2T-CHM13v2.0 via bundled cytobands.
114
+
115
+ ### Compound-het panels
116
+
117
+ - One panel per gene: IGV-style blue canonical-transcript exon track on top, two horizontal H1 / H2 hap lines, mint phase-block rectangles spanning both haps (with off-edge arrows when a block stretches past the gene window), ClinVar-coloured missense lollipops hanging downward, synonymous-variant `x` markers on the hap line for context.
118
+ - Auto-select sweep when `--gene` is omitted: gene qualifies iff at least one trans pair has one variant in ClinVar P/LP or VUS and the partner is not benign. The report splits results into a `strict` section (both variants P/LP or VUS — true compound-het) and an `extended` section (anchor P/LP-or-VUS, partner conflicting / no-ClinVar / P/LP / VUS). The strict heading is shown even when its subset is empty so the dichotomy is always visible.
119
+ - Use `--gene SYMBOL` to plot a specific gene regardless of the auto-select rule (useful for manual review of P/LP + benign or no-ClinVar + no-ClinVar pairs).
120
+ - Tunable via `--min-pair-count` (raise for stricter sweeps) and `--max-genes` (default 50).
121
+ - hg38-only: ClinVar coordinates are hg38, and coordinate-based lookup is the matching path.
122
+
123
+ ClinVar usage in compound-het is purely a colour key on data points — no clinical interpretation is performed or implied.
124
+
125
+ ## Bundled references
126
+
127
+ All in `molamola/data/`:
128
+
129
+ - `cytoBand.txt.gz` (hg38), `cytoBand.t2t.txt.gz` (T2T-CHM13v2.0) — UCSC cytoband annotations for SV mode.
130
+ - `canonical_exons.hg38.tsv.gz` — MANE Select v1.x canonical transcripts and exon coordinates.
131
+ - `clinvar.hg38.tsv.xz` — molamola's reduced ClinVar TSV (chrom, pos, ref, alt, significance bucket; xz-compressed). Release date logged in each report's run-metadata.
132
+
133
+ Bundled-only by design: molamola does not auto-download or look up online. Use `--clinvar PATH` or `--canonical-exons PATH` to override.
134
+
135
+ The reduced TSVs are reproducibly regeneratable from public sources via `scripts/derive_canonical_exons.py` and `scripts/derive_clinvar_for_molamola.py`.
136
+
137
+ ## CLI
138
+
139
+ ```sh
140
+ molamola --vcf VCF [--out DIR] [--reference hg38|t2t] [...]
141
+ ```
142
+
143
+ Full flag list: [`docs/CLI.md`](docs/CLI.md). Filter explanations: [`docs/FILTERS.md`](docs/FILTERS.md). Output formats: [`docs/OUTPUTS.md`](docs/OUTPUTS.md). Worked examples: [`docs/EXAMPLES.md`](docs/EXAMPLES.md). Per-release changes: [`CHANGELOG.md`](CHANGELOG.md).
144
+
145
+ ## Development
146
+
147
+ ```sh
148
+ pytest -v
149
+ ruff check .
150
+ ```
151
+
152
+ CI runs lint + pytest on Python 3.10 / 3.11 / 3.12 on every push and PR.
153
+
154
+ ## Acknowledgements
155
+
156
+ - [Sniffles2](https://github.com/fritzsedlazeck/Sniffles), [cuteSV](https://github.com/tjiangHIT/cuteSV), [SVIM](https://github.com/eldariont/svim), [pbsv](https://github.com/PacificBiosciences/pbsv), [NanoVar](https://github.com/cytham/nanovar) — long-read SV callers.
157
+ - [WhatsHap](https://github.com/whatshap/whatshap), [HiPhase](https://github.com/PacificBiosciences/HiPhase) — long-read phasing.
158
+ - [VEP](https://github.com/Ensembl/ensembl-vep), [MANE Select](https://www.ncbi.nlm.nih.gov/refseq/MANE/), [ClinVar](https://www.ncbi.nlm.nih.gov/clinvar/) — variant annotation and significance.
159
+ - [pyCirclize](https://github.com/moshi4/pyCirclize) — circos plot.
160
+ - [matplotlib](https://github.com/matplotlib/matplotlib), [numpy](https://github.com/numpy/numpy).
161
+ - [bcftools / samtools / htslib](https://github.com/samtools/bcftools) — VCF pre-processing helpers.
162
+ - [UCSC Genome Browser](https://hgdownload.soe.ucsc.edu/) — hg38 and T2T-CHM13v2.0 cytobands.
163
+ - [iconsdb.com](https://www.iconsdb.com/) — header fish icon (deep-pink, mirrored).
164
+
165
+ ## License
166
+
167
+ [MIT](LICENSE).
@@ -0,0 +1,109 @@
1
+ ```
2
+ _ _ .--.
3
+ _ __ ___ ___ | | __ _ _ __ ___ ___ | | __ _ _/ \___
4
+ | '_ ` _ \ / _ \| |/ _` | '_ ` _ \ / _ \| |/ _` | ( o )
5
+ | | | | | | (_) | | (_| | | | | | | (_) | | (_| | \___..___/
6
+ |_| |_| |_|\___/|_|\__,_|_| |_| |_|\___/|_|\__,_| ||
7
+ ```
8
+
9
+ A Python plotting tool for Oxford Nanopore variation data. **One VCF in, one self-contained HTML report out.** molamola inspects the VCF header and picks the right plot type automatically — no flags or subcommands to remember:
10
+
11
+ - **SV / cytogenetics report** for long-read SV VCFs (Sniffles2 / cuteSV / SVIM / pbsv / NanoVar). Cytoband-ideogram circos plot plus a linear genome SV map with per-type density tracks (INS / DEL / DUP / INV) and BND arcs.
12
+ - **Per-gene phased-haplotype panels** for phased + VEP-annotated small-variant VCFs (WhatsHap / HiPhase). One panel per candidate gene: canonical-transcript exon track, H1 / H2 hap lines, mint phase blocks across both haps, ClinVar-coloured missense lollipops and synonymous-variant ticks for context.
13
+
14
+ Both produce one self-contained HTML report — figures embedded as base64 PNGs, no external assets, opens offline.
15
+
16
+ ## Install
17
+
18
+ ```sh
19
+ pip install molamola
20
+ ```
21
+
22
+ Or for development from a clone:
23
+
24
+ ```sh
25
+ git clone https://github.com/martinandclaude/molamola.git
26
+ cd molamola
27
+ pip install -e .[dev]
28
+ pytest -v
29
+ ```
30
+
31
+ ## Quick start
32
+
33
+ ```sh
34
+ # Long-read SV VCF (Sniffles2 etc.) → cytogenetics report
35
+ molamola --vcf sample.sniffles.vcf
36
+ open path/to/sample.report.html
37
+
38
+ # Phased + VEP-annotated VCF → compound-het workup, all candidate genes
39
+ molamola --vcf sample.phased.vep.vcf.gz
40
+ open path/to/sample.compound_het.report.html
41
+
42
+ # Just one gene from a phased + VEP VCF
43
+ molamola --vcf sample.phased.vep.vcf.gz --gene NEB
44
+ ```
45
+
46
+ The plot type is auto-detected from the VCF header: `##INFO=<ID=SVTYPE>` selects SV mode; `##INFO=<ID=CSQ>` + `##FORMAT=<ID=PS>` selects compound-het mode. VCFs that match neither shape are refused with a clear error.
47
+
48
+ ## What it produces
49
+
50
+ ### SV / cytogenetics report
51
+
52
+ - **Circos plot** (pyCirclize) — cytoband ideogram with BND ribbons; line thickness scaled by `SUPPORT`, colour by VAF.
53
+ - **Linear genome SV map** — chr1 → chrY, one row each. Greyscale ISCN-style cytobands, four per-type density strips (INS = blue, DEL = red, DUP = green, INV = purple) at 1 Mb bins, BND arcs above. Annotated with ISCN nomenclature like `t(7;17)(q11.23;q12)`.
54
+ - Two noise heuristics that work on the VCF alone — no external reference data needed: acrocentric short-arm BNDs (chr13/14/15/21/22 p-arms; on by default for hg38, off for T2T) and coverage-anomaly BNDs (`max(COVERAGE) >= --cov-ratio × baseline AND VAF < --cov-vaf-max`).
55
+ - Supports hg38 and T2T-CHM13v2.0 via bundled cytobands.
56
+
57
+ ### Compound-het panels
58
+
59
+ - One panel per gene: IGV-style blue canonical-transcript exon track on top, two horizontal H1 / H2 hap lines, mint phase-block rectangles spanning both haps (with off-edge arrows when a block stretches past the gene window), ClinVar-coloured missense lollipops hanging downward, synonymous-variant `x` markers on the hap line for context.
60
+ - Auto-select sweep when `--gene` is omitted: gene qualifies iff at least one trans pair has one variant in ClinVar P/LP or VUS and the partner is not benign. The report splits results into a `strict` section (both variants P/LP or VUS — true compound-het) and an `extended` section (anchor P/LP-or-VUS, partner conflicting / no-ClinVar / P/LP / VUS). The strict heading is shown even when its subset is empty so the dichotomy is always visible.
61
+ - Use `--gene SYMBOL` to plot a specific gene regardless of the auto-select rule (useful for manual review of P/LP + benign or no-ClinVar + no-ClinVar pairs).
62
+ - Tunable via `--min-pair-count` (raise for stricter sweeps) and `--max-genes` (default 50).
63
+ - hg38-only: ClinVar coordinates are hg38, and coordinate-based lookup is the matching path.
64
+
65
+ ClinVar usage in compound-het is purely a colour key on data points — no clinical interpretation is performed or implied.
66
+
67
+ ## Bundled references
68
+
69
+ All in `molamola/data/`:
70
+
71
+ - `cytoBand.txt.gz` (hg38), `cytoBand.t2t.txt.gz` (T2T-CHM13v2.0) — UCSC cytoband annotations for SV mode.
72
+ - `canonical_exons.hg38.tsv.gz` — MANE Select v1.x canonical transcripts and exon coordinates.
73
+ - `clinvar.hg38.tsv.xz` — molamola's reduced ClinVar TSV (chrom, pos, ref, alt, significance bucket; xz-compressed). Release date logged in each report's run-metadata.
74
+
75
+ Bundled-only by design: molamola does not auto-download or look up online. Use `--clinvar PATH` or `--canonical-exons PATH` to override.
76
+
77
+ The reduced TSVs are reproducibly regeneratable from public sources via `scripts/derive_canonical_exons.py` and `scripts/derive_clinvar_for_molamola.py`.
78
+
79
+ ## CLI
80
+
81
+ ```sh
82
+ molamola --vcf VCF [--out DIR] [--reference hg38|t2t] [...]
83
+ ```
84
+
85
+ Full flag list: [`docs/CLI.md`](docs/CLI.md). Filter explanations: [`docs/FILTERS.md`](docs/FILTERS.md). Output formats: [`docs/OUTPUTS.md`](docs/OUTPUTS.md). Worked examples: [`docs/EXAMPLES.md`](docs/EXAMPLES.md). Per-release changes: [`CHANGELOG.md`](CHANGELOG.md).
86
+
87
+ ## Development
88
+
89
+ ```sh
90
+ pytest -v
91
+ ruff check .
92
+ ```
93
+
94
+ CI runs lint + pytest on Python 3.10 / 3.11 / 3.12 on every push and PR.
95
+
96
+ ## Acknowledgements
97
+
98
+ - [Sniffles2](https://github.com/fritzsedlazeck/Sniffles), [cuteSV](https://github.com/tjiangHIT/cuteSV), [SVIM](https://github.com/eldariont/svim), [pbsv](https://github.com/PacificBiosciences/pbsv), [NanoVar](https://github.com/cytham/nanovar) — long-read SV callers.
99
+ - [WhatsHap](https://github.com/whatshap/whatshap), [HiPhase](https://github.com/PacificBiosciences/HiPhase) — long-read phasing.
100
+ - [VEP](https://github.com/Ensembl/ensembl-vep), [MANE Select](https://www.ncbi.nlm.nih.gov/refseq/MANE/), [ClinVar](https://www.ncbi.nlm.nih.gov/clinvar/) — variant annotation and significance.
101
+ - [pyCirclize](https://github.com/moshi4/pyCirclize) — circos plot.
102
+ - [matplotlib](https://github.com/matplotlib/matplotlib), [numpy](https://github.com/numpy/numpy).
103
+ - [bcftools / samtools / htslib](https://github.com/samtools/bcftools) — VCF pre-processing helpers.
104
+ - [UCSC Genome Browser](https://hgdownload.soe.ucsc.edu/) — hg38 and T2T-CHM13v2.0 cytobands.
105
+ - [iconsdb.com](https://www.iconsdb.com/) — header fish icon (deep-pink, mirrored).
106
+
107
+ ## License
108
+
109
+ [MIT](LICENSE).