Skip to main content

Normalize MultiQC metrics across tools into a unified long-format table

Project description

multiqc-mapper

Normalize MultiQC metrics across tools into a unified long-format table.

MultiQC parses each tool independently. This package adds a semantic mapping layer so that equivalent metrics (e.g. "total reads" from samtools and RSeQC) resolve to a single canonical concept.

Install

uv add multiqc-mapper          # inside an existing uv project
uv tool install multiqc-mapper # as a standalone CLI tool

Quickstart

# 1. Auto-discover all metrics from a MultiQC output directory
multiqc-mapper discover ./multiqc_data -o concepts.yaml

# 2. Edit concepts.yaml — merge equivalent cross-tool metrics under one key

# 3. Validate the mapping is complete
multiqc-mapper validate ./multiqc_data concepts.yaml

# 4. Resolve to a unified long-format table
multiqc-mapper resolve ./multiqc_data concepts.yaml -o unified.tsv

Python API

from multiqc_mapper import ConceptRegistry, resolve

registry = ConceptRegistry.from_yaml("concepts.yaml")
df = resolve("./multiqc_data", registry)

# One row per (sample, concept, tool)
df[df["concept"] == "total_reads"]
#    sample     concept     tool              metric  val_raw unit
# ERR188383 total_reads samtools raw_total_sequences  98732.0 reads
# ERR188383 total_reads    rseqc       total_records 100826.0 reads

Output schema

column description
sample Sample name
concept Canonical concept key from concepts.yaml
tool Tool that reported this observation
anchor MultiQC anchor (plot/table id)
section_key MultiQC section key
metric Original MultiQC metric key
val_raw Raw numeric value
val_fmt Formatted display string from MultiQC
unit Unit from concept definition
title Human-readable metric title
description Metric description

concepts.yaml format

The mapping file is the single source of truth. Only anchor and metric under each source are used for resolution; all other fields are documentation.

version: "1.0"

concepts:
  total_reads:
    title: "Total reads"
    description: "Total reads in the BAM file"
    unit: reads
    category: alignment
    shared_key: read_count     # MultiQC shared_key (unit hint)
    notes: "samtools counts raw sequences; RSeQC counts BAM records"
    sources:
      - anchor: samtools-stats-dp
        metric: raw_total_sequences
        tool: samtools           # documentation only
        title: "Total sequences"
      - anchor: rseqc_bam_stat
        metric: total_records
        tool: rseqc
        title: "Total records"

To extend for a new tool: add a sources: entry to the relevant concept. To add a new concept: add a new top-level key under concepts:.

CLI reference

multiqc-mapper discover <multiqc_data_dir> [-o concepts.yaml]
multiqc-mapper resolve  <multiqc_data_dir> <concepts.yaml> [-o out.tsv] [--format tsv|csv|parquet] [--drop-unresolved]
multiqc-mapper validate <multiqc_data_dir> <concepts.yaml>
multiqc-mapper list-metrics <multiqc_data_dir> [--shared-key]

Requirements

  • Python ≥ 3.9
  • MultiQC ≥ 1.25 (parquet output required)

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

multiqc_mapper-0.1.0.tar.gz (75.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multiqc_mapper-0.1.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file multiqc_mapper-0.1.0.tar.gz.

File metadata

  • Download URL: multiqc_mapper-0.1.0.tar.gz
  • Upload date:
  • Size: 75.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for multiqc_mapper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 951f9251a5ecf5fb48a54afb8861b830c70d8a3ee7cadca4404590a0c2493bf0
MD5 c828f0f014db731e857ecaceebc3a426
BLAKE2b-256 350c19cdca564009753569d1db65aeae2c6e3936225a4b54600e45de30dbe319

See more details on using hashes here.

File details

Details for the file multiqc_mapper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: multiqc_mapper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for multiqc_mapper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d379faa5532212d2df26ca318acb1e57fbca3878fafff8300a08254738a23596
MD5 8d5c0c79485b0d48e6d77d2425ad6172
BLAKE2b-256 958be12d2f3dce328ae13d255fad581dd11d7d79f9cfa943c4d4e83f370b18e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page