Skip to content

add MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY constant - #9181

Merged
timosachsenberg merged 2 commits into
OpenMS:developfrom
alhigaylan:im-constants
Apr 18, 2026
Merged

timosachsenberg merged 2 commits into
OpenMS:developfrom
alhigaylan:im-constants

Conversation

@alhigaylan

@alhigaylan alhigaylan commented Apr 17, 2026 •

Copy link
Copy Markdown
Collaborator

Proteowizard msconvert is a popular tool to convert .d TimsTOF files to mzML. The algorithm output ion mobility array as 'MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY' with the CV term MS:1003006. I updated the Constants.h file and IMDataConverter type to check for this term.

Here is a snippet of mzML file from msconvert

					</binaryDataArray>
					<binaryDataArray arrayLength="7625" encodedLength="40668" >
						<cvParam cvRef="MS" accession="MS:1003006" name="mean inverse reduced ion mobility array" unitAccession="MS:1002814" unitName="volt-second per square centimeter" unitCvRef="MS" />
						<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" />
						<cvParam cvRef="MS" accession="MS:1000576" name="no compression" />

I double checked this controlled term using HUPO-PSI dictionary in this link

IMDataConverter::getIMUnit should now be able to recognize this term among other CVs for ion mobility arrays.

Forr the fallback block aiming to capture unconventional ion mobility array names, we should check for MS:1003006 in addition to MS:1002815. Feedback on this? if you agree, I will add a snippet code to check for this.

Description

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.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features
    • Added support for recognizing and properly classifying mean inverse reduced ion mobility array data types, improving compatibility with additional ion mobility data source formats.

…tend getIMUnit coverage

Adds a new UserParam constant for Bruker 'mean inverse reduced ion mobility array'
(CV MS:1003006) alongside the existing INVERSE_REDUCED_ION_MOBILITY (MS:1002815).
Updates IMDataConverter::getIMUnit to recognise all three IM array name prefixes,
ensuring correct unit detection for timsTOF, MSConvert, and Bruker raw data.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

@alhigaylan The following names might be missing from the AUTHORS file:

  • alhigaylan

Please consider applying the following patch:

--- AUTHORS	2026-04-17 19:46:30.682970136 +0000
+++ AUTHORS.new	2026-04-17 19:46:35.701828424 +0000
@@ -11,6 +11,7 @@
  - Alen Saric
  - Alexandra Scherbart
  - Alexandra Zerck
+ - alhigaylan
  - Amanda Wein
  - Andreas Bertsch
  - Andreas Simon

@coderabbitai

coderabbitai Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e433310b-8680-4401-a25a-96f3fb5c9be5

📥 Commits

Reviewing files that changed from the base of the PR and between b6f278d and 7e57ffc.

📒 Files selected for processing (1)
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp

📝 Walkthrough

Walkthrough

The pull request adds a new MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY constant to the OpenMS constants library and expands the getIMUnit method in IMDataConverter to recognize this new parameter type and handle additional ion mobility metadata identifiers (MS:1002815 and MS:1003006).

Changes

Cohort / File(s) Summary
Ion Mobility Constants
src/openms/include/OpenMS/CONCEPT/Constants.h
Added new UserParam constant MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY with string value for metadata labeling.
Ion Mobility Data Conversion
src/openms/source/IONMOBILITY/IMDataConverter.cpp
Expanded getIMUnit fallback logic to recognize the new mean inverse reduced ion mobility array constant and broadened DriftTimeUnit::VSSC assignment to include both MS:1002815 and MS:1003006 identifiers.

Poem

🐰 A new constant hops into place,
Ion mobility finds its space,
VSSC detection spreads its wings,
With metadata that Bruker brings,
The mobility array now sings!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly describes the main change: adding a new constant MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY to the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/openms/source/IONMOBILITY/IMDataConverter.cpp (2)

333-349: ⚠️ Potential issue | 🔴 Critical

Incorrect unit inferred for "mean inverse reduced ion mobility array" (MS:1003006).

MS:1003006 is an inverse‑reduced‑ion‑mobility quantity whose unit is volt‑second per square centimeter (MS:1002814), i.e. the same DriftTimeUnit::VSSC as INVERSE_REDUCED_ION_MOBILITY / MS:1002815. However, the fallback here only upgrades to VSSC when the array name contains the literal substring "MS:1002815". Since an MS:1003006 array name will not contain that substring, this branch will fall through to the else at Line 347 and classify it as DriftTimeUnit::MILLISECOND, silently producing wrong IM units for every downstream consumer (PeakPickerIM, getIMData(), etc.).

You should either (a) key the unit decision on the array name itself rather than an embedded accession substring, or (b) also accept "MS:1003006" as a VSSC marker. Option (a) is more robust since msconvert does not embed the accession in the FDA name.

🐛 Proposed fix
   bool IMDataConverter::getIMUnit(const DataArrays::FloatDataArray& fda, DriftTimeUnit& unit)
   {
     const auto& cv = ControlledVocabulary::getPSIMSCV();
-    if (fda.getName().hasPrefix(Constants::UserParam::ION_MOBILITY) ||
-        fda.getName().hasPrefix(Constants::UserParam::INVERSE_REDUCED_ION_MOBILITY) ||
-        fda.getName().hasPrefix(Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY))
-    { // fallback for non-standard IM arrays (as created by Mobi-DIK, "Ion Mobility Centroid" from PeakPickerIM, "inverse reduced ion mobility" from MSConvert, or "mean inverse reduced ion mobility array" from Bruker)
-      if (fda.getName().hasSubstring("MS:1002815"))
+    const String& name = fda.getName();
+    const bool is_inv_reduced =
+        name.hasPrefix(Constants::UserParam::INVERSE_REDUCED_ION_MOBILITY) ||
+        name.hasPrefix(Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY);
+    if (name.hasPrefix(Constants::UserParam::ION_MOBILITY) || is_inv_reduced)
+    { // fallback for non-standard IM arrays (Mobi-DIK, PeakPickerIM "Ion Mobility Centroid",
+      // MSConvert "inverse reduced ion mobility" (MS:1002815), or
+      // "mean inverse reduced ion mobility array" (MS:1003006) from msconvert on Bruker timsTOF)
+      if (is_inv_reduced || name.hasSubstring("MS:1002815") || name.hasSubstring("MS:1003006"))
       {
         unit = DriftTimeUnit::VSSC;
       }
-      else if (fda.getName().hasSubstring("MS:1002954"))
+      else if (name.hasSubstring("MS:1002954"))
       {
         unit = DriftTimeUnit::CCS;
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/source/IONMOBILITY/IMDataConverter.cpp` around lines 333 - 349,
The unit selection in IMDataConverter.cpp incorrectly classifies "mean inverse
reduced ion mobility array" (MS:1003006) as MILLISECOND because the fallback
checks only for substring "MS:1002815"; update the logic in the block that
examines fda.getName() (used alongside
Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY) to treat
MS:1003006 as VSSC as well — either by checking for
fda.getName().hasSubstring("MS:1003006") in the same branch that sets
DriftTimeUnit::VSSC or, preferably, by basing the decision directly on the array
identifier/constant (e.g., recognize
MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY/MS:1003006) instead of relying on
embedded accession substrings so that functions like getIMData() and
PeakPickerIM get the correct DriftTimeUnit.

330-356: ⚠️ Potential issue | 🟡 Minor

The fallback for MS:1003006 appears unnecessary.

MS:1003006 ("mean inverse reduced ion mobility array") is properly defined in the bundled PSI-MS CV with is_a: MS:1002893 and relationship: has_units MS:1002814. Since FDA names from Bruker and ProteoWizard use the exact CV term name "mean inverse reduced ion mobility array", the normal CV lookup path via cv.getTermByName(fda.getName()) should resolve it automatically and extract the correct unit mapping, making the new fallback prefix check redundant. Consider removing the MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY condition from the fallback block (line 333) and letting it use the standard CV resolution.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/source/IONMOBILITY/IMDataConverter.cpp` around lines 330 - 356, In
IMDataConverter::getIMUnit, remove the special-case prefix check for
Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY inside getIMUnit
so that names matching the official "mean inverse reduced ion mobility array"
are resolved via cv.getTermByName(fda.getName()) and the CV-based unit mapping
logic (cv.getTermByName + cv.isChildOf + has_units handling) in
IMDataConverter::getIMUnit handles the unit lookup; keep the other user-param
fallbacks (ION_MOBILITY and INVERSE_REDUCED_ION_MOBILITY) but delete the
MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY branch and its associated fallback unit
assignments.
🧹 Nitpick comments (1)
src/openms/include/OpenMS/CONCEPT/Constants.h (1)

258-263: Naming inconsistency with sibling IM constants.

The sibling constants (ION_MOBILITY, INVERSE_REDUCED_ION_MOBILITY) omit the _ARRAY suffix even though their string values are also array names. To keep the UserParam surface consistent and make the fallback chain in IMDataConverter::getIMUnit read uniformly, consider renaming this to MEAN_INVERSE_REDUCED_ION_MOBILITY (keeping the string value "mean inverse reduced ion mobility array" as-is).

Proposed rename
-      /** Alternative MetaValue key for ion mobility data (inverse reduced ion mobility).
-       * Some files store ion mobility data with this prefix instead of "Ion Mobility".
-       * Unit is typically volt-seconds per square centimeter (Vs/cm^2) also known as 1/k0.
-       * CV Term MS:1003006
-       */
-      inline const std::string MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY = "mean inverse reduced ion mobility array";
+      /** MetaValue key for mean inverse reduced ion mobility array (MS:1003006, e.g. produced by
+       * Proteowizard msconvert for Bruker timsTOF .d data). Unit is volt-seconds per square
+       * centimeter (Vs/cm^2), i.e. 1/K0.
+       */
+      inline const std::string MEAN_INVERSE_REDUCED_ION_MOBILITY = "mean inverse reduced ion mobility array";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/include/OpenMS/CONCEPT/Constants.h` around lines 258 - 263, The
constant MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY should be renamed to
MEAN_INVERSE_REDUCED_ION_MOBILITY to match the naming of sibling constants
(ION_MOBILITY, INVERSE_REDUCED_ION_MOBILITY) while keeping its string value
"mean inverse reduced ion mobility array" unchanged; update the declaration in
Constants.h and replace all references (e.g., usages in
IMDataConverter::getIMUnit and any other callers) to use the new identifier to
preserve the fallback chain consistency and compilation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/openms/source/IONMOBILITY/IMDataConverter.cpp`:
- Around line 333-349: The unit selection in IMDataConverter.cpp incorrectly
classifies "mean inverse reduced ion mobility array" (MS:1003006) as MILLISECOND
because the fallback checks only for substring "MS:1002815"; update the logic in
the block that examines fda.getName() (used alongside
Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY) to treat
MS:1003006 as VSSC as well — either by checking for
fda.getName().hasSubstring("MS:1003006") in the same branch that sets
DriftTimeUnit::VSSC or, preferably, by basing the decision directly on the array
identifier/constant (e.g., recognize
MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY/MS:1003006) instead of relying on
embedded accession substrings so that functions like getIMData() and
PeakPickerIM get the correct DriftTimeUnit.
- Around line 330-356: In IMDataConverter::getIMUnit, remove the special-case
prefix check for Constants::UserParam::MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY
inside getIMUnit so that names matching the official "mean inverse reduced ion
mobility array" are resolved via cv.getTermByName(fda.getName()) and the
CV-based unit mapping logic (cv.getTermByName + cv.isChildOf + has_units
handling) in IMDataConverter::getIMUnit handles the unit lookup; keep the other
user-param fallbacks (ION_MOBILITY and INVERSE_REDUCED_ION_MOBILITY) but delete
the MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY branch and its associated fallback
unit assignments.

---

Nitpick comments:
In `@src/openms/include/OpenMS/CONCEPT/Constants.h`:
- Around line 258-263: The constant MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY
should be renamed to MEAN_INVERSE_REDUCED_ION_MOBILITY to match the naming of
sibling constants (ION_MOBILITY, INVERSE_REDUCED_ION_MOBILITY) while keeping its
string value "mean inverse reduced ion mobility array" unchanged; update the
declaration in Constants.h and replace all references (e.g., usages in
IMDataConverter::getIMUnit and any other callers) to use the new identifier to
preserve the fallback chain consistency and compilation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc242666-a1fe-4969-989a-7b93314e2f8b

📥 Commits

Reviewing files that changed from the base of the PR and between 4743180 and 41d0fa2.

📒 Files selected for processing (2)
  • src/openms/include/OpenMS/CONCEPT/Constants.h
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp

@timosachsenberg

Copy link
Copy Markdown
Contributor

Ok so this really attached to each peak. I saw this term before and assumed it is a mean vague e.g. from merged scans

@timosachsenberg

Copy link
Copy Markdown
Contributor

If there is data that contains this we should handle this

@alhigaylan

Copy link
Copy Markdown
Collaborator Author

If there is data that contains this we should handle this

I agree. I added MS:1003006 check in addition to MS:1002815

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@contrib`:
- Line 1: Revert the accidental contrib submodule pointer change: restore the
contrib pointer from e6fde7cfed8cde73c6625cd493ce3f82e21263cc back to the
original 186aacfbc1157719735b497cd6de1b3e83289eea so no third‑party dependency
versions are changed; update the PR to remove the contrib submodule modification
and re-run the commit (or amend the commit) so only the intended changes (adding
MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY and extending
IMDataConverter::getIMUnit) remain—if the submodule bump was intentional,
instead document and justify the bump in the commit message and PR description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4582ba0-3dc5-46c9-a16b-245aec69d25d

📥 Commits

Reviewing files that changed from the base of the PR and between 41d0fa2 and b6f278d.

📒 Files selected for processing (2)
  • contrib
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp

Comment thread contrib Resolved
@timosachsenberg
timosachsenberg merged commit af5b0a5 into OpenMS:develop Apr 18, 2026
39 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 19, 2026
Add missing entries for commits since the 2026-04-18 sync:
- Constants #9181: new MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY constant
  (CV MS:1003006) + IMDataConverter::getIMUnit extended to cover all
  three IM array name prefixes
- ProSE #9185: calibration in chunked search now uses a strided sample
  across the full DB; asymmetric calibrated precursor bounds correctly
  preserved through chunked/multi-file paths; corrects stale 'calibration
  is skipped in chunked mode' text in the #9177 chunking entry

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 19, 2026
Add missing entries for commits since the 2026-04-18 sync:
- Constants #9181: new MEAN_INVERSE_REDUCED_ION_MOBILITY_ARRAY constant
  (CV MS:1003006) + IMDataConverter::getIMUnit extended to cover all
  three IM array name prefixes
- ProSE #9185: calibration in chunked search now uses a strided sample
  across the full DB; asymmetric calibrated precursor bounds correctly
  preserved through chunked/multi-file paths; corrects stale 'calibration
  is skipped in chunked mode' text in the #9177 chunking entry

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@alhigaylan
alhigaylan deleted the im-constants branch April 20, 2026 18:21
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