Publication-quality plots from MAGGIC pipeline results
Project description
maggic-wand
maggic-wand generates publication-quality static plots from MAGGIC (Metagenome Assembled Genome with Iterative Classification) pipeline output. It takes the maggic-results.tsv table and optional maggic-globalabundance.tsv (CoverM TMM matrix) and produces PNG charts suitable for downstream MultiQC integration.
Problems It Solves
- Manual plotting: Avoids per-run manual invocation of
ggplot/matplotlibscripts - Inconsistent taxonomy parsing: extracts genus, species, and phylum from
GTDB-Tkstyle__-delimited strings in one place - Abundance aggregation: joins
CoverMTMM per-bin values to genus/species level with taxonomy from results - Reproducible output: fixed color palettes (tab20-based), deterministic figure sizes, 300dpi PNG
How It Works
- User points
maggic-wandat a directory containingmaggic-results.tsv - The tool loads results, optionally joins with
maggic-globalabundance.tsvfor abundance-aware plots - Taxonomy (genus, species, phylum) is extracted and attached to abundance rows
- Requested plot types are generated as 300dpi PNGs
Minimum Requirements
- Python 3.11+
- Dependencies:
pandas,matplotlib,seaborn,scipy,wordcloud,typer,beartype,rich
Installation
Installation from PyPI
pip install maggic-wand
Or with uv:
uv pip install maggic-wand
The package installs the maggic-wand CLI entry point.
Installation via uv (Editable)
git clone repo-url
cd maggic-wand
uv sync
Installation from Source
pip install .
For development with formatting tools:
pip install -e ".[dev]"
Input Files
maggic-wand expects these files in the results directory:
| File | Required | Source |
|---|---|---|
maggic-results.tsv |
Yes | MAGGIC pipeline output (30-column TSV with bin metadata, taxonomy, AMR, MGE fields) |
maggic-globalabundance.tsv |
No | CoverM TMM-normalized abundance matrix (bins x samples) |
ALL_REFINED_BINS_QUALITY_REPORT.tsv |
No | Binette post deduplication quality report (12 columns) |
Plots that depend on abundance data (diversity, heatmap) are skipped with a warning if maggic-globalabundance.tsv is absent. The quality-ecdf plot is skipped if the Binette quality report is absent.
Usage
Generate All Plots
maggic-wand plot --maggic-results-dir /path/to/maggic/results/
This discovers maggic-results.tsv and optional companion files, then writes all PNG plots to <results_dir>/plots/.
Single Plot Type
# Only diversity (genus + species) and heatmap (genus + species)
maggic-wand plot --maggic-results-dir results/ --plot-type diversity,heatmap
Individual Plot Commands
For targeted use (e.g., scripting a single chart):
# Diversity stacked bars (genus + species)
maggic-wand plot-diversity results/maggic-results.tsv results/maggic-globalabundance.tsv -o diversity.png -n 10
# Quality scatter
maggic-wand plot-quality results/maggic-results.tsv -o quality.png
# Heatmaps (genus + species)
maggic-wand plot-heatmap results/maggic-results.tsv results/maggic-globalabundance.tsv -o heatmap.png -n 30
Plot Types
| Plot | Flag | Input Needed | Description |
|---|---|---|---|
| Diversity | diversity |
results + abundance | Stacked bars at genus and species level, top-N taxa, TMM-summed per sample, normalized to 100% |
| Heatmap | heatmap |
results + abundance | Hierarchical clustering heatmaps at genus and species level, phylum-colored side bar, column dendrogram |
| Quality scatter | quality |
results | Completeness vs Contamination, colored by bin type |
| AMR wordcloud | amr-wordcloud |
results | Gene frequency from AMR_Genes column |
| AMR donut | amr-donut |
results | AMR class distribution, top-15 + Other |
| MGE radar | mge-radar |
results | Dual radar (plasmid + virus profile), top-N bins |
| Quality ECDF | quality-ecdf |
results + Binette report | Cumulative completeness/contamination/score by binning tool (VAMB, MetaBat2, SemiBin2) |
| Contig scatter | contigscatter |
results | log10(contig count) vs Completeness, marker size = genome size |
CLI Help
maggic-wand --help
maggic-wand plot --help
maggic-wand plot-diversity --help
maggic-wand plot-heatmap --help
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maggic_wand-0.1.3.tar.gz.
File metadata
- Download URL: maggic_wand-0.1.3.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b567f990db9912396cf6c478eae6ffe3b8d56ec063d5299be8e9bad5649fa3f8
|
|
| MD5 |
95af475429ea14ec5f465b6e11243614
|
|
| BLAKE2b-256 |
d8a7ee5a4bc4dd0bb30d19c5581a7310082c1b3446d78feafa16b470623326b6
|
File details
Details for the file maggic_wand-0.1.3-py3-none-any.whl.
File metadata
- Download URL: maggic_wand-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05a4b98803798f14905517706585d157a19ee8450bd277967f2929e64b0fefd1
|
|
| MD5 |
565cedf31b0edd65c40218f722100405
|
|
| BLAKE2b-256 |
97c7f22f403b67127b1ef947a91991e645663ae986e07102e052e36f72d3862a
|