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.2.0.tar.gz (72.7 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.2.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.0.tar.gz
  • Upload date:
  • Size: 72.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for multiqc_mapper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 205b07ce27c908f7c2c09ea6743ee2a8ba92678eba9c4f8d5d5b5f08e757b0f2
MD5 ba1e0bf8d8b319f9820dde0d1abd293e
BLAKE2b-256 cf4ca481a1742687c491d77d656b7fcbb5b198d055e05ec59ae09fd6876d9dda

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for multiqc_mapper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a39b68650130d4c107bb5cc6130149d71f1c1ade83a4e4e7fac4968fbbd3cd
MD5 5d894f47a8ce90bfbb00423340540a39
BLAKE2b-256 52b9b980fa52045d8a4b665548d788caedb145cef53a067c9e966cde717be0c7

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