Skip to main content

Anaconda-Server Badge Anaconda-Server Badge

METHPLOTLIB

This script generates an interactive browser view on a window using data from
i) bam or cram with MM/ML tags according to the SAM specifications, e.g. from dorado
ii) bedMethyl, as written by modkit pileup (18 columns, with or without --only-tabs) or by modbam2bed --extended (14 columns). Files containing multiple modifications (e.g. 5mC and 5hmC) do not have to be split up: each modification gets its own track, and --mods can be used to restrict to some of them
iii) bedgraph, with 4 columns (chromosome, start, end, value) or the 5 columns written by modkit pileup --bedgraph

Annotation can be added from a gtf or bed file, or with -g mane from the MANE Select transcripts of GRCh38, which are downloaded once.

Legacy formats

Output of nanopolish (methylation calls, optionally phased with scripts/annotate_calls_by_phase.py and scripts/split_calls_by_phase.py, or frequencies from calculate_methylation_frequency.py) and of nanocompore is still supported. These formats are kept working as they are, but get no new features and may be removed in a future major version. The same goes for the Snakemake workflow for nanopolish and the companion scripts below, which work on nanopolish output.

methplotlib-rs

methplotlib-rs is a Rust version for static images (png, svg or pdf) of bam/cram, bedMethyl and bedgraph data. It is not a replacement: use this Python version to explore a region interactively, and the Rust version to make many figures, e.g. in a pipeline, as a single binary without dependencies.

INSTALLATION

Creating a new conda environment:
conda create -n methplotlib methplotlib

Or using pip:
pip install methplotlib

USAGE

methplotlib [-h] [-v] -m METHYLATION [METHYLATION ...] -n NAMES
                   [NAMES ...] -w WINDOW [-g GTF] [-b BED] [-f FASTA]
                   [--simplify] [--split] [--static STATIC] [--smooth SMOOTH]
                   [--dotsize DOTSIZE] [--example] [-o OUTFILE] [-q QCFILE]

plotting nanopolish methylation calls or frequency

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Print version and exit.
  -m, --methylation METHYLATION [METHYLATION ...]
                        data in nanopolish, nanocompore, ont-cram or bedgraph
                        format
  -n, --names NAMES [NAMES ...]
                        names of datasets in --methylation
  -w, --window WINDOW   window (region) to which the visualisation has to be restricted
  -g, --gtf GTF         add annotation based on a gtf file, or 'mane' for the
                        MANE Select transcripts of GRCh38 (downloaded once)
  -b, --bed BED         add annotation based on a bed file
  -f, --fasta FASTA     required when --window is an entire chromosome, contig or transcript
  --simplify            simplify annotation track to show genes rather than transcripts
  --split               split, rather than overlay the methylation tracks
  --static              Make a static image of the browser window (filename)
  --binary              Make the nanopolish plot ignorning log likelihood nuances
  --smooth              Rolling window size for averaging frequency values (int)
  --dotsize             Control the size of dots in the per read plots (int)
  --example             Show example command and exit.
  -o, --outfile OUTFILE File to write results to. Default:
                        methylation_browser_{chr}_{start}_{end}.html. Use
                        {region} as a shorthand for {chr}_{start}_{end} in the
                        filename. Missing paths will be created.
  -q, --qcfile QCFILE   File to write the qc report to. Default: The path in
                        outfile prefixed with qc_, default is qc_report_methyl
                        ation_browser_{chr}_{start}_{end}.html. Use {region}
                        as a shorthand for {chr}_{start}_{end} in the
                        filename. Missing paths will be created.

Snakemake workflow (legacy)

For streamlining nanopolish a Snakefile is included (using snakemake). The workflow uses a config file, of which an example is in this repository.

Example data

The examples folder contains nanopolish calls and frequencies for the human ACTB gene from PromethION sequencing of NA19240, and small synthetic bam, bedMethyl and bedgraph files (made with scripts/make_test_data.py of methplotlib-rs). Example commands are in examples/test.sh.

Companion scripts (legacy)

The scripts folder contains scripts for phasing modification calls in haplotypes based on WhatsHap phasing, allele specific modification testing for phased data and differential modification testing across subjects.

TO DO - CONTRIBUTIONS WELCOME

  • Outlier detection (in windows) across samples

Metadata

Release files for methplotlib 1.0.0

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

Source distribution (sdist)

Source distribution for methplotlib 1.0.0
File Size Uploaded Provenance Actions
methplotlib-1.0.0.tar.gz 35.1 kB With provenance Details for methplotlib-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for methplotlib 1.0.0
File Interpreter ABI Platform Actions
methplotlib-1.0.0-py3-none-any.whl Python 3 none any Details for methplotlib-1.0.0-py3-none-any.whl

Total release size: 68.3 kB

Release files / methplotlib-1.0.0.tar.gz

Download URL methplotlib-1.0.0.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f25f2874706f8221d499b9f30c9fc5973a557ab0eacf8165842b01376975cdad
BLAKE2b-256 checksum
How to use checksums
79fd5a974a202494fa1cf0691dd5da9566c13ba7f64fa5e35f27eb66c3935f24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / methplotlib-1.0.0-py3-none-any.whl

Download URL methplotlib-1.0.0-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
744d540f9469d32719d97305a048d7cd663dfd0f57924a09be6f605834f6ce2b
BLAKE2b-256 checksum
How to use checksums
84660351046033d90a42ff3a5c13de9ea53633ef4fad323eb64c653048a4c0fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for methplotlib 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for methplotlib-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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