Skip to content

Rename IMFormat::CONCATENATED → IM_PEAK and MULTIPLE_SPECTRA → IM_SPECTRUM - #8993

Merged
timosachsenberg merged 2 commits into
developfrom
copilot/rename-imformat-enum-values
Mar 25, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
copilot/rename-imformat-enum-values

Conversation

Copilot AI commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

MULTIPLE_SPECTRA sounds like a collection of spectra but means "one IM value per spectrum"; CONCATENATED doesn't convey "per-peak IM arrays." Per discussion, rename to names that describe the IM annotation granularity:

Old New Meaning
CONCATENATED IM_PEAK Full TIMS frame — per-peak IM in float data array
MULTIPLE_SPECTRA IM_SPECTRUM Single drift time per spectrum
// Before — unclear without reading enum docs
if (IMTypes::determineIMFormat(spec) == IMFormat::MULTIPLE_SPECTRA)

// After
if (IMTypes::determineIMFormat(spec) == IMFormat::IM_SPECTRUM)

Changes

  • Enum definition (IMTypes.h): Rename values and update doxygen comments, including MIXED/CENTROIDED descriptions that referenced old names
  • String serialization (IMTypes.cpp): "concatenated" → "im_peak", "multiple_spectra" → "im_spectrum"
  • All call sites (~10 source files): Biosaur2Algorithm, FeatureFinderAlgorithmMetaboIdent, FeatureFinderIdentificationAlgorithm, SimpleSearchEngineAlgorithm, PeptideSearchEngineFIAlgorithm, IMDataConverter, SpectrumMetaDataLookup, PeakPickerIM, BrukerTimsFile
  • TOPP tools: PeakPickerIM.cpp, OpenNuXL.cpp — updated error messages
  • Python bindings: bind_kernel.cpp enum values, bind_spectrum.cpp docstring
  • Tests: All C++ test files (IMTypes_test, PeakPickerIM_test, BrukerTimsFile_test, SpectrumMetaDataLookup_test, MSSpectrum_rasterizeIMFrame_test) and Python tests (test_Utf8StringInput, test_StaticMethods)
  • Header docs: MSSpectrum.h, BrukerTimsFile.h

Breaking changes

  • C++ API: IMFormat::CONCATENATED and IMFormat::MULTIPLE_SPECTRA no longer exist
  • pyOpenMS API: IMFormat.CONCATENATED / IMFormat.MULTIPLE_SPECTRA → IMFormat.IM_PEAK / IMFormat.IM_SPECTRUM
  • String format: toIMFormat("concatenated") → toIMFormat("im_peak"), toIMFormat("multiple_spectra") → toIMFormat("im_spectrum")
Original prompt

This section details on the original issue you should resolve

<issue_title>Rename IMFormat::MULTIPLE_SPECTRA and CONCATENATED to clearer names</issue_title>
<issue_description>## Problem

The IMFormat enum values MULTIPLE_SPECTRA and CONCATENATED do not clearly convey their semantic meaning:

  • MULTIPLE_SPECTRA means "one IM value per spectrum" (a single drift time via getDriftTime()). Used for DDA-PASEF MS2 spectra where each spectrum has one ion mobility value.
  • CONCATENATED means "per-peak IM values in a float data array" (each peak in the spectrum has its own IM value). Used for MS1 frames where all scans are stacked into one spectrum.

The names are confusing:

  • MULTIPLE_SPECTRA sounds like it describes a collection of spectra, but it actually describes the IM annotation style of a single spectrum
  • CONCATENATED doesn't indicate what is concatenated or that it refers to per-peak IM arrays

This makes code like the following hard to read without looking up the enum definition:

if (IMTypes::determineIMFormat(spec) == IMFormat::MULTIPLE_SPECTRA)
{
  pi.setMetaValue(Constants::UserParam::IM, spec.getDriftTime());
}

Suggested alternatives

Current Option A Option B Option C
MULTIPLE_SPECTRA SPECTRUM_LEVEL SINGLE_VALUE SCALAR_DRIFT_TIME
CONCATENATED PEAK_LEVEL PER_PEAK FLOAT_DATA_ARRAY

Option A (SPECTRUM_LEVEL / PEAK_LEVEL) is recommended — it clearly describes the granularity level at which IM is stored.

// Much clearer:
if (IMTypes::determineIMFormat(spec) == IMFormat::SPECTRUM_LEVEL)

Current enum definition

// src/openms/include/OpenMS/IONMOBILITY/IMTypes.h
enum class IMFormat
{
  NONE,              ///< no ion mobility
  CONCATENATED,      ///< per-peak IM in float data array (MS1 frames, DIA windows)
  MULTIPLE_SPECTRA,  ///< single drift time per spectrum (DDA-PASEF MS2)
  MIXED,             ///< experiment contains both formats
  CENTROIDED,        ///< IM of peaks after centroiding in IM dimension
  UNKNOWN,           ///< not yet determined
  SIZE_OF_IMFORMAT
};

How determineIMFormat() distinguishes them

From IMTypes.cpp:

  1. If spectrum has a float data array with IM data (containsIMData()) → CONCATENATED
  2. Else if spectrum has a scalar drift time (getDriftTime() != -1.0) → MULTIPLE_SPECTRA
  3. Else → NONE

Usage analysis across the codebase

Where MULTIPLE_SPECTRA is checked (scalar drift time per spectrum)

File Usage
SpectrumMetaDataLookup.cpp:214 Annotate IM on PeptideIdentification from spectrum drift time
SimpleSearchEngineAlgorithm.cpp Same — annotate PSMs with spectrum-level IM
PeptideSearchEngineFIAlgorithm.cpp Same — annotate PSMs with spectrum-level IM
OpenNuXL.cpp:4562 Log "Ion Mobility annotated at the spectrum level"
IMDataConverter.cpp:291 Skip spectra that are NOT MULTIPLE_SPECTRA
PeakPickerIM.cpp:198 Reject — "expects raw (concatenated) IM data"

Where CONCATENATED is checked (per-peak IM arrays)

File Usage
PeakPickerIM.cpp Only accepts CONCATENATED for IM peak picking
Biosaur2Algorithm.cpp:889,1345,1436 IM-dimension centroiding, per-peak IM bins
FeatureFinderIdentificationAlgorithm.cpp:697 Enable IM-aware feature extraction
FeatureFinderAlgorithmMetaboIdent.cpp:338 Accepts both formats for feature detection
PeakPickerIM.cpp:748 Main peak picking logic

Both formats referenced

File Usage
IMTypes.h Enum definition
IMTypes.cpp Format detection logic, string names
IMTypes_test.cpp Unit tests for format detection
PeakPickerIM_test.cpp Test input setup
bind_kernel.cpp Python bindings
BrukerTimsFile.cpp MS1 frames → CONCATENATED, MS2 spectra → MULTIPLE_SPECTRA

Total: ~17 source files + 2 doc files reference these enum values

User-facing error messages that would need updating

// PeakPickerIM.cpp
"Input file contains ion mobility data in MULTIPLE_SPECTRA format..."
"Mixed formats are not supported (both CONCATENATED and MULTIPLE_SPECTRA)..."

// OpenNuXL.cpp
"Ion Mobility annotated at the spectrum level."
"Concatenated Ion Mobility not supported."

Additional considerations

  • Python bindings (bind_kernel.cpp): Enum values exposed as IMFormat.CONCATENATED and IMFormat.MULTIPLE_SPECTRA — renaming is a pyOpenMS API change
  • String serialization (NamesOfIMFormat): Currently "concatenated" and "multiple_spectra" — may appear in mzML or other serialized formats
  • The CENTROIDED value has the same data layout as CONCATENATED (per-peak IM in float array) but different semantics (post-centroiding). This could also benefit from a clearer name like CENTROIDED_PEAK_LEVEL.
  • MIXED is only used at the experiment level (MSExperiment contains b...

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

…PECTRUM

Rename IMFormat enum values for clarity:
- CONCATENATED → IM_PEAK (full TIMS frame / per-scan IM-resolved data)
- MULTIPLE_SPECTRA → IM_SPECTRUM (conventional spectrum with one precursor IM value)

Updated all references across ~20 source files including:
- Core enum definition and string names (IMTypes.h/cpp)
- C++ source files using these enum values
- Header file documentation comments
- Python bindings (bind_kernel.cpp, bind_spectrum.cpp)
- C++ unit tests
- Python unit tests

Resolves the issue where MULTIPLE_SPECTRA sounded like a collection
of spectra and CONCATENATED didn't indicate per-peak IM arrays.

Co-authored-by: timosachsenberg <[email protected]>
Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/88f19985-185e-4f77-b433-2494b6c95887
Copilot AI changed the title [WIP] Rename IMFormat enum values for clarity Rename IMFormat::CONCATENATED → IM_PEAK and MULTIPLE_SPECTRA → IM_SPECTRUM Mar 25, 2026
Copilot AI requested a review from timosachsenberg March 25, 2026 08:56
@timosachsenberg
timosachsenberg marked this pull request as ready for review March 25, 2026 08:58
@timosachsenberg
timosachsenberg requested review from alhigaylan, cbielow, jcharkow and singjc and removed request for timosachsenberg March 25, 2026 10:22
@timosachsenberg
timosachsenberg merged commit 3a2c532 into develop Mar 25, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the copilot/rename-imformat-enum-values branch March 25, 2026 14:42
github-actions Bot pushed a commit that referenced this pull request Mar 26, 2026
Add missing entries for:
- #8991: Arrow/Parquet made required dependency; WITH_PARQUET CMake option removed
- #8993: BREAKING IMFormat enum rename (CONCATENATED→IM_PEAK, MULTIPLE_SPECTRA→IM_SPECTRUM)
- #8997: Fix TOPPView performance regression when right-clicking in large mzML
- #8999: BrukerTimsFile tiered scan→1/K0 calibration with RationalScan2ImConverter

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Mar 26, 2026
Add missing entries for:
- #8991: Arrow/Parquet made required dependency; WITH_PARQUET CMake option removed
- #8993: BREAKING IMFormat enum rename (CONCATENATED→IM_PEAK, MULTIPLE_SPECTRA→IM_SPECTRUM)
- #8997: Fix TOPPView performance regression when right-clicking in large mzML
- #8999: BrukerTimsFile tiered scan→1/K0 calibration with RationalScan2ImConverter

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.

Rename IMFormat::MULTIPLE_SPECTRA and CONCATENATED to clearer names

2 participants