Skip to content

[FIX] ProteinIdentification: an empty file list ('spectra_data') is not stored - #10548

Merged
timosachsenberg merged 1 commit into
developfrom
fix/empty-spectra-data
Oct 13, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/empty-spectra-data

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

An empty spectra_data (or spectra_data_raw) list on a ProteinIdentification names no files, but it could not be told apart from a missing one:

  • getPrimaryMSRunPath() returns no files in both cases, and no code checks whether the meta value exists. IDRipper and IdentifierMSRunMapper already treat both cases the same. The only existence check, FeatureMap.cpp:454, is on the map's own spectra_data, not on a protein run.
  • setPrimaryMSRunPath({}) stored an empty list and logged "Setting an empty value for primary MS runs paths."
  • The Parquet formats always write the file list column. A run without files therefore got an empty list, and reading it back called setPrimaryMSRunPath({}). Converting a run without files added a list it never had. One example is TOPP_FileConverter_35: featureXML → consensusparquet → consensusXML. Its input has no spectra_data, but the expected output has spectra_data = [].

This PR establishes the following rule: an empty list means the same as no list, and it is not stored.

  • setPrimaryMSRunPath() with an empty list removes the meta value. Before, it stored an empty list and warned. addPrimaryMSRunPath() with an empty list changes nothing.
  • The new ProteinIdentification::removeEmptyPrimaryMSRunPaths() removes empty lists. The idXML, featureXML, consensusXML and Parquet loaders call it for each protein run, so files written before this change still load and their empty lists disappear. pyOpenMS binds the method.
  • Not covered: the spectra_data of feature and consensus maps themselves, and code that sets an empty list directly with setMetaValue(). The latter does not happen in OpenMS.

Context: in the identification data refactoring (#10423), the files of a run are its sources. There, the run settings had to keep an empty spectra_data list as an exception so that idXML round trips stayed exact. With this rule, that exception and its helper code can go.

Expected outputs

17 expected files each lose one or two lines of the form <UserParam type="stringList" name="spectra_data" value="[]"/>, 18 lines in total, and nothing else changes. Before editing, I ran each failing test's own FuzzyDiff command against a copy of its expected file with only that line removed. All 18 FuzzyDiff checks that could be rerun this way passed. PercolatorAdapter_string_features_out shares an expected file with PercolatorAdapter_1_inproc_out and passes after the edit. Input files that contain an empty list (IDMapper_4/5_input.idXML, MzTabExporter_3_input.featureXML, comet.topperc_check.idXML, the pyOpenMS docs copy of OpenPepXL_output.idXML) are unchanged.

Tests

Linux, GCC 13, Debug, without OpenTIMS, on a4438c1:

  • Full ctest: the only failures are 11 that this change does not touch, and I did not run develop without the change for comparison:
    • 6× TOPP_CometAdapter_*_out1: the outputs differ only by the three Bruker options, which exist only with OpenTIMS.
    • 5× TOPP_ProSE_11_rescore*: a Debug-only assertion in the vendored Percolator (BaseSpline.cpp:236).
  • New test sections cover:
    • setPrimaryMSRunPath/addPrimaryMSRunPath with an empty list, and removeEmptyPrimaryMSRunPaths (ProteinIdentification_test);
    • loading an idXML file with an empty list (IdXMLFile_test);
    • featureXML and consensusXML files written with empty lists (FeatureXMLFile_test, ConsensusXMLFile_test);
    • a Parquet run without files (ProteinIdentificationArrowIO_test).
  • The pyOpenMS binding compiles; I checked bind_kernel.cpp with -fsyntax-only against these headers. The Python tests were not run locally.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

🤖 Generated with Claude Code

https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Empty primary MS-run path lists are now treated consistently as no files, rather than being stored as empty metadata.
    • Loading identification data from idXML, featureXML, consensusXML, and Parquet now removes empty path entries while preserving runs that contain no files.
    • Saving and reloading data no longer creates empty path metadata for runs without associated files.

…ot stored

An empty 'spectra_data' (or 'spectra_data_raw') list names no files and could not be told from a
missing one: getPrimaryMSRunPath() returns no files for both, and no code checks whether the meta value
exists. The Parquet formats wrote both as an empty list and read an empty list back, so converting a
run without files (e.g. featureXML -> consensusparquet -> consensusXML) added one.

- setPrimaryMSRunPath() with an empty list removes the meta value (it stored an empty list and warned);
  addPrimaryMSRunPath() with an empty list changes nothing.
- removeEmptyPrimaryMSRunPaths() removes empty lists; idXML, featureXML, consensusXML and the Parquet
  formats call it when they load a protein run, so files with an empty list stay readable.
- pyOpenMS binds removeEmptyPrimaryMSRunPaths().
- Expected outputs: 17 files lose the empty 'spectra_data' line (18 lines; nothing else changes, each
  test passes FuzzyDiff against its expected file with only that line removed). Inputs with an empty list
  are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav

Copy link
Copy Markdown
Contributor Author

CI: build-wheels-windows failed in setup, before anything was built. This PR does not cause it.

The step "Restore the vcpkg binary cache" fails like this:

  • rsync reports /usr/bin/rrsync error: reading from write-only server is not allowed.
  • The action then falls back to HTTP and stops with Unable to locate executable file: rclone, although the previous step ran choco install rclone.

build-wheels-windows of #10546 restored the cache at about 13:50 UTC and passed. Since about 15:00 UTC the same step fails with the same messages and the same cache key, for example on fix/percolator-pep-spline-ties (15:06 UTC). The Linux ARM job of this run gets past its cache step. So the cache server seems to refuse reads now, and the Windows job has no working fallback.

No fix exists in this repository yet. I'll re-run the failed job once other Windows jobs get past that step again.


Generated by Claude Code

timosachsenberg pushed a commit that referenced this pull request Oct 13, 2026
QualityControl keeps the consensus map and the feature maps as identification
data instead of converting them to peptide identifications and sorting those
by score (#10470):

- The metrics annotate the identifications of each feature map and their best
  matches; their meta values pass to the identifications of the consensus map
  with the same file and spectrum reference (and their best matches). 'cf_id'
  annotates the identifications that a consensus feature links.
- Unidentified MS2 spectra (Ms2SpectrumStats) are observations that RTAlignment
  annotates; they become identifications without matches after all others, in
  the run without score type of their run
  (IdentificationDataAdapter::unscoredRun()), as the legacy peptide
  identifications without score type were.
- The MaxQuant exporters read identification data:
  MQExporterHelper::linkedIdentifications() gives the identifications of a
  feature best first, bestIdentification() picks the one to export
  (MULTI-MSMS/MULTI-MATCH as before).
- ConsensusMap::split() splits the identification data of a map too (through a
  converted copy, each part holding its share as identification data); it
  dropped them before. QualityControl splits the consensus map without feature
  maps.

The identifications of a feature keep their order (the best match is the one
with the best primary score), as agreed for this migration:
- QualityControl_2_out.featureXML: the three identifications of one feature are
  in their input order (spectrum 999, 217, 334) instead of best first; nothing
  else changes.
- QualityControl_1_out.consensusXML/mzTab: back to the goldens before
  4fb5551: IDConflictResolver unassigns the two LHHLVDDK identifications in
  identification order. Against legacy QualityControl (PR branch build) the
  outputs differ only in the order of unassigned identifications (see the
  IDConflictResolver entry); all values, score types included, are the same.
- MQEvidence_result.txt/MQMsms_result.txt: the class tests pass unsorted maps,
  which the old exporters read in file order (first identification = best).
  The new outputs are byte-identical to those of the legacy exporters (PR
  branch build) on the same fixtures with every feature's peptide
  identifications sorted as #10470 sorts them; the legacy exporters on the
  unsorted fixtures reproduce the previous results (within the test
  tolerance).

New ConsensusMap_test section: split() of a map with identification data gives
the identifications of the legacy split, as identification data.

Validation (Linux, GCC, Debug, without OpenTIMS): all class and TOPP tests pass
except the six CometAdapter comparisons (Bruker options) and FileConverter_35
(empty spectra_data list, removed by #10548), as before. Labeled-mode
QualityControl (consensus map split, no feature maps) on IDMapper_6_output and
MzTabExporter_1_input gives the consensusXML and mzTab of legacy QualityControl.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
@OpenMS OpenMS deleted a comment from coderabbitai Bot Oct 13, 2026

@timosachsenberg timosachsenberg left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems good to me

@timosachsenberg
timosachsenberg merged commit af376bc into develop Oct 13, 2026
41 of 42 checks passed
@timosachsenberg
timosachsenberg deleted the fix/empty-spectra-data branch October 13, 2026 21:36
timosachsenberg pushed a commit that referenced this pull request Oct 13, 2026
…der)

Conflicts: IDMerger_idparquet_output.idXML keeps this branch's version (no
'spectra_data' and no 'file_origin', which the native .idparquet does not
write); FeatureXMLFile_test and ConsensusXMLFile_test keep the new sections of
both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
timosachsenberg pushed a commit that referenced this pull request Oct 13, 2026
With #10548, an empty 'spectra_data' list names no files and is not stored, as
no list. Run settings kept an empty list as an exception so that legacy runs
without files kept it through a round trip; that exception goes:

- IdentificationDataAdapter::settingsFromLegacy() always removes 'spectra_data'
  (the files of a run are its sources), and the merged protein run of pooled
  inference gets no list without files (setPrimaryMSRunPath()).
- Run::setSettings() rejects any 'spectra_data', also an empty list.

Outputs unchanged: the legacy loaders already drop empty lists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
timosachsenberg pushed a commit that referenced this pull request Oct 13, 2026
The XML handlers drop an empty file list of the protein runs they read into
the identifications of a map (removeEmptyPrimaryMSRunPaths()). The new
FeatureXMLFile/ConsensusXMLFile sections write the empty lists into a stored
file, as older versions wrote them, since a map cannot hold one, and read
them through proteinIdentifications().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01B51nRFoHvZuVXD7cT8XZav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants