Skip to main content

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/matplotlib scripts
  • Inconsistent taxonomy parsing: extracts genus, species, and phylum from GTDB-Tk style __-delimited strings in one place
  • Abundance aggregation: joins CoverM TMM 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

  1. User points maggic-wand at a directory containing maggic-results.tsv
  2. The tool loads results, optionally joins with maggic-globalabundance.tsv for abundance-aware plots
  3. Taxonomy (genus, species, phylum) is extracted and attached to abundance rows
  4. Requested plot types are generated as 300dpi PNGs


 


 

Minimum Requirements

  1. Python 3.12+
  2. Dependencies: pandas, matplotlib, seaborn, scipy, wordcloud, typer, beartype, rich, pydantic


 

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]"

Installation via Container

Docker image:

docker pull ghcr.io/biocoder/maggic-wand:0.1.4

Singularity (via oras):

apptainer pull maggic-wand.sif "oras://ghcr.io/biocoder/maggic-wand-sif:0.1.4"

Run:

docker run --rm ghcr.io/biocoder/maggic-wand:0.1.4 plot -d /path/to/maggic/results/ -o /path/to/output/


 

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) — outputs genus_diversity.png and species_diversity.png
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) — outputs genus_heatmap.png and species_heatmap.png
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

Metadata

Release files for maggic-wand 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maggic-wand 0.1.7
File Size Uploaded Provenance
maggic_wand-0.1.7.tar.gz 23.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for maggic-wand 0.1.7
File Interpreter ABI Platform
maggic_wand-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 61.5 kB

Release files / maggic_wand-0.1.7.tar.gz

Download URL maggic_wand-0.1.7.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1607132023404ade911465dcaa1aa11a13a28a4354393c7bceec24f17b4ec340
BLAKE2b-256 checksum
How to use checksums
d9f3f01b51c54af7b63a18b6e0050554b54b9ac201dedc3b45a5c8e111e2b0b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.8","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / maggic_wand-0.1.7-py3-none-any.whl

Download URL maggic_wand-0.1.7-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dca2b628f1cebd84a1151a9a164d1ed96785e470a119f1bfb2530808e83b0cf
BLAKE2b-256 checksum
How to use checksums
65d466d1b48fcee49b859d3b3fd5a23b1cae9f30ddd2c3383b4ccb969e6c47b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Rocky Linux","version":"9.8","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for maggic-wand 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page