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.1.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.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 808cac8bd7a515bfec38659de9d68755eb4c4dee534d09dcb73f598b4ad4a750
MD5 e6790b30fb72b9299488305464d7a7b9
BLAKE2b-256 a16f70e34904d2f6712cc5291cae6827fde745bfa9d1aab7fef019cfc98639c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: multiqc_mapper-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c8a36fe071edbe8fc19bda241a88463cd7edfb856f824da31ce79b3d8e37377
MD5 18824084ff6ec8b9ace0752b64a03945
BLAKE2b-256 c926aa1ff63f070cc6a92612ed6658cee42095dc83065b71dc171743ce2ec274

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