Skip to content

Add adduct support to FeatureFinderMetaboIdent - #9382

Merged
timosachsenberg merged 4 commits into
developfrom
copilot/fix-adduct-support-in-featurefinder
May 20, 2026
Merged

timosachsenberg merged 4 commits into
developfrom
copilot/fix-adduct-support-in-featurefinder

Conversation

Copilot AI commented May 19, 2026 •

Copy link
Copy Markdown
Contributor
  • Add adduct field to FeatureFinderMetaboIdentCompound struct (header)
  • Update addTargetToLibrary_ to accept and use adduct string
  • Replace hardcoded proton mass calculation with AdductInfo::getMZ() for proper adduct support
  • Update TSV parsing in TOPP tool to support optional "Adduct" column
  • Update pyOpenMS bindings for the new compound field
  • Add default behavior: when no adduct specified, use M+H;1+ for positive charge, M-H;1- for negative (backward compatible)
  • Annotate features with the adduct information
  • Fix test reference output: adduct appears between label and expected_rt (MetaInfoRegistry ordering)

Copilot AI and others added 2 commits May 19, 2026 16:31
Previously, FeatureFinderMetaboIdent always assumed [M+H]+ adduct for
positive charges and had no way to specify different adducts (e.g.
[M+Na]+, [M-H]-, [2M+H]+). This commit adds:

- An optional "Adduct" column to the TSV input format
- Uses AdductInfo::parseAdductString() and AdductInfo::getMZ() for
  proper m/z calculation from any supported adduct notation
- Annotates output features with the adduct information
- Maintains backward compatibility: when no adduct is specified,
  defaults to M+H;1+ (positive) or M-H;1- (negative)
- Updates pyOpenMS bindings for the new adduct parameter

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/ffae3e69-3273-4bb7-9ce3-c97d284f7fd3

Co-authored-by: jpfeuffer <[email protected]>
Copilot AI changed the title [WIP] Fix proton addition issue in FeatureFinderMetaboIdent Add adduct support to FeatureFinderMetaboIdent May 19, 2026
Copilot AI requested a review from jpfeuffer May 19, 2026 16:33
@jpfeuffer

Copy link
Copy Markdown
Contributor

@copilot test is failing:

Test output
Warning: Parameters file version (3.6.0) does not match the version of this tool (3.6.0-pre-HEAD-2026-05-19).
Your current parameters are still valid, but there might be new valid values or even new parameters. Upgrading the INI might be useful.
FAILED: 'different letters'

input: in1 in2
line: 161 161
pos/col: 20/42 20/42

is_number: false false
numbers: nan nan
is_space: false false
is_letter: true true
letters: "s" "f"
char_codes: 115 102

relative_max: 1
relative_acceptable: 1.01

absolute_max: 2.05273
absolute_acceptable: 0.01

Offending lines: (tab_width = 8, first_column = 1)

in1: /Users/runner/work/OpenMS/OpenMS/bld/src/tests/topp/tmp_path/FeatureFinderMetaboIdent_1_output.tmp.featureXML (line: 161, position/column: 20/42)

in2: /Users/runner/work/OpenMS/OpenMS/src/tests/topp/FeatureFinderMetaboIdent_1_output.featureXML (line: 161, position/column: 20/42)

Easy Access:
/Users/runner/work/OpenMS/OpenMS/bld/src/tests/topp/tmp_path/FeatureFinderMetaboIdent_1_output.tmp.featureXML:161:42:
/Users/runner/work/OpenMS/OpenMS/src/tests/topp/FeatureFinderMetaboIdent_1_output.featureXML:161:42:

diff /Users/runner/work/OpenMS/OpenMS/bld/src/tests/topp/tmp_path/FeatureFinderMetaboIdent_1_output.tmp.featureXML /Users/runner/work/OpenMS/OpenMS/src/tests/topp/FeatureFinderMetaboIdent_1_output.featureXML
FuzzyDiff took 0.00 s (wall), 0.00 s (CPU), 0.00 s (system), 0.00 s (user); Peak Memory Usage: 32 MB.

…and expected_rt

The adduct UserParam is registered in MetaInfoRegistry before expected_rt
(set in addTargetToLibrary_ at line 668, before expected_rt at line 690),
so it appears between label and expected_rt in the featureXML output,
not after sum_formula as initially placed.

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/5c55ec95-c9d1-458b-a244-70b7a4e5558f

Co-authored-by: jpfeuffer <[email protected]>

Copilot AI commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot test is failing:

Test output
...

Fixed in commit 344107a. The adduct UserParam gets a lower MetaInfoRegistry dynamic index than expected_rt (it's registered in addTargetToLibrary_ at line 668, before expected_rt at line 690), so it appears between label and expected_rt in the output — not after sum_formula where I initially placed it in the reference file.

@jpfeuffer
jpfeuffer marked this pull request as ready for review May 19, 2026 22:11
@jpfeuffer
jpfeuffer requested a review from timosachsenberg May 19, 2026 22:12
@timosachsenberg

Copy link
Copy Markdown
Contributor

Looks good

@timosachsenberg
timosachsenberg merged commit b38b8f1 into develop May 20, 2026
42 checks passed
@timosachsenberg
timosachsenberg deleted the copilot/fix-adduct-support-in-featurefinder branch May 20, 2026 05:03
timosachsenberg pushed a commit that referenced this pull request May 21, 2026
- FeatureFinderMetaboIdent: adduct support via optional TSV column (#9382)
- BrukerTimsImagingFile: new Bruker .d MALDI imaging loader (#9383)
- BrukerTimsFile: frame_id/RT range filter in Config (#9387)
- Fix: SwathMapMassCorrection null-pointer and memory leak (#9386)

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request May 22, 2026
…n TSV input format (#9395)

The adduct support added in #9382 introduced an optional 'Adduct' column
to the TSV input file but the Doxygen tool documentation still described
the old workaround of encoding adducts via a modified SumFormula.

Update the Input format section to:
- Add [Adduct] to the header line template
- Add @p Adduct column description with supported notation examples
- Clarify that the Adduct column supersedes the SumFormula workaround
- Reword @p SumFormula to remove the now-misleading adduct-via-formula
  suggestion

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg added a commit that referenced this pull request May 27, 2026
… TSV columns (#9409)

The FeatureFinderMetaboIdent TSV format supports two optional columns
after IsoDistribution:
- IonMobility (added in #7453 for IM/FAIMS support)
- Adduct (added in #9382 for explicit adduct specification)

The pyOpenMS tutorial at doc/pyopenms/docs/source/user_guide/feature_detection.rst
was showing only the 7 required columns and the Python parsing example
did not read or pass the optional columns to FeatureFinderMetaboIdentCompound.

Changes:
- Add a prose note listing the two optional columns with their semantics
- Update the metaboTableFromFile() example to detect IonMobility and
  Adduct columns from the header row and pass them (or empty defaults)
  to the FeatureFinderMetaboIdentCompound constructor, which already
  accepts both as optional keyword arguments.

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

FeatureFinderMetaboIdent seems to add a proton to input molecular formulas

3 participants