Skip to content

Refactor feature/psm PK and improve DuckDB CTE safety - #227

Merged
ypriverol merged 110 commits into
mainfrom
dev
Aug 5, 2026
Merged

ypriverol merged 110 commits into
mainfrom
dev

Conversation

@ypriverol

@ypriverol ypriverol commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

This pull request introduces several important updates to the QPX data model, documentation, and CI workflow. The main changes include a new, comprehensive data model reference, a breaking change to feature and PSM primary keys, expanded documentation for OpenMS consensusXML conversion, and a new CI job to test the declared DuckDB version floor. These updates clarify key concepts, improve documentation usability, and strengthen contract testing for dependencies.

Data model and documentation improvements:

  • Added a new docs/spec/data-model.md page that defines all core QPX terms, diagrams the entity relationships and quantification units, and explains how measurements flow from raw files to protein group quantities. This serves as the central conceptual reference for the data model.
  • Updated the main spec index and intensities documentation to reference and align with the new data model, clarify the flattening of protein group intensities (since QPX 1.1), and highlight primary key rules and relationships. [1] [2] [3] [4]

Feature and PSM primary key update (breaking change):

  • Changed the primary keys for the feature and psm views to use [peptidoform, charge, run_file_name, rt] and [peptidoform, charge, run_file_name, scan] respectively, replacing the previous keys that included sequence and anchor_protein. This resolves ambiguity and ensures uniqueness in real datasets. [1] [2]

OpenMS consensusXML conversion documentation:

  • Documented the new openms-consensus converter, which transforms OpenMS .consensusXML files (plus SDRF) to QPX format. The documentation details its interim status, parameters, usage, and output files, clarifying that protein group intensity is not emitted until upstream support is available. [1] [2]

Continuous integration improvements:

  • Added a unit-tests-duckdb-floor CI job to .github/workflows/python-app.yml. This job pins DuckDB to the declared minimum supported version (1.3.0) and runs the test suite to ensure compatibility with the dependency floor, not just the latest version.

Summary by CodeRabbit

  • New Features

    • Added OpenMS consensusXML conversion to QPX feature, PSM, protein-group, run, and sample outputs.
    • Added SDRF-based run and fraction-group mapping.
    • Added comprehensive data-model and conversion documentation.
  • Breaking Changes

    • QPX 1.1 flattens protein-group intensities into per-label rows.
    • Feature and PSM primary keys have changed; existing files must be regenerated.
  • Bug Fixes

    • Improved dataset compatibility handling, mapping validation, LFQ joins, protein exports, and isobaric-channel detection.
  • Tests

    • Expanded coverage for conversion, compatibility, mappings, identifier parsing, and DuckDB 1.3.0.

Shen-YuFei and others added 30 commits July 22, 2026 00:40
Feature PK [sequence,charge,run_file_name,anchor_protein] ->
[peptidoform,charge,run_file_name,rt]. Measured on 5 real files (~13M rows):
anchor_protein is functionally redundant (0 keys with >1 anchor); rt (apex) is
the only populated RT column and resolves the co-eluting peaks a single
peptidoform+charge produces per run. psm PK sequence->peptidoform (scan already
resolves per-spectrum identity). Both schema mirrors + feature.md updated.

BREAKING CHANGE: feature/psm primary keys changed; regenerate under >=1.1.
On the declared floor (duckdb>=1.1.3) a plain CTE inlines, so the two references
to numbered_pg would number rows independently and the pg_row_id join could
mispair. AS MATERIALIZED forces a single evaluation. Adds a CI job pinning
duckdb==1.1.3 so the floor is actually exercised (CI otherwise runs latest).
… changelog

- Sync docs/spec/schemas to qpx/core/data/schemas (doc-string drift Timo flagged)
- test_schema_mirrors_are_byte_identical: fail CI if the two mirrors drift again
- pg.md: grouped_runs is a distinct set compared set-wise, stored in fraction
  order (not sorted — sorting misorders F1,F10,F2 and loses fractions)
- versioning.md + CHANGELOG: 1.1 feature/psm PK change + OpenMS regen disclosure
The pg view is re-keyed from one row per (anchor_protein, grouped_runs) carrying
an intensities list<{label,intensity}> to ONE ROW PER LABEL with scalar label +
intensity columns; PK -> (anchor_protein, grouped_runs, label). label is nullable
(null only for identification-only groups with no quantity, e.g. mzIdentML).

Rationale (agreed on PR #220): flat scalar columns give columnar predicate
pushdown on label (the TMT/DIA hot path) and make the double-count check a plain
GROUP BY. Chosen over a nested list<struct> and over keeping the old shape.

Design:
- Centralized explode in PgWriter (write_batch + write_table): converters keep
  producing the natural intensities list; the writer materializes the flat rows.
  Zero converter changes. additional_intensities filtered to each row's label.
- Consumers rewired off UNNEST(intensities): mudata protein queries + label/
  multiplex detection, dataset abundance SQL + grouped_runs->sample validator,
  views ProteinView, core/data/pg.py. list_distinct(grouped_runs) so a repeated
  run counts once.
- Validators (schema.py, pg-only, join-free): run_double_count (run-disjointness:
  within one (anchor_protein,label) every run is in exactly one row) and
  duplicate_grouped_run (grouped_runs is a set of distinct files).
- channel_labels: relabel the flat scalar pg label (OpenMS bare index -> canonical).
- Docs: pg.md PK prose (label nullable, run-disjointness); schema mirror synced.

Tests updated to the flat shape (diann/fragpipe/cdap/openms converters, mudata_sql,
views, dataset, conftest). Full unit + integration suites green (the 7 quantms
subprocess tests fail on main too: bare 'python' not on PATH, unrelated).

BREAKING CHANGE: pg intensities column removed; pg files must be regenerated under >=1.1.
…oft dataset

Phase 4 (de-scoped per maintainer: no 1.0.0 gold-plating). Three goals:
- parse_spec_version never raises on garbage ('v1.1', '', None, 'abc') -> None
- Dataset discovery (_discover_local/_discover_s3) is fail-soft: an incompatible
  or unreadable structure file is warned + skipped, not an unhandled crash at
  __init__, so the dataset's other structures stay usable
- pre-1.1 scalar-run_file_name pg files still raise a clear 'regenerate with >=1.1'
  error on the standalone read_pg / PG.from_file path

Dropped (out of scope): hybrid-file, Hive-legacy, forward version bound, migration.
#5)

FragPipe/MaxQuant previously fell back to a dangling [experiment] token for
grouped_runs when no experiment->runs result mapping was available, silently
dropping those pg rows from every sample-joined view. Replace that with:
results mapping (experiment_annotation.tsv / evidence.txt) -> SDRF 'source name'
grouping -> clear error. No dangling token is ever emitted.

New shared helper channel_labels.experiment_runs_from_sdrf(sdrf_path) maps each
SDRF source name to its raw-file stems (distinct, fraction order preserved).
Wired as the fallback in both pg adapters (fragpipe gains sdrf_path; maxquant
already had it). Tests: error case + SDRF-fallback case + direct helper test;
existing grouping-agnostic fragpipe tests now pass an explicit experiment_to_runs.

BREAKING CHANGE: FragPipe/MaxQuant pg conversion without an experiment->runs
mapping or SDRF now raises instead of emitting an [experiment] token.
…hema change

Per maintainer decision: don't change OpenMS ArrowSchemaRegistry. OpenMS and QPX
share the fraction_group concept (a group of fraction raw files quantifying one
protein = grouped_runs). The OpenMS converter already stamps a fraction_group
cv_param on each pg/feature row from the consensusXML design, preserving the
grouping via a shared cv term with no OpenMS schema change.
Must-fix:
- feature.rt marked required (non-null): it's a PK field, but the writer only
  rejects nulls on non-nullable columns, so null-rt PK rows wrote silently.
- version guard now detects the flatten: a file with grouped_runs but the OLD
  intensities list and no scalar label/intensity (pre-flatten 1.1) is rejected,
  instead of passing the grouped_runs check and then failing every pg query.
- CI DuckDB-floor job: 'uv run --no-sync' so the duckdb==1.1.3 pin is not undone
  by a re-sync (the job was silently running the latest DuckDB).
- pg referential validators no longer fail silently: on a query error they log a
  warning AND append a visible validation issue (possible schema drift), instead
  of a debug-level swallow — the pattern that hid last release's bug.

Should-fix:
- Spectronaut emitted label='raw' vs run.samples label='LFQ' -> broken (file,label)
  -> sample join; now emits 'LFQ' like every other LFQ producer (pg + feature).
- pg.md updated to the flat layout (scalar label/intensity, correct PK marking,
  JSON example); versioning.md 1.1 changelog now documents the flatten.

Audit-confirmed clean: no live column drift on the current path, mirrors identical,
producers emit the schema field set, OpenMS relabel validates before copy.
… ruff format

The prior 'rt required' hardening broke the FragPipe feature adapter, which
reports no per-feature retention time (combined_ion.tsv) -> 4 CI failures
('Column rt has N nulls but is required'). rt is the RT component of the feature
PK and is populated by DIA-NN / OpenMS-quantms / TMT, but not FragPipe, so it
cannot be a hard non-null requirement across producers. Reverted to nullable;
docs note the key degenerates for producers without RT. Also ran ruff format on
three test files (pre-commit was red on formatting).
… map export)

The new duckdb-floor CI job (now actually testing the pinned version via
--no-sync) revealed the declared floor was never valid: DuckDB < ~1.3 emits Arrow
map columns with non-required keys, which pyarrow>=14 rejects
('Map keys must be annotated as required'), failing test_collection physical-merge
and test_pride enrich — code paths unrelated to the 1.1 pg work. Raise the
declared floor to the version we actually validate green (1.3.0) and pin the floor
job to it, so the floor is an honest, tested contract.
New docs/spec/data-model.md: a single conceptual reference for the whole model —
vocabulary table (run/sample/channel/label/fraction/grouped_runs/quantification
unit/peptidoform/anchor_protein/intensities defined once), a measurement-flow
diagram (run -> psm -> feature -> pg), an entity-relationship diagram with the
join keys, quantification-unit diagrams (LFQ fractionation + TMT channels), and a
label->sample resolution diagram. Linked from the spec nav + index.

Also fixes doc<->schema contradictions the audit/agent found: views.md unnested
the removed pg.intensities list (rewritten to scalar label/intensity); intensities.md
and four pg.md converter-mapping rows still pointed at the pg intensities list;
pg.md PK note now states the label nullable-PK exception. Motivated by the flatten
bug slipping through — the model is now explicit and diagrammed.
…ionated data)

The quantms pg_adapter aggregated features per (anchor_protein, run_file_name),
so grouped_runs was always single-element and fractionated datasets produced one
dangling pg row PER FRACTION instead of one aggregated row per quantification
unit. Proven on real PXD007683-TMT (11 fractions x 11 channels): 567,094 rows /
121-per-protein, all grouped_runs size 1.

Fix: new channel_labels.fraction_groups_from_sdrf maps each raw file to its
quantification unit — files differing only in fraction (same source/label/bio-rep/
tech-rep) group together; tech-reps stay separate. The pg aggregation key becomes
that fraction-group (injected via a DuckDB join + _group_key sort), so
_build_single_pg receives all fractions of a unit and aggregates across them;
grouped_runs = the unit's files. Threaded sdrf_path through the converter. Falls
back to per-run when no SDRF (unfractionated behavior unchanged).

Validated end-to-end on PXD007683-TMT: 106,205 rows, ALL grouped_runs size 11,
11 rows/protein (one per channel, intensity summed across fractions); pg labels ==
run.samples labels and grouped_runs members resolve to run.run_file_name (the
(file,label)->sample join works). Full unit suite + ruff green.

BREAKING CHANGE: fractionated quantms pg now groups fractions into one
quantification unit; regenerate affected pg files.
… fan-out + msstats-bounded pagination)

Two compounding data-corruption bugs in the quantms feature converter (measured on
real PXD007683-LFQ):

- _protein_qvalues and _protein_genes were SELECT accession,... FROM proteins with
  NO dedup, but the mzTab protein section lists an accession in several rows
  (single-protein + group). The feature LEFT JOINs on accession therefore fanned
  each feature out into multiple rows (2x distinct q-value x 2x identical gene =
  ~4x). => 49.8% exact-duplicate feature rows, and the pg view summed the dupes
  (~4x inflated protein quant). Fix: GROUP BY accession (min q-value, one gene).
- The streaming loop bounded pagination by COUNT(*) FROM msstats while iterating
  the fanned-out join, so once the join exceeded the msstats row count everything
  past it was silently dropped: output was exactly LIMIT=500000 rows and 70% of
  features (298,691 of 425,594) vanished with no error. Fix: paginate by the
  join's own cardinality (stop when a chunk is short), independent of msstats.

Validated on PXD007683-LFQ: 425,594 feature rows (== msstats source), 0 exact
duplicates, 0 duplicate PKs (was 500,000 truncated, 49.8% dup, 127,404 dup-PK
groups). Pre-existing bugs (feature_adapter untouched by the format-1.1 work);
surfaced by the format review. 42 quantms/feature tests green.

BREAKING CHANGE: LFQ quantms feature/pg quantities change (were corrupted); regenerate.
…(pg identification-only)

New qpx.converters.openms_consensus package + qpxc convert openms-consensus CLI.
Interim quantms production path while OpenMS -out_qpx is still format 1.0 (see the
OpenMS-team note on PR #224). Reads the consensusXML via pyopenms:

- feature: one row per (peptidoform, charge, run, rt) with the per-run/channel
  peptide intensities from <element it=...>; OpenMS map labels (tmt6plex_126)
  canonicalized to QPX (TMT126); label-free -> LFQ. Feature quant is KEPT.
- psm: one row per PeptideIdentification hit (scan from spectrum_reference, PEP,
  decoy), run resolved via map_index / sole-run.
- pg: protein groups from the inference graph (indistinguishable groups or hits),
  peptide counts from evidence links, grouped_runs from the SDRF fraction groups.
  IDENTIFICATION-ONLY: label + intensity are null (the consensusXML has no
  protein-level abundance; that lived only in the mzTab) until OpenMS -out_qpx
  provides the authoritative protein quant.
- run/sample via SdrfConverter when an SDRF is given.

Validated end-to-end on a real TMT consensusXML (1569 feature / 1608 psm / 720 pg
rows, feature carries channels, pg intensity all null, Dataset opens all views).
Unit test builds a synthetic ConsensusMap via pyopenms.
…multi-run verified)

- to_proforma(): OpenMS AASequence -> ProForma (.(UniMod:737)SEQ(UniMod:35) ->
  [UNIMOD:737]-SEQ[UNIMOD:35]), N/C-terminal + internal mods; feature/psm now emit
  ProForma peptidoforms and the bare sequence via toUnmodifiedString() (was
  leaking 'UNIMOD' letters into the stripped sequence). Unit-tested.
- pg: emit a protein group only for the quantification units where it was
  actually identified (its peptides appear in a run of that unit), not every unit
  — via a new accession->runs map. On real PXD001819: 29,808 -> 22,575 pg rows
  (avg 20.4 units/group, was all 27).

Verified on real data: multi-run PXD001819 (27 runs) — 113,160 features across all
27 runs, all 331,318 PSMs resolve to a run (0 dropped) via map_index; full
conversion with matched SDRF has feature/pg grouped_runs all resolving to
run.parquet, pg intensity all null (identification-only).
… graph

- psm: route the identification score into additional_scores (q-value when the
  score_type IS a q-value, else the named search score) + consensus_support;
  keeps posterior_error_probability. The psm schema has no dedicated q-value
  column, so it lives in additional_scores.
- pg: is_decoy now comes from the ProteinHit target_decoy meta (falls back to the
  accession prefix) — on real TMT this flags 152 decoys the prefix-only check
  missed; global_qvalue from the protein hit score when the protein score_type is
  a q-value (null otherwise). Still identification-only (no intensity).
…ontaminant

- feature: one intensity entry per label per run (keep max if a channel links
  twice) instead of appending — avoids the duplicated-channel double-count the
  format review flagged. Verified 0 duplicate-label feature rows on real TMT.
- pg: add peptide_counts (unique/total sequences) and the contaminant flag
  (CONTAM in accession).
- channel_labels.fraction_groups_from_sdrf: extract _sdrf_unit_columns,
  _collect_run_signatures, _safe_fraction (was complexity 18 / 14 branches).
- openms_consensus.pg_adapter.consensus_protein_groups_to_records: extract
  _protein_hit_meta + _build_groups + _acc_str (was complexity 16 / 51 statements).
- quantms.pg_adapter: initialize _run_to_grouped in __init__ (was set only in
  convert()). Behavior unchanged; 47 targeted tests green.
… pg exploder + CI-portable test fixture

The interim consensusXML->QPX pg now emits one row per (protein group, unit,
label) with a null intensity — creating the per-channel quantification slots the
OpenMS-team -out_qpx will later fill, instead of collapsing the channel
dimension to a single label-null identification row.

- pg_adapter: derive labels from the ConsensusMap column headers (isobaric
  channels via _canonical_channel; 'LFQ' for label-free) and loop over them.
- writers/pg: _explode_pg_records no longer clobbers pre-flattened records —
  a record with a scalar label/intensity (no intensities list) passes through
  instead of being forced to null. This was silently nulling the new labels.
- test: replace the pyopenms-built ConsensusMap with a literal consensusXML
  fixture so the test exercises only the read path and is immune to pyopenms
  setter-API drift (list vs PeptideIdentificationList) seen on CI.
…functions

Lower the three new-file functions Codacy counts as added complexity issues
below the CC-10 threshold, behavior-preserving (73 tests pass; real TMT still
yields 1569 features / 1608 psms / 4320 pg rows with all 6 TMT channels):

- pg_adapter._protein_maps: lift the two nested closures to a _ProteinMaps
  accumulator class + module-level _evidence_accession / _unassigned_run helpers.
- feature_adapter: extract the per-run sub-feature grouping into
  _group_subfeatures_by_run.
- channel_labels.parse_consensusxml_maplist: move the iterparse branch dispatch
  into a _MapListParser state class.
Codacy's quality gate (0 new issues) was tripped by 5 style/lint issues, not the
cyclomatic complexity the earlier refactor chased (complexity is a separate,
non-gated Codacy section) — so that refactor is reverted (prior commit) and the
actual flagged issues are fixed:

- cli/convert.py: drop the redundant local 'import logging' (shadowed the
  module-level import) — clears redefine + reimport.
- openms_consensus/converter.py: add the missing convert() docstring and a
  targeted too-few-public-methods suppression (single-entry orchestrator class,
  symmetric with the other converters which only pass the rule as pre-existing
  code).
- docs/guide/convert.md: pad the parameters-table delimiter row to match the
  header row's pipe spacing.
…pters

The consensusXML load dominated convert() cost, and the feature/psm/pg adapters
each re-parsed the same file — three full parses. Load it once and pass the
in-memory map to all three (they only read it). Real TMT convert() drops from
~1.0-1.3s to ~0.52s (>2x), with byte-identical output (1569 feature / 1608 psm /
4320 pg rows, all 6 TMT channels).

- feature_adapter: add load_consensus_map() as the single parse point; each
  *_to_records() now accepts either a path or a pre-loaded cm.
- converter.convert(): load the map once when any of feature/psm/pg is requested
  and thread it through. Path-based adapter calls still work (fallback kept).
Shen-YuFei and others added 2 commits August 5, 2026 03:19
feat(schema): mandatory identity ids (feature_id/psm_id/pg_id) + optional cross-refs
@ypriverol
ypriverol requested review from Shen-YuFei and daichengxin and a lite review from Copilot August 5, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates QPX’s data model and serialization contract by introducing mandatory opaque identity IDs (feature_id/psm_id/pg_id), flattening PG quantification to scalar label/intensity, and aligning converters, readers, and documentation to those breaking changes. It also adds OpenMS-focused conversion paths (native -out_qpx enrichment and consensusXML conversion), removes the QuantMS/mzTab converter, and strengthens CI by testing the declared DuckDB minimum version.

Changes:

  • Introduce derived opaque primary keys and identity composites for feature, psm, and pg, with updated validation and version guards.
  • Flatten PG quantification (one row per label) and update SQL/view logic and downstream tests accordingly.
  • Expand OpenMS support (native QPX enrichment + consensusXML converter), update docs/CLI, and add a CI job that runs tests on DuckDB 1.3.0.

Reviewed changes

Copilot reviewed 109 out of 117 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/test_writers.py Update writer tests for new identity fields
tests/unit/test_version.py Expand version-guard tests and soft-skip behavior
tests/unit/test_validate.py Validate derived pg_id behavior and ordering invariance
tests/unit/test_transform_prefix.py New tests for dataset prefix discovery + metadata update
tests/unit/test_schema.py Add byte-identical schema mirror drift guard
tests/unit/test_mudata_sql.py Adjust SQL whitelist assertions for flattened PG
tests/unit/test_mappings.py Remove QuantMS-specific mapping/extra tests
tests/unit/test_gene_mapping.py New regression test: preserve feature identity on annotation
tests/integration/test_views.py Update manual SQL to flattened PG columns
tests/integration/test_dataset.py Adjust legacy-join test for flattened PG behavior
tests/examples/quantms/dda-lfq-full/PXD007683-LFQ.sdrf_openms_design.tsv Remove QuantMS example design TSV
tests/converters/test_quantms_tmt_channels.py Remove QuantMS TMT channel labeling tests
tests/converters/test_quantms_converter.py Remove QuantMS converter integration tests
tests/converters/test_pep_protein_resolution.py Remove QuantMS peptide→protein resolution tests
tests/converters/test_openms_converter.py Add coverage for OpenMS legacy upgrade + flattened PG
tests/converters/test_openms_consensus.py New tests for consensusXML conversion and identity
tests/converters/test_mzidentml_converter.py Assert uniqueness of emitted psm_id
tests/converters/test_fragpipe_converter.py Require grouped-runs mapping; SDRF fallback behavior
tests/converters/test_diann_converter.py Update PG expectations for flattened layout
tests/converters/test_converter_utils.py Add UniProt parsing helper tests
tests/converters/test_channel_labels.py Refocus channel-label tests + add SDRF grouping tests
tests/converters/test_cdap_converter.py Update PG intensity validation for flattened PG
tests/conftest.py Update shared PG table assertions for flattened schema
tests/cli/test_cli.py Remove QuantMS CLI help; add prefix discovery coverage
README.md Update supported converter list and CLI synopsis
qpx/writers/pg.py Flatten PG at write-time via explosion helper
qpx/writers/feature.py Feature ID derivation + unidentified ID namespacing
qpx/views/api.py Make DuckDB CTE materialized; use flattened PG joins
qpx/version.py Make version parsing non-raising; detect pre-flatten PG
qpx/transforms/utils.py Add discover_qpx_file_prefix helper
qpx/transforms/sdrf_updater.py Preserve discovered prefix + backup naming
qpx/transforms/gene_mapping.py Preserve source identity composite on rewritten features
qpx/mudata.py Update label/intensity queries for flattened PG
qpx/core/data/schemas/psm.yaml Switch PK to psm_id; add identity composite + feature_id
qpx/core/data/schemas/pg.yaml Switch PK to pg_id; flatten label/intensity
qpx/core/data/schemas/feature.yaml Switch PK to feature_id; add xrefs + new optional fields
qpx/core/data/schema.py Add pg referential validation + identity_composite metadata
qpx/core/data/pg.py Remove intensities-struct detection; flattened PG query
qpx/core/data/loader.py Plumb identity_composite from schema YAML
qpx/core/data/identity.py New canonical composite encoding + BLAKE2b id derivation
qpx/converters/utils.py Replace scan helpers with UniProt parsing utilities
qpx/converters/spectronaut/pg_adapter.py Emit LFQ label for primary intensity
qpx/converters/spectronaut/feature_adapter.py Set producer-specific feature identity composite
qpx/converters/quantms/converter.py Remove QuantMS orchestrator
qpx/converters/quantms/init.py Remove QuantMS exports
qpx/converters/orchestrator.py Update docstring after QuantMS removal
qpx/converters/openms/converter.py Streamed core rewrite + strict validation + identity stamping
qpx/converters/openms_consensus/psm_adapter.py New consensusXML→PSM extraction
qpx/converters/openms_consensus/feature_adapter.py New consensusXML→Feature extraction + channel parsing
qpx/converters/openms_consensus/init.py New package exports and interim-path docs
qpx/converters/mzidentml/psm_adapter.py Derive stable psm_id from source SII ids
qpx/converters/maxquant/pg_adapter.py Enforce experiment→runs mapping; SDRF fallback
qpx/converters/maxquant/feature_adapter.py Producer-specific identity composite + UniProt stripping
qpx/converters/maxquant/base_adapter.py Centralize UniProt prefix stripping helper
qpx/converters/fragpipe/pg_adapter.py Enforce experiment mapping; SDRF fallback; no dangling tokens
qpx/converters/fragpipe/converter.py Remove peptide-file option; ion-file only for features
qpx/converters/diann/feature_adapter.py Producer-specific feature identity composite
qpx/converters/column_mappings.yaml Remove QuantMS mappings; update FragPipe columns
qpx/converters/channel_labels.py SDRF run/fraction grouping helpers + table relabeling
qpx/converters/cdap/peptidoform.py Remove label-token logic; simplify imports
qpx/converters/cdap/feature_adapter.py Producer-specific identity composite for features
qpx/converters/cdap/converter.py Minor linting/structure cleanup
qpx/converters/cdap/base_adapter.py Remove unused CDAP meta-column helpers
qpx/converters/base.py Remove unused TSV/query helper methods; doc cleanup
qpx/converters/init.py Remove QuantMS exports; doc cleanup
qpx/cli/transform.py Prefix-aware accession normalization targeting
qpx/cli/main.py Update CLI usage example
qpx/cli/convert.py Remove QuantMS CLI; add openms-consensus CLI
pyproject.toml Bump DuckDB minimum version to 1.3.0
mkdocs.yml Add Data Model page to spec navigation
docs/spec/views.md Update example SQL for flattened PG
docs/spec/versioning.md Document flattening + identity changes in 1.1
docs/spec/tool-mappings.md Remove mzTab column mapping references
docs/spec/serialization.md Document primary_key + identity_composite metadata
docs/spec/schemas/psm.yaml Spec mirror updates for PSM identity + xref
docs/spec/schemas/pg.yaml Spec mirror updates for flattened PG + identity
docs/spec/schemas/feature.yaml Spec mirror updates for feature identity + xrefs
docs/spec/psm.md Document psm_id and identity composite
docs/spec/pg.md Document pg_id and flattened quantification
docs/spec/intensities.md Clarify feature vs PG intensity representations
docs/spec/index.md Link to detailed Data Model reference
docs/spec/feature.md Document feature identity semantics and xrefs
docs/spec/converter-coverage.md Update converter matrix for OpenMS paths
docs/llms.txt Update high-level product summary for OpenMS
docs/llms-full.txt Update CLI/API examples to OpenMS paths
docs/index.md Update supported formats table and messaging
docs/images/qpx-architecture.svg Update architecture diagram input format label
docs/guide/index.md Update guide overview for OpenMS conversions
docs/guide/convert.md Replace QuantMS docs with OpenMS sections
CHANGELOG.md Document identity/flattening changes and QuantMS removal
.gitignore Stop ignoring removed conversion script
.github/workflows/python-app.yml Add DuckDB floor unit-test job
.github/workflows/integration-tests.yml Simplify integration workflow; remove QuantMS suite
Suppressed comments (1)

qpx/writers/feature.py:44

  • When namespacing producer-supplied IDs for unidentified features, the code assumes either run_file_name or quantification_unit_id is present in composite_values. If an identity_composite override omits both, this will crash with a KeyError. Raise a clear error instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread qpx/converters/channel_labels.py Resolved
Comment on lines +194 to +199
run_to_grouped: dict[str, list[str]] = {}
for members in groups.values():
ordered: list[str] = []
for run in sorted(members, key=lambda r: (fraction.get(r, 0), first_seen.index(r))):
if run not in ordered:
ordered.append(run)
Comment thread qpx/writers/pg.py
Comment on lines +75 to +79
exploded = _explode_pg_records(table.to_pylist())
# Build with a nullable id; super().write_table derives pg_id.
relaxed = self._relaxed_id_schema()
batch = pa.RecordBatch.from_pylist(exploded, schema=relaxed)
super().write_table(pa.Table.from_batches([batch], schema=relaxed))
Comment thread qpx/writers/feature.py
Comment on lines +17 to +19
def _should_override_provided_id(self, index: int, composite_values: dict[str, list]) -> bool:
"""Use the natural composite only for identified Features."""
return self._override_provided_ids and bool(composite_values["peptidoform"][index])
Shen-YuFei and others added 3 commits August 5, 2026 03:48
…ents

The run resolver looked up a PeptideIdentification's id_merge_index against
the global map columns. In a multi-run isobaric (TMT/iTRAQ) consensusXML that
index is a LOCAL per-run channel index (0..k-1), so every PSM collapsed onto
the first run (a05059) and 90% of feature<->psm cross-references were lost.

Prefer the global map_index when present (label-free). For assigned PIDs whose
id_merge_index is only local, attribute the run from the consensus feature's
positive-intensity elements (the same source the feature view uses), so a PSM
record lands on the same run_file_name as the feature it links to.

Co-Authored-By: Claude <[email protected]>
@ypriverol ypriverol linked an issue Aug 5, 2026 that may be closed by this pull request
daichengxin and others added 3 commits August 5, 2026 21:25
… elements

The feature adapter's _scan_by_run resolved a PID's scan via its global
map_index (label-free) or the sole run. A multi-run isobaric (TMT/iTRAQ)
consensusXML carries no global map_index on its PIDs — only a local per-run
id_merge_index — so every feature.scan was left empty even though each such
feature lives in exactly one run with a spectrum_reference scan.

Pass the feature's positive-intensity element runs (the same source the feature
view uses) so the scan is attributed to that single run, matching psm.scan.

Co-Authored-By: Claude <[email protected]>
Fix various issues in converters, metadata, and OpenMS handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants