Repository navigation
Fix various issues in converters, metadata, and OpenMS handling - #234
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 53 |
| Duplication | -7 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Pull request overview
This PR hardens QPX conversion and validation paths ahead of the dev → main release, focusing on converter correctness, identity/writer robustness, and improved OpenMS consensusXML handling and metadata normalization.
Changes:
- Improves converter correctness and integrity (e.g., OpenMS consensusXML PSM run attribution, MaxQuant evidence deduplication, FragPipe experiment detection, DIA-NN scan metadata merging).
- Hardens writer/export behavior (identity footer stamping for composite PKs, buffer discard on context-body errors, safer muData export that avoids partial artifacts).
- Normalizes and validates run naming and PG layout/version compatibility (shared
run_file_stem, stricter PG layout guards, additional validation tests).
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_writers.py | Adds writer regression tests for composite PK footer handling and buffer discard on context failure. |
| tests/unit/test_version.py | Expands PG layout compatibility tests and S3 discovery soft-fail behavior expectations. |
| tests/unit/test_validate.py | Adds validation regression test for grouped_runs duplicate handling. |
| tests/unit/test_mudata.py | Adds muData export tests for failure modes, temp cleanup, and modality requirements. |
| tests/unit/test_identity.py | Adds test ensuring override mode requires cv_params to preserve producer IDs. |
| tests/unit/test_data.py | Ensures strict validation promotes skipped cross-structure checks to errors. |
| tests/converters/test_ptm.py | Adds coverage for stripping modifications safely before upper-casing sequences. |
| tests/converters/test_openms_consensus.py | Adds OpenMS consensusXML conversion tests (structure validation, SDRF requirements, run attribution, LFQ labels, SQL param binding). |
| tests/converters/test_maxquant_converter.py | Adds MaxQuant PG/feature correctness tests (mapping failures, total intensity rejection, evidence dedup preference). |
| tests/converters/test_converters.py | Updates FragPipe peptide TSV fixture to include MaxLFQ intensity columns. |
| tests/converters/test_converter_utils.py | Adds unit tests for run_file_stem preserving meaningful dots and stripping known suffixes. |
| tests/converters/test_channel_labels.py | Adds test ensuring multi-dot run names survive SDRF mapping and run output. |
| qpx/writers/base.py | Fixes footer stamping for composite PKs, enforces override preconditions, and discards buffered rows on context exceptions. |
| qpx/version.py | Tightens PG layout guard: grouped_runs requires flattened label/intensity columns. |
| qpx/mudata.py | Uses shared run-stem normalization for run/sample joins in MuData assembly. |
| qpx/dataset.py | Drops incompatible S3-registered views safely via validated identifiers; adjusts strict-check behavior. |
| qpx/core/sdrf.py | Switches SDRF run-name normalization to shared run_file_stem. |
| qpx/core/files.py | Introduces shared run_file_stem helper for consistent run filename normalization across inputs. |
| qpx/converters/sdrf.py | Makes SDRF converter outputs optional (run/sample independently) and uses run_file_stem for run derivation. |
| qpx/converters/ptm.py | Adds strip_modifications helper to avoid modification-name letters leaking into sequences. |
| qpx/converters/orchestrator.py | Makes muData export atomic (tmp + replace) and avoids leaving stale/partial artifacts. |
| qpx/converters/openms_consensus/streaming.py | Minor streaming parser cleanup (unused iterparse event binding). |
| qpx/converters/openms_consensus/psm_adapter.py | Ensures assigned PSMs inherit parent ConsensusFeature run context for correct run attribution. |
| qpx/converters/openms_consensus/pg_adapter.py | Reuses shared run resolver for unassigned peptide run attribution in PG mapping. |
| qpx/converters/openms_consensus/feature_adapter.py | Uses shared run_file_stem and removes duplicated local run-stem logic. |
| qpx/converters/openms_consensus/converter.py | Validates requested structures/SDRF needs and writes only requested SDRF-backed outputs. |
| qpx/converters/mzidentml/psm_adapter.py | Normalizes spectra-data run stems using shared run_file_stem. |
| qpx/converters/mzidentml/pg_adapter.py | Improves run attribution and q-value extraction for mzIdentML protein groups. |
| qpx/converters/maxquant/psm_adapter.py | Stops swallowing row-transform errors (fail fast instead of partial output). |
| qpx/converters/maxquant/pg_adapter.py | Validates experiment→run mappings early and removes unsafe fallback grouped_runs behavior. |
| qpx/converters/maxquant/feature_adapter.py | Adds evidence dedup query (prefer identified over MBR duplicates) and propagates transform failures. |
| qpx/converters/fragpipe/feature_adapter.py | Excludes MaxLFQ intensity columns from experiment detection. |
| qpx/converters/diann/feature_adapter.py | Improves scan metadata merge by using scan+RT logic and bounded nearest matching. |
| qpx/converters/channel_labels.py | Uses shared run_file_stem for SDRF-derived run naming and signature collection. |
| qpx/converters/cdap/feature_adapter.py | Excludes ambiguous CDAP PSMs from feature-level quant aggregation when flagged. |
| qpx/cli/convert.py | Improves CLI help formatting for OpenMS consensus options. |
| docs/spec/data-model.md | Updates data model doc wording for peptidoform/charge identity semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sdrf = self.sdrf_table[["source name", "comment[data file]", "comment[label]"]].copy() | ||
| sdrf["comment[data file]"] = sdrf["comment[data file]"].str.split(".").str[0] | ||
| sdrf["comment[data file]"] = sdrf["comment[data file]"].map(run_file_stem) |
| sdrf_df = sdrf_df.copy() | ||
| sdrf_df["_run_file"] = sdrf_df[_COL_DATA_FILE].astype(str).str.split(".").str[0] | ||
| sdrf_df["_run_file"] = sdrf_df[_COL_DATA_FILE].map(run_file_stem) | ||
| sdrf_df["_file_name"] = sdrf_df[_COL_DATA_FILE].astype(str).str.strip() |
Summary
This PR hardens the current QPX
devbranch before thedev→mainrelease in #227. It consolidates converter-correctness fixes, output-integrity checks, OpenMS consensusXML improvements, and follow-up fixes for the mandatory identity implementation introduced in #232.Changes
Converter correctness
OpenMS consensusXML
ConsensusFeature, rather than resolving localid_merge_indexvalues as global map indexes.Output and validation integrity
.h5muartifacts.Mandatory identity follow-up
Addresses the findings tracked in #233:
primary_keyfooter metadata only when a single derived-id field exists, while retainingidentity_compositefor multi-column keys.override_provided_ids=Truebutcv_paramsis unavailable to preserve the producer ID.consensus_psms_to_records.The reported
read_parquet(?)concern was also verified against the supported DuckDB versions: bound file paths work correctly, so no SQL interpolation or escaping workaround was introduced.Validation
ConsensusFeaturerecords exposed 12,856 legacy PSM run-attribution mismatches;Related work
devbefore Refactor feature/psm PK and improve DuckDB CTE safety #227 is merged