Skip to main content

nf-metro

Documentation | Playground | Gallery

Generate metro-map-style SVG diagrams from Mermaid graph definitions with %%metro directives. Designed for visualizing bioinformatics pipeline workflows (e.g., nf-core pipelines) as transit-style maps where each analysis route is a colored "metro line."

nf-core/rnaseq metro map

Try it without installing: the nf-metro playground runs the full layout engine in your browser. Edit a .mmd file, preview the result live, import a Nextflow -with-dag diagram directly, and tweak layout options - no Python, no CLI needed.

What nf-metro does

  • Static SVG - a self-contained diagram you can commit, embed in a README, or drop into docs.
  • Interactive HTML - pan, zoom, hover for station details, click a line in the legend to isolate it and zoom to its extent.
  • Live progress overlay - light up stations in real time as a Nextflow pipeline runs, using nf-metro serve with Nextflow's -with-weblog.
  • Dashboard mode - nf-metro serve-multi hosts many pipelines or runs side by side on one page.
  • Nextflow DAG import - convert a -with-dag Mermaid export into a metro map with nf-metro convert (or --from-nextflow on render).
  • Embedded data manifest - every SVG carries a machine-readable JSON manifest so overlays and downstream tools can address stations without re-running the layout engine.

Installation

pip (PyPI)

pip install nf-metro

Conda (Bioconda)

conda install bioconda::nf-metro

Container (Seqera Containers)

A pre-built container is available via Seqera Containers:

docker pull community.wave.seqera.io/library/pip_nf-metro:611b1ba39c6007f1

Extras

Two features need a dependency the base install leaves out:

pip install "nf-metro[validate]"   # nf-metro validate-svg (jsonschema)
pip install "nf-metro[font]"       # render --text-to-paths (fonttools)

Development

pip install -e ".[dev]"

Requires Python 3.11+.

Quick start

Write a two-line pipeline to pipeline.mmd:

cat > pipeline.mmd <<'EOF'
%%metro title: Simple Pipeline
%%metro line: main | Main | #4CAF50
%%metro line: qc | Quality Control | #2196F3 | dashed

graph LR
    input[Input]
    fastqc[FastQC]
    trim[Trimming]
    align[Alignment]

    input -->|main| trim
    trim -->|main| align
    input -->|qc| fastqc
    trim -->|qc| fastqc
EOF

Render it:

nf-metro render pipeline.mmd -o pipeline.svg

Check the input without rendering, or see what nf-metro made of it:

nf-metro validate pipeline.mmd
nf-metro info pipeline.mmd

Every command takes --help, and the CLI reference documents each one and every option it accepts. The Guide is a step-by-step walkthrough of writing .mmd files, ending in the full directive reference.

Input format

Input files are a subset of Mermaid graph LR syntax extended with %%metro directives. The map above uses only global directives, which configure the whole map, plus edges carrying the line IDs that pass along them. Section directives inside Mermaid subgraph blocks control how each section is laid out.

From there the Guide covers sections, entry and exit ports, grid placement, file and folder icons, off-track stations, inactive lines and the rest, directive by directive.

Interactive HTML output

--format html produces a self-contained page with the SVG inlined plus a small JS/CSS layer (no external dependencies, no network):

nf-metro render pipeline.mmd --format html -o pipeline.html

Drag to pan, scroll to zoom, hover a station for its label, section and lines, and click a line in the legend to isolate it and zoom to its extent. An Embed... panel copies out a snippet for a host page: inline HTML that keeps full interactivity, an iframe one-liner, or the raw <svg> for contexts that strip scripts.

GitHub READMEs are one of those contexts, so embed there as a static SVG (or link out to a hosted version). Most static-site generators and internal wikis run the inline-HTML snippet as-is. See the embedding guide for the options.

Live progress

nf-metro can light up a metro map in real time as a Nextflow pipeline runs. Map stations to Nextflow processes with %%metro process: directives, then start the server and point Nextflow's -with-weblog at it:

nf-metro serve path/to/map.mmd
nextflow run my/pipeline -with-weblog http://localhost:8080/events

Stations transition from pending to running to done as tasks are submitted and complete. The layout is computed once and the overlay is drawn on top, so the map never re-flows during a run. nf-metro serve-multi is the dashboard version: each pipeline or run registers its own map and gets a stable /r/<id>/ URL.

For multi-pipeline dashboards, persistent history, and the optional Nextflow plugin that handles wiring automatically, see the live progress guide.

Embedded data manifest

Every rendered SVG carries a machine-readable manifest, so the committed file is a self-contained artifact: a downstream tool can position overlays, restyle nodes, or look up which processes a node represents without re-running the layout engine. The data travels as a JSON block in a <metadata id="diagram-manifest"> element and as data-node-* attributes on each station's <g> element. See the data manifest docs for the schema and how to consume it.

Examples

The examples/ directory contains ready-to-render .mmd files:

Example Description
simple_pipeline.mmd Minimal two-line pipeline with no sections
rnaseq_auto.mmd nf-core/rnaseq with fully auto-inferred layout
rnaseq_sections.mmd nf-core/rnaseq with manual grid overrides

examples/topologies/ collects the layout patterns the engine is tested against. See the topology README for descriptions and rendered previews, or browse the online gallery.

A few highlights:

Wide Fan-Out Section Diamond Variant Calling
Wide Fan-Out Section Diamond Variant Calling
Fold Serpentine Multi-Line Bundle RNA-seq Lite
Fold Double Multi-Line Bundle RNA-seq Lite

Python API

nf-metro is a command-line tool. Its Python modules are importable, but the internal API (parser, layout engine, renderer) is not part of the public, semver-stable surface and may change between releases without notice. Drive nf-metro through the nf-metro CLI (or python -m nf_metro) for stable behaviour.

Contributing

See the Contributing guide for setup, testing, how to add topology fixtures, working with layout invariants, and the visual review process.

License

MIT

Metadata

Release files for nf-metro 2.1.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 nf-metro 2.1.0
File Size Uploaded
nf_metro-2.1.0.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nf-metro 2.1.0
File Interpreter ABI Platform
nf_metro-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.9 MB

Release files / nf_metro-2.1.0.tar.gz

Download URL nf_metro-2.1.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f415970b9c4b91629de0946a6eb1bf7826cde19a62ee80f6d83eb1cd6955e21e
BLAKE2b-256 checksum
How to use checksums
9f81683ca907206df523d449120e301cbbe3767c7bc60d69196ff7db01b93503
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 15, 2026.

Transparency log

Release files / nf_metro-2.1.0-py3-none-any.whl

Download URL nf_metro-2.1.0-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d3fa5bdef156591f0dcc79b86793228fb4a8f825642941befb8729cf5c2a2f05
BLAKE2b-256 checksum
How to use checksums
466bedf26d76843c71d5538e7f4780961eaae198fe769dee021ce2ceb71a583d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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