Skip to content

3.0.0 - theme stacks, transit themes, Snakemake input

Choose a tag to compare

@pinin4fjords pinin4fjords released this 25 Nov 18:57
d5252fd

A rebuilt theme system with stackable theme files and five transit-agency themes, Snakemake input, and a tidy-up of the public surface that makes this a major release.

Theme stacks and theme files

%%metro style:, --theme and a per-output theme= take a comma-separated list of built-in names and YAML theme files, merged left to right over the default base. A theme file sets any field of the theme schema for both palettes, extends other themes, and can set look-related layout options in a layout: block. Every built-in theme is itself such a file, and a JSON Schema ships with nf-metro so editors can complete and check them. See the Themes page.

Themes can now set station and section shapes (tab-and-ring station glyphs, outline width and dash, number badges, legend frame), line-end glyphs (nub, bar, ring), the colours lines take (line_colors), and a long list of values that used to be fixed.

Five transit themes ship in the box, each after its operator's published standards: london-tube, nyc-subway, paris-metro, tokyo-metro and washington-metro.

curve_radius_ratio sets the corner radius as a multiple of the theme's line width, as a directive, a --curve-radius-ratio flag or a theme layout: option.

Snakemake input

nf-metro render --from snakemake and nf-metro convert turn snakemake --rulegraph or --dag output into a metro map. This is experimental. nf-metro convert --lines graph|sections chooses how a converted map's lines are drawn.

Other additions

  • %%metro number: 0 hides a section's number badge, and a subgraph whose ID starts with _ is a hidden section that keeps its grid cell but draws no box.
  • %%metro output: paths take per-output overrides (animate, mode=, theme=, scale=, raster_width=), so one nf-metro render pass writes a static SVG, an animated SVG and a light/dark PNG pair.
  • The interactive HTML page follows the map's mode, and moves its legend under the map on narrow viewports.

Routing and layout

Concentric arc corners: parallel lines turning together share one centre and draw as circular arcs, so bundles keep their lines touching through a turn. Animated dots ride the drawn strokes, and share forks fairly. Fanned bundles stay concentric at wide line widths. Several source-fork, merge-feeder and bypass placements were fixed (#2170, #2175, #2192, #2193, #2199, #2209), and directional chevrons follow their strokes through corners (#2177).

Breaking changes

This release cleans up names and defaults ahead of a stable public surface. The full list is in the changelog. The ones most likely to need action:

  • Theme names. nfcore is now default (a map that still says %%metro style: nfcore warns and renders the same). light is transparent, and the dark, light and mode-suffixed names are gone: pick the palette with --mode or %%metro mode:. An unknown name passed to --theme raises an error.
  • Dependencies. rich, rich-click, pyyaml and jsonschema are core dependencies, and the validate extra is gone. A recipe or lockfile that lists dependencies by hand must add them.
  • CLI. --from-nextflow is now --from nextflow. nf-metro render prints the paths it wrote as YAML on stdout.
  • Action and hook. The GitHub Action and pre-commit hook no longer force --theme default, so a map's own %%metro style: applies in CI.
  • Hidden sections. A section whose ID starts with _ no longer draws a box.
  • Python API. Theme fields are renamed, Theme is frozen, resolve_theme(graph, mode=None) replaces the old signature, render_string takes options only through config=RenderConfig(...), and the manifest API moved to nf_metro.manifest.

Known issues

  • variant_calling.mmd has a known layout defect (#1863)
  • variantbenchmarking.mmd / variantbenchmarking_auto.mmd: an sv_stats/bcftools_stats label collision nudge (#1863)
  • legend_combo.mmd: a Somatic Calling label collision nudge (#1863)