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

Uploaded Python 3

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.2.tar.gz
  • Upload date:
  • Size: 72.8 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.2.tar.gz
Algorithm Hash digest
SHA256 8d78f1d74dfd3e27f4853173ba6d7de47e8b03dcadf4b712628b548e11de876b
MD5 f69faecb4a455361c9e2895fc466a3d1
BLAKE2b-256 03089d6a35f4c2448efb79ed9516e384533563d6ca1aa2a9a19bda20f994c3db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c06583b3ffaac7bb1ac7ba091bcb0cdc900be4b265855bb43d5b71b7de7f4e
MD5 f93fc3f87d361efde721e3de284d13e9
BLAKE2b-256 0aa9e89d04b150f2c28b786d2474b0ff96c1bb8d07cd5e062ab4a1d358dd79ea

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