Skip to content

Integrate PeakPickerIM - #8177

Closed
alhigaylan wants to merge 58 commits into
OpenMS:developfrom
alhigaylan:im_types_v2
Closed

alhigaylan wants to merge 58 commits into
OpenMS:developfrom
alhigaylan:im_types_v2

Conversation

@alhigaylan

@alhigaylan alhigaylan commented Aug 19, 2025 •

Copy link
Copy Markdown
Collaborator

Description

PeakPickerIM contains 3 different methods of generating centroided data from TimsTOF (and potentially any ion mobility containing data).

  • Parameters for the TOPP tool are organized into sections corresponding to the method chosen (mobilogram / cluster / elutions). I tried to mimic how PeakPickerHiRes organize its parameters section.
  • Added test files for each method. The tests are 3 MS1 scans from TimsTOF data / 250ng proteome injection.
  • The branch 'im_types' does not cleanly merge with develop branch. I manually copied all the relevant files from that branch to this PR. This includes things like adding pxd files .. etc.

TO-DO:

  • Ion mobility format handling is still incomplete. A discussion is helpful here. The method 'mobilogram' saves centroided data with 'Ion Mobility' float array. Cluster and Elution methods keeps the raw input name 'Inverse Mean Reverse Ion Mobility'.

Maybe we should rename the output to 'Ion Mobility Centroid' ?

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

    • PeakPickerIM: ion-mobility peak picking (mobilogram / cluster / trace), in-memory and streaming modes, Python bindings; per-spectrum IM get/set API; mzML centroided IM output.
  • Behavior Changes

    • IMFormat gains CENTROIDED and UNKNOWN; detection and validation updated to recognize centroided/mixed formats and stricter single-spectrum checks.
  • Bug Fixes

    • Improved handling of very short/single-point elution traces and more robust IM-aware centroiding.
  • Tests

    • New unit and TOPP tests for PeakPickerIM and IM format behavior.
  • Chores

    • Tool registry, constants and test resources updated.

✏️ Tip: You can customize this high-level summary in your review settings.

@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: 13

Caution

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

⚠️ Outside diff range comments (4)
src/openms/source/KERNEL/MassTrace.cpp (2)

99-104: Add missing header for std::accumulate

computeIntensitySum uses std::accumulate but is not included in this TU, which can break compilation depending on indirect includes.

Add the include at the top of this file:

#include <numeric>

Optionally, add a small unit test for computeIntensitySum() (happy path, empty trace, and large values) — I can draft one if helpful.


428-440: Guard against division-by-zero; consider trapezoidal integration for consistency

trace_area can be zero (e.g., all intensities 0) and is used as divisor. Add the same epsilon-guard you use in updateSmoothedWeightedMeanRT to prevent NaN/Inf. Additionally, the current Riemann-right sum (no rt spacing on the first point and no trapezoidal averaging) differs from computePeakArea()’s trapezoidal convention, which can bias centroid_rt_.

Minimal safety fix (division-by-zero guard):

       for (MassTrace::const_iterator l_it = trace_peaks_.begin() + 1; l_it != trace_peaks_.end(); ++l_it)
       {
         double rt_diff = l_it->getRT() - rt_before;                
         wmean_rt += l_it->getIntensity() * l_it->getRT() * rt_diff;
         rt_before = l_it->getRT();
         trace_area += l_it->getIntensity() * rt_diff;
       }
-      centroid_rt_ = wmean_rt / trace_area;
+      if (trace_area < std::numeric_limits<double>::epsilon())
+      {
+        throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Peak area equals zero... impossible to compute weights!", String(trace_peaks_.size()));
+      }
+      centroid_rt_ = wmean_rt / trace_area;

Optional refactor for consistency (trapezoidal rule for numerator and denominator):

double num = 0.0;
double den = 0.0;
for (Size i = 1; i < trace_peaks_.size(); ++i)
{
  const double rt_prev = trace_peaks_[i-1].getRT();
  const double rt_curr = trace_peaks_[i].getRT();
  const double dt = rt_curr - rt_prev;
  if (dt <= 0) { continue; } // or throw, if RT must be strictly increasing

  const double I_prev = trace_peaks_[i-1].getIntensity();
  const double I_curr = trace_peaks_[i].getIntensity();
  const double I_avg  = 0.5 * (I_prev + I_curr);

  den += I_avg * dt;                                  // ∫ I(t) dt
  num += 0.5 * (I_prev * rt_prev + I_curr * rt_curr)  // ∫ t·I(t) dt
         * dt;
}
if (den < std::numeric_limits<double>::epsilon())
{
  throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Peak area equals zero... impossible to compute weights!", String(trace_peaks_.size()));
}
centroid_rt_ = num / den;
src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (1)

511-517: Sub-trace SNR is computed on the parent MassTrace (likely wrong)

Inside the sub-trace path, SNR filtering uses computeApexSNR(mt) instead of computeApexSNR(new_mt). This biases filtering decisions and can drop valid sub-traces or keep invalid ones.

Apply this diff:

-          if (computeApexSNR(mt) < chrom_peak_snr_)
+          if (computeApexSNR(new_mt) < chrom_peak_snr_)
           {
             snr_ok = false;
           }
src/openms/source/PROCESSING/CENTROIDING/sources.cmake (1)

5-15: Add missing public header export for PeakPickerIM

The header PeakPickerIM.h exists under src/openms/include/OpenMS/PROCESSING/CENTROIDING/, but it isn’t listed in the include-side CMake sources, so it won’t be installed or exported. Please add it to:

  • File: src/openms/include/OpenMS/PROCESSING/CENTROIDING/sources.cmake

For example, update the headers list:

 set(headers
   PeakPickerHiRes.h
   PeakPickerIterative.h
+  PeakPickerIM.h
 )

This will ensure PeakPickerIM.h is properly exported and avoids missing-symbol or installation issues.

🧹 Nitpick comments (36)
src/openms/source/KERNEL/MassTrace.cpp (1)

449-455: LGTM on single-peak; consider dt-weighted smoothing for uneven RT grids

The single-peak early-return matches the unsmoothed path. For the general case, you currently compute sum(smoothed_i * RT_i) / sum(smoothed_i) without accounting for RT spacing; this can bias centroid_rt_ when RT spacing is uneven.

Refactor sketch using trapezoidal rule on smoothed data (and clamping negatives to 0, as you already do):

double num = 0.0, den = 0.0;
for (Size i = 1; i < smoothed_intensities_.size(); ++i)
{
  const double rt_prev = trace_peaks_[i-1].getRT();
  const double rt_curr = trace_peaks_[i].getRT();
  const double dt = rt_curr - rt_prev;
  if (dt <= 0) { continue; }

  const double I_prev = std::max(0.0, smoothed_intensities_[i-1]);
  const double I_curr = std::max(0.0, smoothed_intensities_[i]);
  const double I_avg  = 0.5 * (I_prev + I_curr);

  den += I_avg * dt;
  num += 0.5 * (I_prev * rt_prev + I_curr * rt_curr) * dt;
}
if (den < std::numeric_limits<double>::epsilon())
{
  throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Peak area equals to zero... impossible to compute weights!", String(smoothed_intensities_.size()));
}
centroid_rt_ = num / den;
src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h (1)

19-20: Guard iostream include behind DEBUG_FILTERING to avoid header bloat

This header is widely included; pulling in unconditionally increases compile-time and pulls in heavy iostream machinery even when DEBUG_FILTERING is off. Wrap it to only include when needed.

Apply this diff:

-#include <iostream>
+#ifdef DEBUG_FILTERING
+#  include <iostream>
+#endif
src/tests/topp/CMakeLists.txt (1)

1863-1863: Align the mode name in the comment with the tool’s nomenclature

The comment says “trace” but PR objectives mention the mode as “elutions.” If the CLI/INI actually uses “elutions,” update the comment for consistency (or vice versa). This prevents confusion for future maintainers.

src/tests/class_tests/openms/source/IMTypes_test.cpp (1)

25-25: Test suite name mismatch

START_TEST label says "MSRunIMSplitter" while this file tests IMTypes. Rename for clarity in test outputs.

Apply:

-START_TEST(MSRunIMSplitter, "$Id$")
+START_TEST(IMTypes, "$Id$")
src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1)

39-71: Optionally set drift time unit to reflect intended IM scale

If these data emulate 1/k0 (TIMS), set the unit explicitly to ensure consistent downstream behavior and clearer test intent.

For example:

input.setDriftTimeUnit(DriftTimeUnit::K0);
src/topp/executables.cmake (1)

75-135: Minimize incidental reordering to reduce merge noise

Several unrelated entries show as modified (MetaProSIP, NucleicAcidSearchEngine, SpectraSTSearchAdapter, TextExporter). If those are only reorders, consider isolating in a separate commit to reduce diff noise and future merge conflicts.

src/pyOpenMS/pxds/MSSpectrum.pxd (1)

112-112: Nit: docstring typo

Minor typo in wrap-doc for isSorted(): “sorte” → “sorted”.

Outside the changed hunk, but for completeness:

# wrap-doc:Returns true if the spectrum is sorted by m/z
src/pyOpenMS/pxds/PeakPickerIM.pxd (1)

12-13: Confirm copy-ctor signature (const-ref).

Most OpenMS bindings use a const reference for copy constructors. If the C++ header declares PeakPickerIM(const PeakPickerIM&), adjust here accordingly to avoid an accidental non-const binding.

Proposed tweak (only if header uses const):

-        PeakPickerIM(PeakPickerIM &) except + nogil
+        PeakPickerIM(const PeakPickerIM &) except + nogil
src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp (3)

71-86: Remove verbose std::cout in unit tests.

Debug printing of all peaks will bloat CI logs and obscure failures. Keep tests deterministic and quiet unless debugging locally.

-    // print all peaks in our current input.
-    std::cout << "start printing dummy spectrum BEFORE picking! " << std::endl;
-    for (const auto& peak : input)
-    {
-        std::cout << "m/z: " << peak.getMZ()
-                  << ", intensity: " << peak.getIntensity() << std::endl;
-    }
+    // (no verbose printing)
 
     pp_im.pickIMTraces(input);
-    std::cout << "start printing dummy spectrum AFTER picking! " << std::endl;
-    for (const auto& peak : input)
-    {
-        std::cout << "m/z: " << peak.getMZ()
-                  << ", intensity: " << peak.getIntensity() << std::endl;
-    }
+    // (no verbose printing)

92-95: Avoid asserting on FloatDataArrays position/name for IM; use IM-aware accessors.

Even though these lines are commented, future assertions should not rely on FloatDataArrays[0] or on the name being "Ion Mobility". IM handling in this PR is in flux, and OpenMS provides IM-aware methods to detect IM arrays.

Use C++ helpers (e.g., spec.hasIMData() and IMTypes::determineIMFormat(spec)) to verify IM presence/format rather than array indices/names.


1-36: Consider consolidating with existing PeakPickerIM_test.cpp.

There is already a PeakPickerIM_test.cpp. Adding a “_test_2” file with overlapping scenarios increases maintenance and diverging expectations risk. Prefer extending the existing test with additional START_SECTIONs.

Would you like me to draft a merged test section into PeakPickerIM_test.cpp and remove this file from CMake?

src/tests/topp/PeakPickerIM_parameters_1.ini (1)

9-9: Method value naming: “traces” vs. “elution profiles” terminology.

Top-level method uses “traces”, while the algorithm sub-node names include both “pickIMTraces” and “pickIMElutionProfiles”. Ensure CLI method values, documentation, and section names are aligned to avoid user confusion.

If the intended triad is mobilogram / cluster / elution, consider:

  • restrictions="mobilogram,cluster,elution"
  • rename “pickIMTraces” or “pickIMElutionProfiles” for consistency
src/tests/topp/PeakPickerIM_parameters_2.ini (1)

9-9: Align method naming across files and documentation.

Same note as parameters_1.ini: unify “traces” vs “elution” nomenclature to match the algorithm sections and tool docs.

src/openms/source/IONMOBILITY/IMTypes.cpp (4)

19-19: Keep enum-to-name mapping robust: add a compile-time size check

With new IMFormat entries (centroided, unknown), ensure NamesOfIMFormat stays in lockstep with IMFormat::SIZE_OF_IMFORMAT to prevent silent mismatches.

Apply this diff just after the NamesOfIMFormat declaration:

   const std::string NamesOfIMFormat[] = {"none", "concatenated", "multiple_spectra", "mixed", "centroided", "unknown"};
+
+  // Keep NamesOfIMFormat in sync with IMFormat enum
+  constexpr size_t kIMFormatNamesCount = sizeof(NamesOfIMFormat) / sizeof(NamesOfIMFormat[0]);
+  static_assert(kIMFormatNamesCount == static_cast<size_t>(IMFormat::SIZE_OF_IMFORMAT),
+                "NamesOfIMFormat size must match IMFormat::SIZE_OF_IMFORMAT");

78-88: Improve exception message and value when a single invalid IMFormat is encountered

In the size==1 path, the message/value pair does not reflect the actual offending format; it prints a “Number of different values” which will always be 1 here. Report the concrete IMFormat instead.

-      if (format != IMFormat::CONCATENATED
+      if (format != IMFormat::CONCATENATED
           && format != IMFormat::MULTIPLE_SPECTRA
           && format != IMFormat::CENTROIDED)
       {
-        throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "subfunction returned invalid value(s)", "Number of different values: " + String(occs.size()));
+        throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
+                                      "determineIMFormat(spec) returned unsupported value for experiment aggregation",
+                                      toString(format));
       }

99-107: Short-circuit on set IMFormat, but re-evaluate whether trusting NONE is desired

Returning early for any non-UNKNOWN IMFormat is fast. However, this also trusts a pre-set NONE even if IM data is present. If you want auto-detection in such cases, only trust values NONE/CONCATENATED/MULTIPLE_SPECTRA/CENTROIDED that were set by a reliable importer and keep UNKNOWN as the signal to compute. If that’s intended, please ignore.


110-114: Fix log formatting; avoid embedded newline before period

The debug log currently contains “...\n. Support...”, which produces awkward formatting and a double newline due to std::endl.

-        OPENMS_LOG_DEBUG << "both drift time and IM data array found in spectrum " << spec.getNativeID() << "\n. Support for both is experimental." << std::endl;
+        OPENMS_LOG_DEBUG << "Both drift time and IM data array found in spectrum "
+                         << spec.getNativeID() << ". Support for both is experimental." << std::endl;
src/topp/PeakPickerIM.cpp (3)

41-44: Align CLI method naming with documentation: consider “elutions” instead of “traces”

PR text mentions methods “mobilogram, cluster, elutions”, but the CLI exposes “traces”. For user-facing consistency and discoverability, consider renaming the option to “elutions”.

If you decide to rename:

  • Update valid strings and default here.
  • Adjust the logic branches where method=="traces".
  • Update all .ini files and tests (e.g., PeakPickerIM_parameters_3.ini).

125-129: Add DataProcessing annotation for the in-memory path

Low-memory path adds DataProcessing, the in-memory path currently does not. Add the same processing info before storing.

       mzml.store(output_file, exp);
+      addDataProcessing_(exp, getProcessingInfo_(DataProcessing::PEAK_PICKING));
       return EXECUTION_OK;

Note: If you prefer to annotate before processing, that’s also fine. This mirrors TOPP tool conventions.

Also applies to: 159-161


135-157: OpenMP loop reads shared parameters; acceptable, but optionally hoist reads outside the loop

Reading picker.getParameters() inside the loop is okay, but you could fetch once per method branch before the loop to avoid repeated lookups. Not critical.

src/tests/topp/PeakPickerIM_parameters_3.ini (2)

25-27: Unit description typo and unit consistency

“1/k” and “1/k0” should likely be “1/K0” to match other IM unit naming (“1/K0” in code and docs).

  • im_tolerance_cluster: “Ion mobility tolerance in 1/K0 for clustering”
  • sum_tolerance_im: “Tolerance for summing adjacent ion mobility peaks (1/K0)”

9-9: Method naming consistency with CLI

If you rename the CLI option to “elutions” in the TOPP tool, update restrictions here accordingly (mobilogram, cluster, elutions) and defaults if needed.

src/openms/source/METADATA/SpectrumSettings.cpp (2)

79-86: Throw value string is misleading; report the actual offending IMFormat

The exception currently reports “SIZE_OF_IMFORMAT” as the value, which is a sentinel name, not the offending enum value. Report toString(im_type) or a hardcoded “MIXED”.

   if (im_type == IMFormat::MIXED)
   {
-    throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Single spectrum can't have MIXED ion mobility format.", "SIZE_OF_IMFORMAT");
+    throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
+                                  "Single spectrum can't have MIXED ion mobility format.",
+                                  toString(im_type));
   }

185-199: Peptide identification accessors added; consider adding move-setter to avoid copies

The const-ref setter and both getters are good. To avoid unnecessary copies for large vectors, add an rvalue overload:

Inside SpectrumSettings.h (declaration):

void setPeptideIdentifications(std::vector<PeptideIdentification>&& identification);

And implement in this .cpp (near the existing setter):

void SpectrumSettings::setPeptideIdentifications(std::vector<PeptideIdentification>&& identification)
{
  identification_ = std::move(identification);
}

This mirrors AnnotatedMSRun and improves performance in common move scenarios.

src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)

82-90: Fix API doc reference and consider passing IMFormat by value.

  • The note says "IMFormat::determineIMFormat", but the utility lives in IMTypes (see usage in PeakPickerIM.cpp). Reference should be "IMTypes::determineIMFormat".
  • IMFormat is an enum; passing by const reference is atypical and can be simplified to pass-by-value.

Apply this diff to adjust the signature and Doxygen text:

-    /// @brief sets the IMFormat of the spectrum
-    /// @param im_type
-    void setIMFormat(const IMFormat& im_type);
+    /// @brief Sets the IMFormat of the spectrum
+    /// @param im_type The ion mobility format of the spectrum
+    void setIMFormat(IMFormat im_type);
@@
-    /// Note: If UNKNOWN, use IMFormat::determineIMFormat to determine the IMFormat based on the data.
+    /// Note: If UNKNOWN, use IMTypes::determineIMFormat to determine the IMFormat based on the data.
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)

38-40: Extraneous commented getParameters() line.
The commented "Param getParameters() const;" is redundant since you expose DefaultParamHandler::getParameters; consider removing to avoid confusion.

Apply this diff:

-    /// Gets the current parameters.
-    //Param getParameters() const;
+    /// Gets the current parameters via DefaultParamHandler::getParameters().

41-70: Cluster method docs are helpful; consider adding the IM format side-effect.
If the implementation sets the IM format (e.g., to CENTROIDED) after clustering, document that here. If not, consider doing so for consistency with IM-aware workflows.

I can add a one-liner in the implementation to set the IMFormat and update the doc accordingly if desired.


86-91: Method declared in header but not defined in cpp.
Param getDefaultParameters() is declared here but the implementation is commented out in the .cpp. Either implement it (even as a minimal pass-through to defaults_) or remove the declaration to avoid an incomplete public API.

Apply this diff if you prefer to remove the declaration for now:

-    /// Returns the default parameters.
-    Param getDefaultParameters() const;
-
-    /// Stores the parameters for peak picking.
+    /// Stores the parameters for peak picking.
     Param parameters_;

Alternatively, I can provide a minimal implementation that returns defaults_.


96-106: Doc typo and clarity for sumFrame_.

  • There's a stray extra asterisk before @PARAM use_ppm.
  • Clarify that input_spectrum must be sorted and output_spectrum is appended to (not cleared).

Apply this diff:

-     * @param tolerance Mass tolerance between peaks
-     * * @param use_ppm Whether to use parts per million tolerance. If set to False, absolute tolerance will be used.
+     * @param tolerance Mass tolerance between peaks
+     * @param use_ppm Whether to use parts per million tolerance. If false, absolute tolerance is used.
+     * @note input_spectrum must be sorted by position; output_spectrum is appended to and not cleared.
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (7)

736-761: Precondition: ensure input spectrum is sorted before calling sumFrame_.
sumFrame_ requires sorted input. While most frames are sorted, be defensive and sort if necessary to avoid undefined behavior.

Apply this diff:

       MSSpectrum summed_spectrum;
-      sumFrame_(spectrum, summed_spectrum, sum_tolerance_mz_, true);
+      // Ensure sorted by m/z before summing
+      if (!spectrum.isSorted()) spectrum.sortByPosition();
+      sumFrame_(spectrum, summed_spectrum, sum_tolerance_mz_, true);

334-349: Don't assume position 0 holds FWHM; resolve by name.
Assuming the first FloatDataArray in picked_trace holds IM FWHM is fragile. Resolve by the array name emitted by PeakPickerHiRes for absolute FWHM (typically "FWHM" or similar) to avoid mismatches if additional arrays are attached.

I can update this loop to search for a name match and assert size equality before use. Do you want me to patch it?


314-323: FloatDataArrays retention policy: consider preserving FWHM arrays.
Currently, computeCentroids_ adds "Ion Mobility", "IM FWHM", and "MZ FWHM", but pickIMTraces removes all arrays except "Ion Mobility". This discards potentially useful QC/diagnostic info. If the current tool mode (mobilogram) intends to export only IM values, fine; otherwise, consider keeping the FWHM arrays or gating this by a parameter.

Would you like me to add a parameter (e.g., keep_fwhm_arrays: true/false) and wire it into removeAllFloatDataArraysExcept?

Also applies to: 654-658, 948-949


36-132: Sampling rate mode calculation over doubles may be unstable; consider binning.
Using unordered_map<double,int> to compute a mode over raw doubles is sensitive to tiny numeric differences and can yield a "mode" of a single unique value. Consider binning (e.g., rounding to a fixed resolution or using a histogram with a small bin width) before counting.

I can supply a lightweight binning-based mode computation that avoids floating-point key proliferation.


160-173: sumFrame_: divide-by-zero guard when using ppm.
When current_mz is extremely small, ppm criterion divides by current_mz. Add a small epsilon guard to avoid inf or nan.

Apply this diff:

-        bool within_tolerance = use_ppm
-                                  ? ((delta_mz / current_mz) * 1e6 <= tolerance)
+        bool within_tolerance = use_ppm
+                                  ? (current_mz > std::numeric_limits<double>::epsilon() &&
+                                     (delta_mz / current_mz) * 1e6 <= tolerance)
                                   : (delta_mz <= tolerance);

1116-1328: Clustering implementation: correctness looks solid; complexity is acceptable.

  • Seed selection by intensity, expansion via m/z-neighbor bounds, and used bookkeeping are coherent.
  • Tolerance calculation is consistent across left/right expansion.

Given CodeFactor’s "complex method" notice, optional future refactor could split expansion and averaging into helpers, but not required for this PR.


671-683: Minor whitespace cleanups per static analysis.
There are a few redundant blank lines reported by CodeFactor. Low priority but easy to fix.

I can submit a follow-up patch removing the flagged blank lines.

Also applies to: 1308-1308, 629-629, 731-731, 601-601

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dee0a33 and f9f9a44.

📒 Files selected for processing (27)
  • src/openms/include/OpenMS/IONMOBILITY/IMTypes.h (1 hunks)
  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h (3 hunks)
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h (6 hunks)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1 hunks)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/sources.cmake (1 hunks)
  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h (1 hunks)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp (1 hunks)
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (3 hunks)
  • src/openms/source/IONMOBILITY/IMTypes.cpp (2 hunks)
  • src/openms/source/KERNEL/MassTrace.cpp (6 hunks)
  • src/openms/source/METADATA/MetaInfoInterface.cpp (1 hunks)
  • src/openms/source/METADATA/SpectrumSettings.cpp (5 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/sources.cmake (1 hunks)
  • src/pyOpenMS/pxds/MSSpectrum.pxd (1 hunks)
  • src/pyOpenMS/pxds/PeakPickerIM.pxd (1 hunks)
  • src/tests/class_tests/openms/executables.cmake (1 hunks)
  • src/tests/class_tests/openms/source/IMTypes_test.cpp (2 hunks)
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp (1 hunks)
  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1 hunks)
  • src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp (1 hunks)
  • src/tests/topp/CMakeLists.txt (1 hunks)
  • src/tests/topp/PeakPickerIM_parameters_1.ini (1 hunks)
  • src/tests/topp/PeakPickerIM_parameters_2.ini (1 hunks)
  • src/tests/topp/PeakPickerIM_parameters_3.ini (1 hunks)
  • src/topp/PeakPickerIM.cpp (1 hunks)
  • src/topp/executables.cmake (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp
  • src/tests/class_tests/openms/source/IMTypes_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h
  • src/openms/source/METADATA/MetaInfoInterface.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/IONMOBILITY/IMTypes.h
  • src/openms/source/IONMOBILITY/IMTypes.cpp
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp
  • src/openms/source/METADATA/SpectrumSettings.cpp
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
  • src/openms/source/KERNEL/MassTrace.cpp
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit Inference Engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h
  • src/openms/include/OpenMS/IONMOBILITY/IMTypes.h
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
🧠 Learnings (11)
📓 Common learnings
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp
  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
  • src/tests/topp/CMakeLists.txt
  • src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp
  • src/tests/class_tests/openms/source/IMTypes_test.cpp
  • src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp
  • src/tests/class_tests/openms/source/IMTypes_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
  • src/openms/source/METADATA/SpectrumSettings.cpp
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
  • src/topp/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/SMOOTHING/GaussFilterAlgorithm.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
  • src/pyOpenMS/pxds/MSSpectrum.pxd
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/pyOpenMS/pxds/MSSpectrum.pxd
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/IONMOBILITY/IMTypes.h
  • src/openms/source/IONMOBILITY/IMTypes.cpp
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries

Applied to files:

  • src/topp/executables.cmake
🧬 Code Graph Analysis (9)
src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (3)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)
  • PeakPickerIM (701-718)
src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp (1)
  • START_SECTION (68-95)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-90)
  • spectrum (71-71)
src/tests/class_tests/openms/source/MSSpectrum_test.cpp (1)
src/openms/source/CONCEPT/Exception.cpp (1)
  • InvalidValue (224-228)
src/tests/class_tests/openms/source/PeakPickerIM_test_2.cpp (3)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)
  • OpenMS (24-171)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)
  • PeakPickerIM (701-718)
src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1)
  • START_SECTION (73-85)
src/topp/PeakPickerIM.cpp (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (4)
  • pickIMCluster (1116-1328)
  • pickIMCluster (1116-1116)
  • pickIMElutionProfiles (1329-1399)
  • pickIMElutionProfiles (1329-1329)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (2)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-90)
  • spectrum (71-71)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (126-126)
  • sgolay_polynomial_order_ (127-127)
  • im_tolerance_cluster_ (129-134)
  • ppm_tolerance_elution_ (131-132)
src/openms/source/IONMOBILITY/IMTypes.cpp (1)
src/openms/source/CONCEPT/Exception.cpp (1)
  • InvalidValue (224-228)
src/openms/source/METADATA/SpectrumSettings.cpp (3)
src/openms/source/CONCEPT/Exception.cpp (1)
  • InvalidValue (224-228)
src/openms/source/METADATA/AnnotatedMSRun.cpp (8)
  • getPeptideIdentifications (13-16)
  • getPeptideIdentifications (13-13)
  • getPeptideIdentifications (18-21)
  • getPeptideIdentifications (18-18)
  • setPeptideIdentifications (23-26)
  • setPeptideIdentifications (23-23)
  • setPeptideIdentifications (28-31)
  • setPeptideIdentifications (28-28)
src/openms/source/METADATA/AnnotatedMSRun.h (1)
  • getPeptideIdentifications (83-183)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (19)
  • PeakPickerIM (701-718)
  • pickIMTraces (736-960)
  • pickIMTraces (736-736)
  • pickIMCluster (1116-1328)
  • pickIMCluster (1116-1116)
  • pickIMElutionProfiles (1329-1399)
  • pickIMElutionProfiles (1329-1329)
  • updateMembers_ (719-732)
  • updateMembers_ (719-719)
  • computeOptimalSamplingRate (36-132)
  • computeOptimalSamplingRate (36-36)
  • sumFrame_ (153-187)
  • sumFrame_ (153-156)
  • ppmBounds (135-144)
  • ppmBounds (135-135)
  • extractIonMobilityTraces (195-306)
  • extractIonMobilityTraces (195-197)
  • computeCentroids_ (309-669)
  • computeCentroids_ (309-310)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)
src/openms/source/METADATA/SpectrumSettings.cpp (10)
  • setIMFormat (79-86)
  • setIMFormat (79-79)
  • getIMFormat (88-91)
  • getIMFormat (88-88)
  • getPeptideIdentifications (185-188)
  • getPeptideIdentifications (185-185)
  • getPeptideIdentifications (190-193)
  • getPeptideIdentifications (190-190)
  • setPeptideIdentifications (195-198)
  • setPeptideIdentifications (195-195)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 1116-1328: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1116-L1328
Complex Method


[notice] 1327-1327: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1327
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 1308-1308: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1308
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
🔇 Additional comments (33)
src/openms/source/KERNEL/MassTrace.cpp (4)

407-413: LGTM: single-peak support for RT centroid

The explicit fast-path for singleton traces is clear and consistent with the other centroid methods.


536-537: No functional change

This hunk appears to be whitespace-only around the trailing return; no action needed.


583-588: LGTM: single-peak support for mean MZ

Early-return for singleton traces improves clarity and avoids unnecessary work.


610-615: LGTM: single-peak support for weighted mean MZ

Consistent with other centroid methods; keeps behavior predictable for size()==1.

src/openms/include/OpenMS/METADATA/MetaInfoInterface.h (2)

110-111: Good: explicit default member initialization.

Initializing meta_ to nullptr at the point of declaration eliminates uninitialized state and aligns with the defaulted ctor.


39-39: Defaulted ctor inlined; ABI implications

We confirmed there are no out-of-line definitions of MetaInfoInterface::MetaInfoInterface() in the codebase. The defaulted constructor on line 39 is now inline, so its standalone symbol will no longer be emitted. The destructor remains out-of-line, preserving the vtable anchor.

• Location: src/openms/include/OpenMS/METADATA/MetaInfoInterface.h:39 (MetaInfoInterface() = default;)
• Action: Please verify that no external consumers (plugins, dependent binaries, etc.) rely on the old out-of-line ctor symbol.

src/openms/source/METADATA/MetaInfoInterface.cpp (1)

244-253: addMetaValues merging behavior is safe—no replace‐semantics usages found

Verified all call sites of addMetaValues via rg:

  • In QualityControl (src/topp/QualityControl.cpp), it’s always called on freshly created entries.
  • In IdentificationDataConverter (src/openms/source/METADATA/ID), every hit.clearMetaInfo() precedes addMetaValues.
  • In MzMLHandler, TargetedSpectraExtractor, AccurateMassSearchEngine, Observation::merge and ScoredProcessingResult::operator+=, metadata is merged onto empty or explicitly cleared objects.
  • Unit tests expect overwrite of existing keys and addition of new ones.

No caller relies on implicitly removing old keys. Merging semantics align with the “add” name and existing usage. Approving as is.

src/openms/source/APPLICATIONS/ToolHandler.cpp (1)

150-151: LGTM: Properly registered PeakPickerIM in the centroiding category

Alphabetical order is preserved (PeakPickerHiRes, PeakPickerIM, PeakPickerIterative). No issues.

src/tests/class_tests/openms/source/MSSpectrum_test.cpp (1)

1394-1401: LGTM: Validates that MIXED IMFormat is invalid for a single MSSpectrum

The test aligns with the IMFormat semantics and throws the expected InvalidValue.

src/openms/include/OpenMS/PROCESSING/CENTROIDING/sources.cmake (1)

8-9: LGTM: Exporting PeakPickerIM.h

Header is added to the public Centroiding headers list. Build system-wise this is correct.

src/openms/source/PROCESSING/CENTROIDING/sources.cmake (1)

8-8: Build integration for PeakPickerIM looks correct

Adding PeakPickerIM.cpp to the centroiding sources is correct and matches the new TOPP tool integration.

src/topp/executables.cmake (1)

101-101: TOPP registration for PeakPickerIM looks good

PeakPickerIM is correctly added to the TOPP executables set.

src/pyOpenMS/pxds/MSSpectrum.pxd (1)

93-93: LGTM: exposing containsIMData() in pyOpenMS

Surfacing containsIMData() is useful and consistent with recommended access patterns.

src/openms/include/OpenMS/IONMOBILITY/IMTypes.h (3)

42-47: Good clarification on MIXED/UNKNOWN semantics.

The added note makes the intended scope of MIXED and UNKNOWN clear. This will help avoid misuse across MSSpectrum vs. MSExperiment.


53-54: Position of CENTROIDED in enum and downstream assumptions.

Placing CENTROIDED after MIXED changes ordinal values. If any serialization or code compares enum underlying ints, this could be breaking. It’s usually fine, but double-check consumers that persist IMFormat numerically.

If risky, consider explicitly handling versioned (de)serialization or keeping stable ordinals with aliases.


53-56: IMFormat enum string mappings and conversions are up to date

  • NamesOfIMFormat in IMTypes.cpp already includes “centroided” and “unknown” in the correct order.
  • toIMFormat() and toString() both rely on NamesOfIMFormat, so they automatically handle the new values.
  • No switch(IMFormat) statements exist in the codebase, so there’s no fall-through risk to address.
src/tests/topp/PeakPickerIM_parameters_1.ini (1)

16-31: Parameters look consistent with defaults in implementation.

The defaults for pickIMTraces/Cluster/ElutionProfiles match the constructor snippet from PeakPickerIM and are suitable for TOPP param tests.

src/tests/topp/PeakPickerIM_parameters_2.ini (1)

16-31: Algorithm block mirrors implementation defaults.

Parameters look correct and consistent for the “cluster” method variant.

src/topp/PeakPickerIM.cpp (2)

64-98: Consumer processes spectra correctly; parameter forwarding is fine

The consumer copies the algorithm parameters from the PeakPickerIM instance and dispatches to the appropriate method. The mixed use of instance (pickIMTraces) and class-qualified calls (pickIMCluster/Elution) is fine assuming the latter are declared static in the header, which matches their usage.


99-110: Low-memory path wiring looks correct

MSDataWritingConsumer is used appropriately; processing info is attached and MzMLFile::transform handles streaming.

src/tests/class_tests/openms/executables.cmake (1)

567-569: Good addition of new tests

Registering PeakPickerIM_test and PeakPickerIM_test_2 under transformations aligns with the new functionality.

src/openms/source/METADATA/SpectrumSettings.cpp (3)

31-37: Including peptide identifications in equality is appropriate

Adding identification_ to operator== aligns equality with the new state. Looks good.


65-66: Merge peptide identifications during unify() is reasonable

Appending identification_ mirrors the behavior of precursors/products. Consider deduplicating if that becomes a concern later; for now, fine.


88-91: Getter for IMFormat is straightforward

Simple accessor returning im_type_; looks good.

src/openms/include/OpenMS/METADATA/SpectrumSettings.h (5)

19-19: LGTM: IMTypes include is appropriate for IMFormat usage.
Brings in IMFormat cleanly; no concerns.


56-63: Modernized special members look good.
Defaulted/move/noexcept adjustments are consistent and reduce boilerplate.


137-143: New peptide identification accessors are consistent with OpenMS conventions.
Signatures and const/mutable variants mirror patterns elsewhere (e.g., Feature, ProteinIdentification).


155-156: LGTM: Sensible defaults for spectrum and IM formats.
Initializing to UNKNOWN avoids uninitialized state and matches getters' semantics.


164-165: Confirm operators and unify() include new members.
With new members identification_ and im_type_, ensure operator==/!= and unify() were updated accordingly (source snippet suggests yes). Please double-check equality semantics and unify merging rules for peptide IDs.

src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (3)

21-33: Class intro and minimal API are clear.
Good Doxygen and DefaultParamHandler inheritance. Public API surface is reasonable.


71-81: Elution profiles method doc LGTM.
Parameters and intent are clear.


121-132: Parameter caching members LGTM.
Names match defaults and updateMembers_ in the implementation.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)

1329-1399: Elution profile path uses getIMData and established modules; looks good.
The transformation via IMDataConverter, MTD, and EPD is consistent. Sorting and updateRanges at the end are appropriate.

Comment thread src/pyOpenMS/pxds/PeakPickerIM.pxd Resolved
Comment thread src/tests/topp/CMakeLists.txt Resolved

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eec7e46 and 6f39084.

📒 Files selected for processing (3)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp (1 hunks)
  • src/tests/class_tests/openms/executables.cmake (2 hunks)
  • src/topp/executables.cmake (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
PR: OpenMS/OpenMS#8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
  • src/topp/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/topp/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries

Applied to files:

  • src/topp/executables.cmake
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
🔇 Additional comments (4)
src/topp/executables.cmake (2)

101-101: PeakPickerIM registered in TOPP list — good placement

Placed alongside other PeakPicker tools; build integration looks correct.


75-75: Confirm reordering in executables.cmake and update docs
Entries for MetaProSIP, NucleicAcidSearchEngine, SpectraSTSearchAdapter and TextExporter were reordered at lines 75, 87, 131 and 134—if this isn’t required for dependency or UX reasons, please revert to minimize merge noise. The new tool PeakPickerIM is correctly registered in ToolHandler (src/openms/source/APPLICATIONS/ToolHandler.cpp:150) and in executables.cmake (line 101), and all OpenNuXL references have been removed. Please add PeakPickerIM to the documentation’s tool list.

src/tests/class_tests/openms/executables.cmake (2)

273-273: No-op formatting change

Nothing to do here.


572-574: Approve PeakPickerIM class tests

Good placement under transformations next to other PeakPicker tests.

Comment thread src/topp/executables.cmake Resolved
@timosachsenberg timosachsenberg mentioned this pull request Sep 17, 2025
5 tasks

@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

🧹 Nitpick comments (3)
src/openms/source/APPLICATIONS/ToolHandler.cpp (3)

164-169: QCShrinker mapped with wrong internal name ("QCExporter").

This likely breaks help/lookup for QCShrinker and can confuse tooling.

Apply:

-    tools_map["QCShrinker"] = Internal::ToolDescription("QCExporter", cat_QC);
+    tools_map["QCShrinker"] = Internal::ToolDescription("QCShrinker", cat_QC);

318-322: Do not mutate tools_external_.category in loadInternalToolConfig_.

This erroneously relabels the GenericWrapper descriptor; remove the assignment.

-        tools_internal_.push_back(tools[i_t]);
-        tools_external_.category = "INTERNAL";
+        tools_internal_.push_back(tools[i_t]);

220-221: Fix minor formatting in duplicate-name exception message.

Close the quote after the tool name for clearer diagnostics.

-        throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Duplicate tool name error: Trying to add internal tool '" + it->name, it->name);
+        throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Duplicate tool name error: Trying to add internal tool '" + it->name + "'", it->name);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f39084 and 6805ca3.

📒 Files selected for processing (2)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp (1 hunks)
  • src/tests/topp/CMakeLists.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/topp/CMakeLists.txt
🧰 Additional context used
📓 Path-based instructions (1)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/APPLICATIONS/ToolHandler.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)

@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: 0

🧹 Nitpick comments (1)
src/topp/executables.cmake (1)

99-101: Keep the TOPP executable list ordered

The list is otherwise alphabetical; dropping PeakPickerIM in after PeakPickerIterative breaks the ordering and will make future merges noisier. Please slot it before PeakPickerIterative to preserve the pattern.

-  PeakPickerHiRes
-  PeakPickerIterative
-  PeakPickerIM
+  PeakPickerHiRes
+  PeakPickerIM
+  PeakPickerIterative
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6805ca3 and ba218e6.

📒 Files selected for processing (4)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp (1 hunks)
  • src/tests/class_tests/openms/executables.cmake (2 hunks)
  • src/tests/topp/CMakeLists.txt (1 hunks)
  • src/topp/executables.cmake (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
PR: OpenMS/OpenMS#8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/topp/executables.cmake
  • src/tests/topp/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/topp/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries

Applied to files:

  • src/topp/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/topp/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
🔇 Additional comments (2)
src/tests/class_tests/openms/executables.cmake (1)

573-574: New PeakPickerIM test registrations look good

Both PeakPickerIM test executables are now wired into the transformations suite as expected. Thanks for keeping the listing up to date.

src/tests/topp/CMakeLists.txt (1)

1832-1839: Add missing dependencies for the new PeakPickerIM diff checks

The _out1 comparison tests for PeakPickerIM still don't depend on their corresponding generator tests. Under parallel ctest runs, the diff step can execute before the tool produces its output, causing flaky failures. Please add set_tests_properties(... PROPERTIES DEPENDS ...) so each _out1 waits for its paired tool invocation. Based on learnings.

 add_test("TOPP_PeakPickerIM_1" ${TOPP_BIN_PATH}/PeakPickerIM -in ${DATA_DIR_TOPP}/PeakPickerIM_input_1.mzML -ini ${DATA_DIR_TOPP}/PeakPickerIM_parameters_1.ini -out PeakPickerIM_1.tmp.mzML -test)
 add_test("TOPP_PeakPickerIM_1_out1" ${DIFF} -whitelist ${INDEX_WHITELIST} -in1 PeakPickerIM_1.tmp.mzML -in2 ${DATA_DIR_TOPP}/PeakPickerIM_1_output.mzML)
+set_tests_properties("TOPP_PeakPickerIM_1_out1" PROPERTIES DEPENDS "TOPP_PeakPickerIM_1")
 # test 'cluster' method
 add_test("TOPP_PeakPickerIM_2" ${TOPP_BIN_PATH}/PeakPickerIM -in ${DATA_DIR_TOPP}/PeakPickerIM_input_1.mzML -ini ${DATA_DIR_TOPP}/PeakPickerIM_parameters_2.ini -out PeakPickerIM_2.tmp.mzML -test)
 add_test("TOPP_PeakPickerIM_2_out1" ${DIFF} -whitelist ${INDEX_WHITELIST} -in1 PeakPickerIM_2.tmp.mzML -in2 ${DATA_DIR_TOPP}/PeakPickerIM_2_output.mzML)
+set_tests_properties("TOPP_PeakPickerIM_2_out1" PROPERTIES DEPENDS "TOPP_PeakPickerIM_2")
 # test 'trace' method
 add_test("TOPP_PeakPickerIM_3" ${TOPP_BIN_PATH}/PeakPickerIM -in ${DATA_DIR_TOPP}/PeakPickerIM_input_1.mzML -ini ${DATA_DIR_TOPP}/PeakPickerIM_parameters_3.ini -out PeakPickerIM_3.tmp.mzML -test)
 add_test("TOPP_PeakPickerIM_3_out1" ${DIFF} -whitelist ${INDEX_WHITELIST} -in1 PeakPickerIM_3.tmp.mzML -in2 ${DATA_DIR_TOPP}/PeakPickerIM_3_output.mzML)
+set_tests_properties("TOPP_PeakPickerIM_3_out1" PROPERTIES DEPENDS "TOPP_PeakPickerIM_3")

@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: 0

🧹 Nitpick comments (3)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)

309-668: Comprehensive centroid computation implementation with efficient processing.

The function is well-structured with proper error handling for edge cases (single peaks, empty traces) and includes efficient optimizations like vector reuse and sorted index checking. The spline-based peak fitting and FWHM calculation is mathematically sound.

The function is quite complex (361 lines). Consider extracting smaller helper functions for single-peak handling, spline fitting, and FWHM calculation to improve readability and maintainability.


735-959: Comprehensive mobilogram peak picking workflow implementation.

The implementation provides a complete workflow for ion mobility peak picking including proper data flow from m/z projection through smoothing, resampling, and final centroiding. The extensive debug output facilitates troubleshooting.

This function is quite long (224 lines) and could benefit from extraction into smaller, focused methods for each processing stage (projection, smoothing, peak picking, centroiding).


1115-1326: Well-optimized clustering algorithm with intensity-based seed selection.

The clustering implementation uses an efficient intensity-sorted seed selection approach and proper expansion logic. The algorithm correctly maintains cluster bounds and performs intensity-weighted averaging.

This function is quite complex (211 lines). Consider breaking it into smaller functions for seed selection, cluster expansion, and finalization to improve readability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba218e6 and 1fccf7d.

📒 Files selected for processing (3)
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (3 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/tests/topp/CMakeLists.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧠 Learnings (4)
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
PR: OpenMS/OpenMS#8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
PR: OpenMS/OpenMS#8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-90)
  • spectrum (71-71)
src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (2)
  • updateMembers_ (603-612)
  • updateMembers_ (603-603)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (126-126)
  • sgolay_polynomial_order_ (127-127)
  • im_tolerance_cluster_ (129-134)
  • ppm_tolerance_elution_ (131-132)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 1116-1328: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1116-L1328
Complex Method


[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
🔇 Additional comments (10)
src/tests/topp/CMakeLists.txt (1)

1832-1842: Thanks for wiring the DIFF tests to their generators

The added set_tests_properties(... DEPENDS ...) calls guarantee the PeakPickerIM_*_out1 diffs always run after their corresponding tool invocations, so the new TOPP coverage stays deterministic even under parallel CTest runs. Based on learnings.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (7)

36-132: LGTM: Well-implemented optimal sampling rate computation.

The function correctly computes optimal sampling rates using percentile filtering and mode detection. The early returns for insufficient data and appropriate debugging output make this robust.


135-144: LGTM: Correct ppm bounds calculation.

The ppm tolerance bounds calculation is mathematically sound and appropriately handles the conversion from ppm to absolute delta values.


153-187: LGTM: Robust peak summing implementation with proper tolerance handling.

The function correctly handles both ppm and absolute tolerance modes, includes proper precondition checking, and efficiently accumulates peaks within tolerance bounds.


700-731: LGTM: Well-structured constructor and parameter initialization.

The constructor properly sets up default parameters with appropriate categorization for different peak picking methods and correctly initializes the parameter handling chain.


1327-1397: LGTM: Effective elution profile detection using established OpenMS algorithms.

The implementation cleverly converts IM frames to RT-based spectra for compatibility with existing MassTraceDetection and ElutionPeakDetection algorithms, with appropriate parameter tuning for the ion mobility context.


225-242: **Use the canonical getIMData() API instead of searching by name.**Based on the search results and the learnings provided, the manual search through FloatDataArrays by name should be replaced with the canonical getIMData() API. This is more robust than name matching which can be brittle with vendor-specific labels.

Replace the manual loop with the established OpenMS API for ion mobility data access. Based on learnings from previous reviews, the proper way to access ion mobility data is using MSSpectrum::getIMData().

Apply this diff:

-      // Get the Ion Mobility array from raw_spectrum
-      const auto& raw_float_data_arrays = raw_spectrum.getFloatDataArrays();
-      const MSSpectrum::FloatDataArray* ion_mobility_array = nullptr;
-
-      for (const auto& array : raw_float_data_arrays)
-      {
-        if (array.getName() == "Ion Mobility" || array.getName() == "mean inverse reduced ion mobility array")
-        {
-          ion_mobility_array = &array;
-          break;
-        }
-      }
-
-      if (!ion_mobility_array)
-      {
-        std::cerr << "Ion Mobility data array not found in raw_spectrum!" << std::endl;
-        return {};
-      }
+      // Get the Ion Mobility array index from raw_spectrum using canonical API
+      const auto [im_data_index, im_unit] = raw_spectrum.getIMData();
+      if (im_data_index == -1)
+      {
+        std::cerr << "Ion Mobility data array not found in raw_spectrum!" << std::endl;
+        return {};
+      }
+      const auto& ion_mobility_array = raw_spectrum.getFloatDataArrays()[im_data_index];

Also update the references to use the array directly:

-          trace_spectrum.emplace_back((*ion_mobility_array)[left_idx], raw_spectrum[left_idx].getIntensity()); // currently Ion Mobility as m/z
+          trace_spectrum.emplace_back(ion_mobility_array[left_idx], raw_spectrum[left_idx].getIntensity()); // currently Ion Mobility as m/z
@@
-          trace_spectrum.emplace_back((*ion_mobility_array)[right_idx], raw_spectrum[right_idx].getIntensity());
+          trace_spectrum.emplace_back(ion_mobility_array[right_idx], raw_spectrum[right_idx].getIntensity());

Based on learnings


941-949: Critical: Assignment destroys computed peaks and metadata handling needs correction.

The assignment centroided_frame = static_cast<SpectrumSettings>(spectrum) replaces the computed centroided data with an empty spectrum containing only the metadata from the input spectrum.

Apply this diff to preserve the centroided data while copying metadata:

-      // Replace the input spectrum with the centroided result but ensure that other meta data is preserved
-      // swap the peaks and data arrays (while keeping meta data)
-      centroided_frame = static_cast<SpectrumSettings>(spectrum); // swaps meta data
-      centroided_frame.setMSLevel(spectrum.getMSLevel());
-      centroided_frame.setName(spectrum.getName());
-      centroided_frame.setRT(spectrum.getRT());
-      removeAllFloatDataArraysExcept(centroided_frame, "Ion Mobility");
-      spectrum = std::move(centroided_frame);
+      // Copy metadata from input to centroided result while preserving computed peaks
+      static_cast<SpectrumSettings&>(centroided_frame) = static_cast<const SpectrumSettings&>(spectrum);
+      centroided_frame.setMSLevel(spectrum.getMSLevel());
+      centroided_frame.setName(spectrum.getName());
+      centroided_frame.setRT(spectrum.getRT());
+      removeAllFloatDataArraysExcept(centroided_frame, "Ion Mobility");
+      spectrum = std::move(centroided_frame);
src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (2)

115-125: Early exit optimization is appropriate, but missing zero-length trace handling.

The early exit for traces shorter than 3 data points is a good optimization. However, there's a missing guard for zero-length traces that could cause tr.findMaxByIntPeak(true) to crash when called on empty traces.

Apply this diff to add the missing zero-length guard:

+    if (mt_length == 0)
+    {
+      return;
+    }
     if (mt_length < 3)
     {
       // determine the index of maximum intensity
       Size max_idx(tr.findMaxByIntPeak(true));
       chrom_maxes.push_back(max_idx);
       return;
     }

550-554: Extend the fast-path to handle 2-point traces for Savitzky-Golay compatibility.

The current fast-path only handles single-point traces, but Savitzky-Golay smoothing requires a minimum frame length of 3. With a 2-point trace, it will fail or produce undefined behavior.

Apply this diff to extend the bypass for 2-point traces:

-    if (mt.getSize() == 1)
+    if (mt.getSize() < 3)
     {
-      mt.setSmoothedIntensities(std::vector<double>(1, mt[0].getIntensity()));
+      std::vector<double> smoothed;
+      smoothed.reserve(mt.getSize());
+      for (Size i = 0; i < mt.getSize(); ++i)
+      {
+        smoothed.push_back(mt[i].getIntensity());
+      }
+      mt.setSmoothedIntensities(smoothed);
       return;
     }

@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: 2

🧹 Nitpick comments (5)
src/tests/class_tests/openms/source/IMTypes_test.cpp (2)

128-137: Missing explicit assertion for experiment-level MIXED format.

The test creates an experiment with three spectra (MULTIPLE_SPECTRA, CONCATENATED, and a mixed one with both) but only asserts the final result. Add an explicit assertion to document expected behavior for mixed experiments.

Apply this change to make the test expectation more explicit:

   {
     // set both ... is valid (typically concatenated + some average value)
     auto IMwithFDA2 = IMwithFDA;
     IMwithFDA2.setDriftTime(123.4);
+    IMwithFDA2.setDriftTimeUnit(DriftTimeUnit::VSSC);
     MSExperiment exp;
     exp.addSpectrum(IMwithDrift);
     exp.addSpectrum(IMwithFDA);
     exp.addSpectrum(IMwithFDA2);
+    // Explicitly test that mixed experiment returns MIXED format
     TEST_EQUAL(IMTypes::determineIMFormat(exp) == IMFormat::MIXED, true)
   }

150-154: Add verification for mixed IM representation at spectrum level.

The test creates a spectrum with both drift time and IM data array but doesn't verify that both are preserved. Add assertions to ensure both representations remain accessible.

Apply this diff to verify both IM representations are preserved:

   // set both ... is valid (typically concatenated + some average value)
   auto IMwithFDA2 = IMwithFDA;
   IMwithFDA2.setDriftTime(123.4);
-  TEST_EQUAL(IMTypes::determineIMFormat(IMwithFDA2) == IMFormat::MIXED, true)
+  TEST_EQUAL(IMTypes::determineIMFormat(IMwithFDA2) == IMFormat::MIXED, true)
+  // Verify both representations are preserved
+  TEST_EQUAL(IMwithFDA2.getDriftTime(), 123.4)
+  TEST_EQUAL(IMwithFDA2.containsIMData(), true)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)

1098-1309: Extract complex clustering logic into helper functions.

The pickIMCluster function spans over 200 lines with deeply nested logic. Consider extracting the cluster expansion logic and cluster finalization into separate helper functions for better maintainability.

Consider restructuring like:

// Helper to expand cluster boundaries
bool expandCluster(const vector<Point>& points, 
                   vector<bool>& used,
                   vector<Size>& cluster_indices,
                   double& cluster_mz_min, double& cluster_mz_max,
                   double& cluster_im_min, double& cluster_im_max,
                   SignedSize& left_idx, SignedSize& right_idx,
                   double ppm_factor, double im_tolerance);

// Helper to finalize cluster into averaged point
Point finalizeCluster(const vector<Point>& points, 
                     const vector<Size>& cluster_indices);

293-652: Consider extracting spline-based peak finding logic.

The computeCentroids_ function contains complex spline interpolation and FWHM calculation logic that could be extracted into a separate helper function for better testability and reusability.

Consider extracting the spline peak finding (lines 477-628) into a helper method:

struct PeakResult {
  double apex_mz;
  double apex_intensity;
  double mz_fwhm;
};

PeakResult findPeakWithSpline(const vector<double>& mz_values,
                              const vector<double>& intensity_values);

654-666: Rename function to follow OpenMS naming conventions.

The function removeAllFloatDataArraysExcept should be a class member and follow the member function naming convention with trailing underscore for internal methods.

-    void removeAllFloatDataArraysExcept(OpenMS::MSSpectrum& spectrum, const String& keep_name)
+    void PeakPickerIM::removeAllFloatDataArraysExcept_(MSSpectrum& spectrum, const String& keep_name) const

And update the call site on line 929:

-      removeAllFloatDataArraysExcept(centroided_frame, "Ion Mobility");
+      removeAllFloatDataArraysExcept_(centroided_frame, "Ion Mobility");
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fccf7d and d066d79.

📒 Files selected for processing (4)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/pyOpenMS/pxds/MSSpectrum.pxd (1 hunks)
  • src/pyOpenMS/pxds/PeakPickerIM.pxd (1 hunks)
  • src/tests/class_tests/openms/source/IMTypes_test.cpp (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/IMTypes_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧠 Learnings (7)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/IMTypes_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/IMTypes_test.cpp
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/pyOpenMS/pxds/MSSpectrum.pxd
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/pxds/MSSpectrum.pxd
  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/pyOpenMS/pxds/MSSpectrum.pxd
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
PR: OpenMS/OpenMS#8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (2)
src/tests/class_tests/openms/source/IMTypes_test.cpp (1)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-125)
  • determineIMFormat (95-95)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (2)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-90)
  • spectrum (71-71)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (126-126)
  • sgolay_polynomial_order_ (127-127)
  • im_tolerance_cluster_ (129-134)
  • ppm_tolerance_elution_ (131-132)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 1116-1328: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1116-L1328
Complex Method


[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
🔇 Additional comments (5)
src/pyOpenMS/pxds/MSSpectrum.pxd (2)

90-91: LGTM! Cython wrappers now match the C++ API.

The method signatures have been corrected from getIMType/setIMType to getIMFormat/setIMFormat, which aligns with the C++ declarations in SpectrumSettings.h and prevents compilation errors.


90-91: Verify proper usage of the getIMData() method.

Based on learnings, the getIMData() method (line 94) is the canonical way to access ion mobility data, returning a tuple with (position, unit). Ensure that any code using these new IM format methods also properly uses getIMData() rather than assuming the first FloatDataArray contains IM data.

Based on learnings

src/pyOpenMS/pxds/PeakPickerIM.pxd (1)

1-15: LGTM! Properly bound as a class method.

The pickIMTraces method is correctly declared as a member function of the PeakPickerIM cppclass, which matches the C++ API usage pattern shown in the tests.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (2)

225-226: LGTM! Using canonical getIMData() method.

The code correctly uses getIMData() to retrieve the ion mobility data array index and unit, which aligns with the established best practice.

Based on learnings


924-926: Critical: Fix metadata assignment to preserve centroided peaks.

The code correctly copies only the SpectrumSettings metadata without overwriting the peaks. The static_cast to base class reference ensures only metadata is copied while preserving the centroided data already in centroided_frame.

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d066d79 and dd0d675.

📒 Files selected for processing (1)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧠 Learnings (2)
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
PR: OpenMS/OpenMS#8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (2)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-90)
  • spectrum (71-71)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (126-126)
  • sgolay_polynomial_order_ (127-127)
  • im_tolerance_cluster_ (129-134)
  • ppm_tolerance_elution_ (131-132)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 1116-1328: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L1116-L1328
Complex Method


[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
🔇 Additional comments (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)

224-227: Guard getIMData() to avoid hard crashes

Line [225] calls raw_spectrum.getIMData() without first verifying containsIMData(). On spectra lacking IM data this throws Exception::MissingInformation, aborting the entire run. Please follow the established pattern of checking containsIMData() and bail out gracefully when IM data is absent.

-      const auto [im_data_index, im_unit] = raw_spectrum.getIMData();
+      if (!raw_spectrum.containsIMData())
+      {
+        OPENMS_LOG_WARN << "No ion mobility data found in spectrum." << std::endl;
+        return {};
+      }
+      const auto [im_data_index, im_unit] = raw_spectrum.getIMData();

Based on learnings

@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: 0

♻️ Duplicate comments (2)
src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1)

144-147: Use containsIMData()/getIMData() API instead of direct array access.

Directly accessing getFloatDataArrays()[0] assumes the IM array is at index 0, which is brittle. Use the established OpenMS pattern to locate and validate IM data.

Apply this diff:

-    TEST_EQUAL(input.getFloatDataArrays().size(), 1)
-    TEST_EQUAL(input.getFloatDataArrays()[0].getName(), "Ion Mobility")
-    TEST_REAL_SIMILAR(input.getFloatDataArrays()[0][0], 0.8)
+    TEST_EQUAL(input.containsIMData(), true)
+    auto [im_idx, im_unit] = input.getIMData();
+    TEST_EQUAL(input.getFloatDataArrays().size() > im_idx, true)
+    TEST_EQUAL(input.getFloatDataArrays()[im_idx].getName(), "Ion Mobility")
+    TEST_REAL_SIMILAR(input.getFloatDataArrays()[im_idx][0], 0.8)

Based on learnings

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)

34-37: Remove hard-coded DEBUG_PICKER define.

The DEBUG_PICKER macro is unconditionally defined, causing debug output to ship in production builds. Remove the define and let build flags control debug behavior.

Apply this diff:

-#define DEBUG_PICKER
 #ifdef DEBUG_PICKER
 #include <OpenMS/FORMAT/MzMLFile.h>
 #endif
🧹 Nitpick comments (4)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (4)

62-63: Standardize on OpenMS logging mechanisms.

Several std::cerr calls should use OPENMS_LOG_WARN or OPENMS_LOG_DEBUG for consistency with OpenMS conventions and to respect log-level configuration.

Apply this diff:

-          std::cerr << "Skipping trace " << s << " because it has too few points ("
-                    << summed_trace.size() << ")." << std::endl;
+          OPENMS_LOG_DEBUG << "Skipping trace " << s << " because it has too few points ("
+                           << summed_trace.size() << ")." << std::endl;
-        std::cerr << "Warning: No valid m/z differences found in any spectra. Using default sampling rate of 0.01" << std::endl;
+        OPENMS_LOG_WARN << "No valid m/z differences found in any spectra. Using default sampling rate of 0.01" << std::endl;
-        std::cerr << "Warning: No valid small m/z differences found after filtering. Using default sampling rate of 0.01" << std::endl;
+        OPENMS_LOG_WARN << "No valid small m/z differences found after filtering. Using default sampling rate of 0.01" << std::endl;

As per coding guidelines

Also applies to: 80-81, 109-109


220-221: Replace std::cerr with OpenMS logging.

Additional std::cerr calls in this function should use OpenMS logging for consistency.

Apply this diff:

-        std::cerr << "FWHM data array not found!" << std::endl;
+        OPENMS_LOG_ERROR << "FWHM data array not found!" << std::endl;
-        std::cerr << "Size mismatch between FWHM array and picked peaks!" << std::endl;
+        OPENMS_LOG_ERROR << "Size mismatch between FWHM array and picked peaks!" << std::endl;
-          std::cerr << "No raw peaks found near picked m/z: " << picked_mz << std::endl;
+          OPENMS_LOG_WARN << "No raw peaks found near picked m/z: " << picked_mz << std::endl;

As per coding guidelines

Also applies to: 226-227, 253-254


331-332: Standardize logging in computeCentroids_.

Multiple std::cerr calls should use OpenMS logging mechanisms for consistency.

Apply this diff to replace error logging:

-          std::cerr << "No IM FWHM array found for picked_trace " << i << "!" << std::endl;
+          OPENMS_LOG_ERROR << "No IM FWHM array found for picked_trace " << i << "!" << std::endl;

Similar changes apply to lines 340, 349, 358, and 394 where std::cerr should be replaced with OPENMS_LOG_ERROR or OPENMS_LOG_WARN as appropriate.

As per coding guidelines

Also applies to: 340-341, 349-350, 358-359, 394-395


513-514: Consider addressing TODO comments.

Several TODO comments remain in the code (lines 513-514, 1274). While these don't block functionality, they indicate potential areas for future improvement or unresolved questions.

Consider either:

  1. Addressing the TODOs and removing the comments
  2. Creating issues to track these items if they require broader discussion
  3. Removing the TODOs if they're no longer relevant

Also applies to: 1274-1274

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2f4b1a and 415c246.

📒 Files selected for processing (2)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧠 Learnings (19)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (2)
src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (3)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)
  • OpenMS (25-167)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)
  • PeakPickerIM (677-694)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-93)
  • spectrum (71-71)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-93)
  • spectrum (71-71)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (130-130)
  • sgolay_polynomial_order_ (131-131)
  • im_tolerance_cluster_ (133-137)
  • ppm_tolerance_elution_ (135-136)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-126)
  • determineIMFormat (95-95)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: build-and-test (macos-26, xcode, 26.0)
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-macos
  • GitHub Check: build-lnx
  • GitHub Check: build-and-test (macos-15-intel, xcode, 16.0.0)
  • GitHub Check: build-macos-arm
  • GitHub Check: build-win

@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

♻️ Duplicate comments (1)
src/topp/PeakPickerIM.cpp (1)

134-166: Attach PEAK_PICKING DataProcessing info in in‑memory path as well

The in‑memory branch currently writes exp without recording that peak picking was performed, whereas the low‑memory path adds DataProcessing::PEAK_PICKING. This loses algorithm provenance in the output mzML.

Mirror the low‑memory behavior by annotating spectra before store:

       PeakMap exp;
       MzMLFile mzml;
       mzml.load(input_file, exp);
@@
       }
 
-      mzml.store(output_file, exp);
+      // annotate processing
+      {
+        const DataProcessingPtr dp = getProcessingInfo_(DataProcessing::PEAK_PICKING);
+        for (auto& s : exp)
+        {
+          s.getDataProcessing().push_back(dp);
+        }
+      }
+      mzml.store(output_file, exp);
       return EXECUTION_OK;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 415c246 and f51173b.

📒 Files selected for processing (1)
  • src/topp/PeakPickerIM.cpp (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/topp/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/topp/PeakPickerIM.cpp
🧬 Code graph analysis (1)
src/topp/PeakPickerIM.cpp (2)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)
  • OpenMS (25-167)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (4)
  • pickIMCluster (969-1195)
  • pickIMCluster (969-969)
  • pickIMElutionProfiles (1197-1283)
  • pickIMElutionProfiles (1197-1197)
🔇 Additional comments (2)
src/topp/PeakPickerIM.cpp (2)

103-113: Low‑memory path looks correct and consistent

The streaming helper wires Consumer into MzMLFile::transform, propagates log_type_, and attaches PEAK_PICKING DataProcessing via addDataProcessing, which matches typical TOPP patterns for low‑memory processing.


138-163: No thread-safety concern exists in this code.

The review comment's concern about picker being shared in the parallel loop is unfounded. Verification shows:

  • Member variables are all primitive types (double, int) initialized once and never modified: sum_tolerance_mz_, gauss_ppm_tolerance_, sum_tolerance_im_, etc.
  • pickIMTraces() only reads these cached values; it performs no writes to shared member state.
  • All computation uses local variables (GaussFilter, LinearResamplerAlign, MSSpectrum objects, vectors, etc.), not shared buffers.
  • Each thread processes its own independent spectrum from exp[i], avoiding data races at the spectrum level.
  • The static methods pickIMCluster and pickIMElutionProfiles don't use instance state at all.

The code is inherently thread-safe for this usage pattern. No refactoring is needed.

Likely an incorrect or invalid review comment.

Comment thread src/topp/PeakPickerIM.cpp Resolved

@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

♻️ Duplicate comments (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

85-89: Fix the incorrect example code.

The example references IMFrame::toSpectrum which doesn't exist. This was previously flagged and should be corrected or removed.

Apply this diff to fix the example:

-     * Example:
-     * @code
-     * MSSpectrum input;  // spectrum with IM data
-     * IMFrame::toSpectrum(input_spectrum);
-     * @endcode
+     * @code
+     * MSSpectrum spec; // spectrum with IM data
+     * PeakPickerIM::pickIMCluster(spec, 50.0, 0.1);
+     * // spec now holds centroided peaks with averaged IM values
+     * @endcode
🧹 Nitpick comments (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

141-144: Consider removing unused member variables for static methods.

ppm_tolerance_cluster_, im_tolerance_cluster_, and ppm_tolerance_elution_ are declared as instance members, but their corresponding methods (pickIMCluster and pickIMElutionProfiles) are static and receive these values as parameters. Static methods cannot access instance members.

Looking at the TOPP tool usage, parameters are retrieved from the Param object and passed directly to the static methods, making these member variables dead code.

Consider removing these unused members:

-    double ppm_tolerance_cluster_{50.0};
-    double im_tolerance_cluster_{0.1};
-
-    double ppm_tolerance_elution_{50.0};

Alternatively, if these methods are intended to use instance configuration, consider making them non-static like pickIMTraces.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f51173b and 5593084.

📒 Files selected for processing (1)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧠 Learnings (14)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-10-15T07:49:09.293Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h:11-14
Timestamp: 2025-10-15T07:49:09.293Z
Learning: In OpenMS, DefaultParamHandler.h is located under OpenMS/DATASTRUCTURES/, not OpenMS/CONCEPT/. The correct include is: `#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>`

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-05-23T10:58:51.257Z
Learnt from: pjones
Repo: OpenMS/OpenMS PR: 8042
File: doc/doxygen/install/install-linux.doxygen:37-37
Timestamp: 2025-05-23T10:58:51.257Z
Learning: In the OpenMS project, Doxygen is run with a non-standard working directory, so snippet paths that may look incorrect (like "../../tools/ci/deps-ubuntu.sh" in doc/doxygen/install/install-linux.doxygen) are actually correct. The snippet markers in shell scripts use the format "# [marker_name]" rather than the alternative "#! [marker_name]" format.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧬 Code graph analysis (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (71-93)
  • spectrum (71-71)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-win
  • GitHub Check: build-lnx
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (macos-15-intel, xcode, 16.0.0)
🔇 Additional comments (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

132-134: I'll verify the claim about the missing removeAllFloatDataArraysExcept declaration. Let me search the codebase systematically.
<function_calls>

#!/bin/bash

First, find the PeakPickerIM files

echo "=== Locating PeakPickerIM files ==="
find . -name "PeakPickerIM*" -type f 2>/dev/null | head -20

echo ""
echo "=== Checking for removeAllFloatDataArraysExcept in all files ==="
rg -n "removeAllFloatDataArraysExcept" --type=cpp -C2

echo ""
echo "=== Checking header file size and content ==="
wc -l src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h


</function_calls>

<function_calls>

#!/bin/bash

Read the full header file to see all declarations

echo "=== Reading PeakPickerIM.h header ==="
cat -n src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h


</function_calls>

timosachsenberg and others added 2 commits December 4, 2025 15:43
- Fix MetaInfoInterface::addMetaValues to copy both String and UInt keys
- Fix ElutionPeakDetection empty trace crash and extend smoothing for 2-point traces
- Standardize IM array output name to "Ion Mobility Centroid" using constant
- Use Constants::UserParam::ION_MOBILITY and ION_MOBILITY_CENTROID throughout
- Add error when PeakPickerIM receives already centroided IM data
- Add early validation in PeakPickerIM TOPP tool for centroided/missing IM data
- Remove unused ION_MOBILITY_DESCRIPTION from OpenSwathScoring.h
- Update test files to use IM constants instead of hardcoded strings
- Add CHANGELOG entries for PeakPickerIM

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

@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: 0

♻️ Duplicate comments (5)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)

6-6: Check whether the $Authors header line should remain.

This $Authors line appears to have been removed on develop previously and may have been reintroduced by accident. Please align with current project conventions for these header comments or drop it again if it was intentionally removed earlier.

src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp (1)

1517-1520: Align MS:1003441 handling with scan-level IM data and guard on actual IM arrays.

The new IMFormat::CENTROIDED wiring is useful, but two structural issues remain:

  1. Location: MS:1003441 (“ion mobility centroid frame”) is currently parsed and written at the spectrum level. The PSI/mzML usage for mobility metadata is scan-level (scanList/scan), and the previous review already suggested moving the writer emission into the <scan> block (one more level of indentation) and treating spectrum-level occurrences as a compatibility read-only fallback.

  2. Guarding: The writer now keys solely off spec.getIMFormat() == IMFormat::CENTROIDED. To avoid incorrectly tagging spectra that don’t actually carry an IM float data array, it’s safer to additionally guard on spec.containsIMData() (or equivalent) when emitting MS:1003441.

You may also want to mirror the drift-time pattern and recognize MS:1003441 in the scan parent as well, mapping it to IMFormat::CENTROIDED on read.

Example sketch for the writer side inside the scan block (not exact placement):

-      //ion mobility frame representation
-      if (spec.getIMFormat() == IMFormat::CENTROIDED)
-      {
-        os << "\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1003441\" name=\"ion mobility centroid frame\" />\n";
-      }
+      // inside first scan of scanList (j == 0):
+      if (spec.getIMFormat() == IMFormat::CENTROIDED && spec.containsIMData())
+      {
+        os << "\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1003441\" "
+              "name=\"ion mobility centroid frame\" />\n";
+      }

And similarly, consider accepting MS:1003441 under parent_tag == "scan" in handleCVParam_ by mapping it to spec_.setIMFormat(IMFormat::CENTROIDED).

Also applies to: 5069-5073

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)

35-38: Disable DEBUG_PICKER by default to avoid shipping heavy debug I/O

#define DEBUG_PICKER in this TU enables a large amount of std::cout/std::cerr logging and even debug MzML writing in normal builds. For production use, this will significantly slow down processing on large datasets and clutter stderr.

Recommend removing the define and letting DEBUG_PICKER be controlled via compiler flags, or converting essential diagnostics to OPENMS_LOG_* with appropriate log levels:

-#define DEBUG_PICKER
-#ifdef DEBUG_PICKER
+#ifdef DEBUG_PICKER
 #include <OpenMS/FORMAT/MzMLFile.h>
 #endif 
src/topp/PeakPickerIM.cpp (2)

72-94: Avoid forcing IMFormat::CENTROIDED at TOPP level; rely on PeakPickerIM to set it

pickIMTraces, pickIMCluster, and pickIMElutionProfiles already validate IMFormat and set it to CENTROIDED only when centroiding actually happens. Here, processSpectrum_ and the in‑memory loop unconditionally call spectrum.setIMFormat(IMFormat::CENTROIDED) after those methods.

For spectra without IM data (IMFormat::NONE) pickIM* no‑op, but these calls still relabel such spectra as centroided, and they also override any algorithm-level decision to leave IMFormat unchanged. This can break downstream IMFormat checks and misrepresent untouched spectra.

Suggested fix: drop the explicit setIMFormat calls and trust the algorithm:

// Consumer::processSpectrum_
       if (method_ == "mobilogram")
       {
         pp_.pickIMTraces(spectrum);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }
       else if (method_ == "cluster")
       {
         const double ppm_tol = (double)par.getValue("pickIMCluster:ppm_tolerance_cluster");
         const double im_tol  = (double)par.getValue("pickIMCluster:im_tolerance_cluster");
         PeakPickerIM::pickIMCluster(spectrum, ppm_tol, im_tol);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }
       else if (method_ == "traces")
       {
         const double ppm_tol = (double)par.getValue("pickIMElutionProfiles:ppm_tolerance_elution");
         PeakPickerIM::pickIMElutionProfiles(spectrum, ppm_tol);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }

// In-memory loop
       if (method == "mobilogram")
       {
         picker.pickIMTraces(spectrum);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }
       else if (method == "cluster")
       {
         const Param& par = picker.getParameters();
         const double ppm_tol = (double)par.getValue("pickIMCluster:ppm_tolerance_cluster");
         const double im_tol  = (double)par.getValue("pickIMCluster:im_tolerance_cluster");
         PeakPickerIM::pickIMCluster(spectrum, ppm_tol, im_tol);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }
       else if (method == "traces")
       {
         const Param& par = picker.getParameters();
         const double ppm_tol = (double)par.getValue("pickIMElutionProfiles:ppm_tolerance_elution");
         PeakPickerIM::pickIMElutionProfiles(spectrum, ppm_tol);
-        spectrum.setIMFormat(IMFormat::CENTROIDED);
       }

Also applies to: 161-180


135-185: Attach DataProcessing::PEAK_PICKING in the in‑memory path as well

The low‑memory path correctly attaches DataProcessing info via addDataProcessing(getProcessingInfo_(DataProcessing::PEAK_PICKING)), but the in‑memory path just stores the modified PeakMap without annotating spectra. This leaves the metadata inconsistent between modes and hides the peak‑picking step from downstream tools.

You can mirror the low‑memory behavior before mzml.store:

       mzml.store(output_file, exp);
-      return EXECUTION_OK;
+      // annotate processing
+      {
+        const DataProcessingPtr dp = getProcessingInfo_(DataProcessing::PEAK_PICKING);
+        for (auto& s : exp)
+        {
+          s.getDataProcessing().push_back(dp);
+        }
+      }
+      mzml.store(output_file, exp);
+      return EXECUTION_OK;

(adapt placement to avoid double store).

🧹 Nitpick comments (5)
src/tests/topp/CMakeLists.txt (1)

1854-1868: PeakPickerIM tests added correctly; dependencies prevent flakiness

The three tests mirror existing TOPP patterns and set DIFF dependencies on generators. Looks good. Based on learnings, this avoids parallel CTest issues.

Consider adding a low‑memory/streaming variant for coverage

Add one mobilogram test with -processOption lowmemory to exercise the streaming path, analogous to PeakPickerHiRes_3.

@@
 # test 'trace' method
 add_test("TOPP_PeakPickerIM_3" ${TOPP_BIN_PATH}/PeakPickerIM -in ${DATA_DIR_TOPP}/PeakPickerIM_input_1.mzML -ini ${DATA_DIR_TOPP}/PeakPickerIM_parameters_3.ini -out PeakPickerIM_3.tmp.mzML -test)
 add_test("TOPP_PeakPickerIM_3_out1" ${DIFF} -whitelist ${INDEX_WHITELIST} -in1 PeakPickerIM_3.tmp.mzML -in2 ${DATA_DIR_TOPP}/PeakPickerIM_3_output.mzML)
 set_tests_properties("TOPP_PeakPickerIM_3_out1" PROPERTIES DEPENDS "TOPP_PeakPickerIM_3")
 
+# optional: low-memory (streaming) variant to cover second execution mode
+add_test("TOPP_PeakPickerIM_4" ${TOPP_BIN_PATH}/PeakPickerIM -in ${DATA_DIR_TOPP}/PeakPickerIM_input_1.mzML -ini ${DATA_DIR_TOPP}/PeakPickerIM_parameters_1.ini -out PeakPickerIM_4.tmp.mzML -processOption lowmemory -test)
+add_test("TOPP_PeakPickerIM_4_out1" ${DIFF} -whitelist ${INDEX_WHITELIST} -in1 PeakPickerIM_4.tmp.mzML -in2 ${DATA_DIR_TOPP}/PeakPickerIM_1_output.mzML)
+set_tests_properties("TOPP_PeakPickerIM_4_out1" PROPERTIES DEPENDS "TOPP_PeakPickerIM_4")
src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp (1)

94-132: IM test now uses Constants::UserParam::ION_MOBILITY for input naming

Setting the IM FloatDataArray name via Constants::UserParam::ION_MOBILITY makes the test robust against future renames of the IM label and aligns with other IM tests. You might also consider changing the assertion

TEST_EQUAL(output.getFloatDataArrays()[0].getName(), "Ion Mobility")

to compare against the same constant to avoid duplicating the string literal.

src/openms/include/OpenMS/METADATA/SpectrumSettings.h (1)

86-95: IMFormat storage/accessors look consistent; only doc string needs a small fix.

Storing a per-spectrum IMFormat with default IMFormat::UNKNOWN and exposing setIMFormat / getIMFormat is a good fit with the IMTypes utilities, and matches the implementation in SpectrumSettings.cpp. Only nit: the Doxygen note says IMFormat::determineIMFormat, but the helper actually lives on IMTypes (IMTypes::determineIMFormat), so it would be good to fix that to avoid confusion for users of the API.

Optionally, you could also change the signature to take the enum by value instead of const IMFormat& for consistency with setType(SpectrumType type), but that’s purely stylistic.

Also applies to: 152-153

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (2)

42-138: Prefer OpenMS logging macros over std::cerr for warnings

Functions like computeOptimalSamplingRate and extractIonMobilityTraces emit warnings via std::cerr, which bypasses OpenMS’ logging configuration and makes output handling less consistent with the rest of the library.

Consider switching these to OPENMS_LOG_WARN (or _ERROR where appropriate), e.g.:

-      if (small_mz_diffs.empty())
-      {
-        std::cerr << "Warning: No valid small m/z differences found after filtering. Using default sampling rate of 0.01" << std::endl;
-        return 0.01;
-      }
+      if (small_mz_diffs.empty())
+      {
+        OPENMS_LOG_WARN << "No valid small m/z differences found after filtering. Using default sampling rate of 0.01." << std::endl;
+        return 0.01;
+      }

and similarly for missing FWHM / size‑mismatch messages in extractIonMobilityTraces.

Also applies to: 201-223


303-662: computeCentroids_ is quite large; consider splitting into helpers

computeCentroids_ mixes several concerns (per‑trace validation, raw‑peak windowing, sumFrame_ calls, spline fitting, FWHM search, and output assembly) in one long method, which makes it hard to read and reason about.

For maintainability, it would help to factor out pieces such as “collect raw peaks for one IM peak”, “handle single‑peak/summed‑single cases”, and “spline apex/FWHM computation” into small private helpers, keeping this method as a high‑level orchestrator.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5593084 and 71e410f.

📒 Files selected for processing (22)
  • CHANGELOG (2 hunks)
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathScoring.h (0 hunks)
  • src/openms/include/OpenMS/CONCEPT/Constants.h (1 hunks)
  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h (3 hunks)
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h (5 hunks)
  • src/openms/source/APPLICATIONS/ToolHandler.cpp (1 hunks)
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp (3 hunks)
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp (2 hunks)
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp (2 hunks)
  • src/openms/source/METADATA/MetaInfoInterface.cpp (1 hunks)
  • src/openms/source/METADATA/SpectrumSettings.cpp (2 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/tests/class_tests/openms/executables.cmake (2 hunks)
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp (2 hunks)
  • src/tests/class_tests/openms/source/MSExperiment_test.cpp (2 hunks)
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp (3 hunks)
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp (2 hunks)
  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp (1 hunks)
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp (4 hunks)
  • src/tests/topp/CMakeLists.txt (1 hunks)
  • src/topp/PeakPickerIM.cpp (1 hunks)
  • src/topp/executables.cmake (4 hunks)
💤 Files with no reviewable changes (1)
  • src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathScoring.h
✅ Files skipped from review due to trivial changes (1)
  • src/openms/include/OpenMS/CONCEPT/Constants.h
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/tests/class_tests/openms/source/PeakPickerIM_test.cpp
  • src/openms/source/APPLICATIONS/ToolHandler.cpp
  • src/openms/source/FEATUREFINDER/ElutionPeakDetection.cpp
  • src/tests/class_tests/openms/executables.cmake
  • src/openms/source/METADATA/MetaInfoInterface.cpp
  • src/topp/executables.cmake
  • src/openms/source/METADATA/SpectrumSettings.cpp
  • src/tests/class_tests/openms/source/MSSpectrum_test.cpp
🧰 Additional context used
📓 Path-based instructions (3)
src/tests/class_tests/openms/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Write unit tests for new functionality

Files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/METADATA/MetaInfoInterface.h
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
🧠 Learnings (20)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • CHANGELOG
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • CHANGELOG
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/tests/class_tests/openms/source/MSExperiment_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • CHANGELOG
  • src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/openms/include/OpenMS/METADATA/SpectrumSettings.h
📚 Learning: 2025-10-15T07:49:09.293Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h:11-14
Timestamp: 2025-10-15T07:49:09.293Z
Learning: In OpenMS, DefaultParamHandler.h is located under OpenMS/DATASTRUCTURES/, not OpenMS/CONCEPT/. The correct include is: `#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>`

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp
  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp
  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Ensure existing tests pass before suggesting changes

Applied to files:

  • src/tests/topp/CMakeLists.txt
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/tests/topp/CMakeLists.txt
🧬 Code graph analysis (3)
src/openms/include/OpenMS/METADATA/MetaInfoInterface.h (2)
src/openms/source/METADATA/MetaInfoInterface.cpp (3)
  • MetaInfoInterface (18-25)
  • MetaInfoInterface (28-33)
  • MetaInfoInterface (35-38)
src/tests/class_tests/openms/source/MetaInfoInterface_test.cpp (2)
  • MetaInfoInterface (84-93)
  • MetaInfoInterface (84-84)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (139-139)
  • sgolay_polynomial_order_ (140-140)
  • im_tolerance_cluster_ (142-146)
  • ppm_tolerance_elution_ (144-145)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-126)
  • determineIMFormat (95-95)
src/openms/source/IONMOBILITY/IMDataConverter.cpp (2)
  • reshapeIMFrameToMany (94-148)
  • reshapeIMFrameToMany (94-94)
src/openms/include/OpenMS/METADATA/SpectrumSettings.h (3)
src/tests/class_tests/openms/source/MSSpectrum_test.cpp (1)
  • setIMFormat (1395-1395)
src/openms/source/METADATA/SpectrumSettings.cpp (4)
  • setIMFormat (77-84)
  • setIMFormat (77-77)
  • getIMFormat (86-89)
  • getIMFormat (86-86)
src/openms/include/OpenMS/IONMOBILITY/IMTypes.h (1)
  • IMFormat (47-98)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build-lnx
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
🔇 Additional comments (13)
src/tests/class_tests/openms/source/ChromatogramExtractorAlgorithm_test.cpp (2)

11-13: Constants include for IM user params looks correct

Including OpenMS/CONCEPT/Constants.h is appropriate here to support the new IM user param constant.


116-146: Using Constants::UserParam::ION_MOBILITY for IM FloatDataArray is appropriate

Naming the FloatDataArray via Constants::UserParam::ION_MOBILITY instead of a literal string is consistent with the IM conventions and with other IM-related tests. Based on learnings, this aligns with how IM data is located via metadata rather than array position.

src/tests/class_tests/openms/source/SwathMapMassCorrection_test.cpp (1)

9-11: IM array naming standardized to Constants::UserParam::ION_MOBILITY

Using the shared constant for all three ion mobility FloatDataArray names (MS2, PASEF, and MS1 maps) plus adding the corresponding include is consistent with the IM handling across the codebase and avoids hard-coded labels. This should work smoothly with IMDataConverter and IM-aware consumers. Based on learnings, this is in line with the recommended IM metadata conventions.

Also applies to: 462-544

src/tests/class_tests/openms/source/PeakPickerHiRes_test.cpp (1)

9-12: Constants include is correctly added

Bringing in OpenMS/CONCEPT/Constants.h here is necessary for the new IM data naming and is consistent with other tests.

src/tests/class_tests/openms/source/MSExperiment_test.cpp (2)

1895-2056: IM-per-spectrum tests correctly use Constants::UserParam::ION_MOBILITY

The ion mobility test spectra (im1, im2, im3) are now labeled via Constants::UserParam::ION_MOBILITY, which centralizes the IM label and matches how IM-aware code locates these arrays using metadata. This keeps the tests aligned with the broader IM handling in the library. Based on learnings, this is consistent with the recommended IM data conventions.


2381-2483: Flat IM data tests also aligned to the IM naming constant

For get2DPeakDataIM, using Constants::UserParam::ION_MOBILITY for the IM FloatDataArray names in all constructed spectra is consistent with the other tests and supports IM access patterns that rely on this standardized label. Behavior and assertions remain unchanged.

src/openms/include/OpenMS/METADATA/MetaInfoInterface.h (3)

39-39: LGTM! Modern C++ best practice.

Explicitly defaulting the constructor combined with the in-class member initialization (line 112) is cleaner and more maintainable than a user-declared default constructor.


112-112: LGTM! Explicit initialization improves clarity.

The explicit nullptr initialization works correctly with the defaulted constructor and makes the initialization intent clear.


87-88: The documentation accurately describes the implementation behavior. The addMetaValues method does copy both named (String) and indexed (UInt) meta values, with existing entries being overwritten for matching keys as documented. The previous review concern about a documentation-implementation mismatch has been resolved.

src/openms/source/IONMOBILITY/IMDataConverter.cpp (1)

12-12: Good centralization of the ion-mobility name heuristic.

Using Constants::UserParam::ION_MOBILITY instead of a hard-coded "Ion Mobility" prefix keeps the fallback in sync with how IM arrays are named elsewhere (including “Ion Mobility Centroid” from PeakPickerIM), while preserving the existing unit inference logic. This looks correct and improves maintainability.

Also applies to: 333-335

CHANGELOG (1)

63-64: PeakPickerIM and IMFormat changelog entries look consistent and clear

The new tool and library entries accurately describe PeakPickerIM, IMFormat, and the MSSpectrum/SpectrumSettings API and follow existing CHANGELOG style. No changes needed.

Also applies to: 74-76

src/topp/PeakPickerIM.cpp (1)

21-48: TOPP tool interface and algorithm parameter wiring look good

Input/output, processOption/method enums, and the algorithm subsection are registered in the usual TOPP style, and the aggregation of PeakPickerIM defaults into the algorithm: subsection is consistent with DefaultParamHandler usage.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1)

678-709: Constructor, parameter wiring, and IM format validation look consistent

  • Defaults for pickIMTraces / pickIMCluster / pickIMElutionProfiles are set in the constructor and cached via updateMembers_, matching the parameter names used later.
  • validateIMFormatForPicking correctly gates processing to IMFormat::CONCATENATED, skips NONE, and throws on CENTROIDED/UNKNOWN or other unhandled formats, which is then reused by all three public picking methods.
  • pickIMTraces validates IM, sorts by m/z before using sumFrame_, and uses the configured tolerances and smoothing parameters.

This wiring matches the intended API and IM handling in the rest of the PR.

Also applies to: 711-745, 748-787

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@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: 0

♻️ Duplicate comments (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

85-89: Fix incorrect example code.

The example still references IMFrame::toSpectrum(input_spectrum), which does not exist. This issue was previously flagged but not yet addressed.

Replace with correct usage:

- * Example:
- * @code
- * MSSpectrum input;  // spectrum with IM data
- * IMFrame::toSpectrum(input_spectrum);
- * @endcode
+ * Example:
+ * @code
+ * MSSpectrum spec; // spectrum with IM data
+ * PeakPickerIM::pickIMCluster(spec, 50.0, 0.1);
+ * // spec now contains centroided peaks with averaged IM values
+ * @endcode
🧹 Nitpick comments (4)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)

17-36: Class documentation could reference usage patterns.

The class documentation describes the three methods well. However, as discussed in past reviews, consider adding a brief usage example and TOPP tool reference to help users understand how to integrate this class. The previous review discussion suggested adding typical call sequences and parameter configuration examples.


56-56: Inconsistent method design: instance vs static.

The pickIMTraces method is an instance method that uses internally stored parameters, while pickIMCluster (line 91) and pickIMElutionProfiles (line 102) are static methods with explicit parameters. This inconsistency may confuse users about when to instantiate the class vs. calling static methods.

If this design is intentional (mobilogram method has many parameters managed via DefaultParamHandler, while cluster/elution have fewer parameters passed directly), consider documenting this rationale in the class documentation to clarify the usage pattern.


136-144: Consider documenting private parameter members.

The private member variables (lines 136-144) cache algorithm parameters but lack inline documentation. While these are internal implementation details, brief comments would help maintainers understand their purpose and how they're synchronized via updateMembers_().

For example:

double sum_tolerance_mz_{1.0};  ///< m/z tolerance for sumFrame_ (absolute or ppm based on use_ppm)
double gauss_ppm_tolerance_{5.0};  ///< ppm tolerance for Gaussian smoothing in pickIMTraces

109-134: Private method documentation could be more consistent.

Some private helper methods have detailed documentation (e.g., sumFrame_ at lines 111-120) while others have minimal comments (e.g., ppmBounds at line 123, computeCentroids_ at lines 132-134). Consider adding brief descriptions of inputs, outputs, and purpose for all private methods to aid maintainability.

For example:

/// Compute lower and upper m/z bounds for a given m/z value and ppm tolerance
/// @param mz The m/z value
/// @param ppm The ppm tolerance
/// @return Pair of (lower_bound, upper_bound)
std::pair<double, double> ppmBounds(double mz, double ppm);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71e410f and 24a62f7.

📒 Files selected for processing (1)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧠 Learnings (15)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-10-15T07:49:09.293Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h:11-14
Timestamp: 2025-10-15T07:49:09.293Z
Learning: In OpenMS, DefaultParamHandler.h is located under OpenMS/DATASTRUCTURES/, not OpenMS/CONCEPT/. The correct include is: `#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>`

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-05-23T10:58:51.257Z
Learnt from: pjones
Repo: OpenMS/OpenMS PR: 8042
File: doc/doxygen/install/install-linux.doxygen:37-37
Timestamp: 2025-05-23T10:58:51.257Z
Learning: In the OpenMS project, Doxygen is run with a non-standard working directory, so snippet paths that may look incorrect (like "../../tools/ci/deps-ubuntu.sh" in doc/doxygen/install/install-linux.doxygen) are actually correct. The snippet markers in shell scripts use the format "# [marker_name]" rather than the alternative "#! [marker_name]" format.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧬 Code graph analysis (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (2)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (7)
  • PeakPickerIM (678-695)
  • pickIMTraces (748-971)
  • pickIMTraces (748-748)
  • pickIMCluster (973-1199)
  • pickIMCluster (973-973)
  • pickIMElutionProfiles (1201-1287)
  • pickIMElutionProfiles (1201-1201)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (72-94)
  • spectrum (72-72)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-lnx
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
🔇 Additional comments (1)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

107-145: Verify if removeAllFloatDataArraysExcept should be declared as a private method in the header.

The review comment indicates this method is missing from the header declaration, but this requires manual verification against the implementation file to confirm: (1) the method exists in the .cpp, (2) it's actually used as a private helper, and (3) it's not declared elsewhere (e.g., inherited or in a base class). Cross-reference the method signature in PeakPickerIM.cpp with the header declarations to determine if it should be added.

@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: 2

♻️ Duplicate comments (1)
src/topp/PeakPickerIM.cpp (1)

126-182: Missing DataProcessing info in in-memory path.

The low-memory path correctly adds DataProcessing info via pp_consumer.addDataProcessing(...) (line 105), but the in-memory path stores the result without attaching the PEAK_PICKING processing metadata. This creates inconsistent output between the two modes.

Apply this diff after line 178 (before mzml.store):

       }
+
+      // Annotate processing info (same as low-memory path)
+      exp.addDataProcessing(getProcessingInfo_(DataProcessing::PEAK_PICKING));
+
       mzml.store(output_file, exp);
🧹 Nitpick comments (6)
src/topp/PeakPickerIM.cpp (1)

153-178: Consider hoisting parameter access outside the parallel loop.

For cluster and traces methods, picker.getParameters() is called inside the parallel loop for each spectrum. While thread-safe, this is redundant since parameters don't change. Hoisting improves clarity and marginally improves performance.

+      const Param& par = picker.getParameters();
+      const double ppm_tol_cluster = (process_opt == "cluster") ? (double)par.getValue("pickIMCluster:ppm_tolerance_cluster") : 0;
+      const double im_tol_cluster = (process_opt == "cluster") ? (double)par.getValue("pickIMCluster:im_tolerance_cluster") : 0;
+      const double ppm_tol_elution = (process_opt == "traces") ? (double)par.getValue("pickIMElutionProfiles:ppm_tolerance_elution") : 0;
+
 #pragma omp parallel for
       for (SignedSize i = 0; i < static_cast<SignedSize>(exp.size()); ++i)
       {
         MSSpectrum& spectrum = exp[static_cast<Size>(i)];

         if (method == "mobilogram")
         {
           picker.pickIMTraces(spectrum);
           spectrum.setIMFormat(IMFormat::CENTROIDED);
         }
         else if (method == "cluster")
         {
-          const Param& par = picker.getParameters();
-          const double ppm_tol = (double)par.getValue("pickIMCluster:ppm_tolerance_cluster");
-          const double im_tol  = (double)par.getValue("pickIMCluster:im_tolerance_cluster");
-          PeakPickerIM::pickIMCluster(spectrum, ppm_tol, im_tol);
+          PeakPickerIM::pickIMCluster(spectrum, ppm_tol_cluster, im_tol_cluster);
           spectrum.setIMFormat(IMFormat::CENTROIDED);
         }
         else if (method == "traces")
         {
-          const Param& par = picker.getParameters();
-          const double ppm_tol = (double)par.getValue("pickIMElutionProfiles:ppm_tolerance_elution");
-          PeakPickerIM::pickIMElutionProfiles(spectrum, ppm_tol);
+          PeakPickerIM::pickIMElutionProfiles(spectrum, ppm_tol_elution);
           spectrum.setIMFormat(IMFormat::CENTROIDED);
         }
       }
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1)

141-144: Unused member variables for static methods.

ppm_tolerance_cluster_, im_tolerance_cluster_, and ppm_tolerance_elution_ are cached in updateMembers_() but never used since pickIMCluster and pickIMElutionProfiles are static methods that take their tolerances as parameters. Either remove these members or consider making the methods non-static to use the configured parameters.

If consistency with pickIMTraces is desired (using configured parameters), consider making pickIMCluster/pickIMElutionProfiles non-static:

-    static void pickIMCluster(MSSpectrum& spec, double ppm_tolerance_cluster = 50.0, double im_tolerance_cluster = 0.1);
-    static void pickIMElutionProfiles(MSSpectrum& input, double ppm_tolerance_elution = 50.0);
+    void pickIMCluster(MSSpectrum& spec) const;
+    void pickIMElutionProfiles(MSSpectrum& input) const;

Or remove the unused member variables if the static interface is preferred.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (4)

218-227: Use OPENMS_LOG instead of std::cerr.

Lines 220, 226, and 253 use std::cerr for error output. For consistency with OpenMS conventions, use OPENMS_LOG_ERROR or OPENMS_LOG_WARN.

       if (!fwhm_array)
       {
-        std::cerr << "FWHM data array not found!" << std::endl;
+        OPENMS_LOG_ERROR << "FWHM data array not found!" << std::endl;
         return {};
       }

       if (fwhm_array->size() != picked_spectrum.size())
       {
-        std::cerr << "Size mismatch between FWHM array and picked peaks!" << std::endl;
+        OPENMS_LOG_ERROR << "Size mismatch between FWHM array and picked peaks!" << std::endl;
         return {};
       }

301-661: Complex method would benefit from decomposition.

This method spans 360 lines with nested loops and multiple responsibilities (trace iteration, bounds computation, spline fitting, FWHM calculation). Consider extracting helper functions for:

  • Spline-based apex finding (lines 545-563)
  • FWHM calculation via bisection (lines 565-627)

Also, line 462 uses a hardcoded tolerance 0.1 in sumFrame_() call - consider making this configurable.

Additionally, multiple std::cerr calls (lines 331, 340, 349, 358, 394) should use OPENMS_LOG_WARN or OPENMS_LOG_ERROR for consistency with OpenMS logging conventions.


972-973: Parameter names shadow member variables.

The parameters ppm_tolerance_cluster_ and im_tolerance_cluster_ (with trailing underscores) shadow the member variables of the same names. This is confusing since member variables typically use the trailing underscore convention. Use clearer parameter names.

-    void PeakPickerIM::pickIMCluster(OpenMS::MSSpectrum& spectrum, double ppm_tolerance_cluster_, double im_tolerance_cluster_)
+    void PeakPickerIM::pickIMCluster(OpenMS::MSSpectrum& spectrum, double ppm_tolerance, double im_tolerance)

And update usages within the function accordingly (e.g., ppm_factor calculation at line 1043).


1200-1201: Parameter name shadows member variable.

Same issue as pickIMCluster: the parameter ppm_tolerance_elution_ shadows the member variable.

-    void PeakPickerIM::pickIMElutionProfiles(MSSpectrum& input, double ppm_tolerance_elution_)
+    void PeakPickerIM::pickIMElutionProfiles(MSSpectrum& input, double ppm_tolerance)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24a62f7 and 50d4fd2.

📒 Files selected for processing (3)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/topp/PeakPickerIM.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
src/openms/include/OpenMS/**/*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Add Doxygen comments for new public methods and classes

Files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧠 Learnings (21)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:06.988Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-12-04T16:25:06.988Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:06.988Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-10-15T07:49:09.293Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h:11-14
Timestamp: 2025-10-15T07:49:09.293Z
Learning: In OpenMS, DefaultParamHandler.h is located under OpenMS/DATASTRUCTURES/, not OpenMS/CONCEPT/. The correct include is: `#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>`

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-05-23T10:58:51.257Z
Learnt from: pjones
Repo: OpenMS/OpenMS PR: 8042
File: doc/doxygen/install/install-linux.doxygen:37-37
Timestamp: 2025-05-23T10:58:51.257Z
Learning: In the OpenMS project, Doxygen is run with a non-standard working directory, so snippet paths that may look incorrect (like "../../tools/ci/deps-ubuntu.sh" in doc/doxygen/install/install-linux.doxygen) are actually correct. The snippet markers in shell scripts use the format "# [marker_name]" rather than the alternative "#! [marker_name]" format.

Applied to files:

  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (1)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (3)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (139-139)
  • sgolay_polynomial_order_ (140-140)
  • im_tolerance_cluster_ (142-146)
  • ppm_tolerance_elution_ (144-145)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-126)
  • determineIMFormat (95-95)
src/openms/source/IONMOBILITY/IMDataConverter.cpp (2)
  • reshapeIMFrameToMany (94-148)
  • reshapeIMFrameToMany (94-94)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

🔇 Additional comments (11)
src/topp/PeakPickerIM.cpp (1)

65-98: LGTM: Consumer class for streaming.

The Consumer class correctly delegates to the appropriate PeakPickerIM method based on the selected mode. The algorithms themselves handle setting IMFormat::CENTROIDED internally.

src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (3)

17-36: Class documentation is good but could include usage example.

The class-level documentation explains the three methods well. Per prior discussion, adding a brief usage example would help users. However, the current documentation is functional and acceptable.


39-60: LGTM: Clean public interface.

The interface provides three picking methods with appropriate design:

  • pickIMTraces uses configured parameters via the instance
  • pickIMCluster and pickIMElutionProfiles are static with sensible defaults

63-91: LGTM: Well-documented pickIMCluster.

The Doxygen documentation is comprehensive with proper @param, @throws, and example code.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (7)

9-37: LGTM: Includes are complete.

The required headers are properly included, including the standard library headers that were previously missing.


151-192: LGTM: sumFrame_ implementation.

The function correctly sums adjacent peaks within tolerance. The precondition check and the documented behavior (appending to output) are appropriate.


710-745: LGTM: Well-designed IMFormat validation helper.

The validateIMFormatForPicking function properly gates processing based on IM format with appropriate error handling for invalid states.


747-970: LGTM: pickIMTraces implementation.

The method is well-structured with clear separation between m/z and IM peak picking phases. Metadata is properly preserved and the output format is correctly set to CENTROIDED.


1075-1146: LGTM: Cluster expansion logic.

The cluster expansion algorithm correctly expands left and right in m/z-sorted order while checking both m/z and IM tolerances. The intensity-weighted averaging produces proper centroids.


1277-1281: Address TODO comments.

Lines 1277 and 1280-1281 contain TODO comments indicating uncertainty about the implementation. These should be reviewed and either resolved or tracked as issues.

Line 1277: //TODO: somewhat related: why is getIntensity() zero?
Line 1280: input.sortByPosition(); // TODO: maybe needed
Line 1281: input.updateRanges(); // TODO: maybe needed

Please verify whether sortByPosition() and updateRanges() are actually needed, and investigate why getIntensity() returns zero.


677-708: LGTM: Constructor and parameter handling.

The constructor follows the standard DefaultParamHandler pattern with proper defaults and member caching.

Comment thread src/topp/PeakPickerIM.cpp Resolved
timosachsenberg and others added 2 commits December 4, 2025 17:42
- Make pickIMCluster and pickIMElutionProfiles non-static instance methods
  that use configured parameters (consistent with pickIMTraces)
- Remove unused tolerance parameters from method signatures
- Add DataProcessing metadata to in-memory path (was missing)
- Add IMFormat validation to low-memory path for consistent error handling
- Simplify TOPP tool code by removing redundant parameter extraction
- Update pyOpenMS bindings to expose pickIMCluster and pickIMElutionProfiles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Use a FormatDetector consumer that aborts after reading the first
spectrum (via exception) instead of loading the entire file. This
maintains the low-memory property while providing proper validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

@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: 0

🧹 Nitpick comments (6)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (6)

107-130: Use OPENMS logging and consider binning for mode computation.

Two issues in this block:

  1. Line 109 uses std::cerr instead of OPENMS_LOG_WARN - as per coding guidelines, utilize OpenMS logging mechanisms.

  2. The mode computation using std::unordered_map<double, int> (lines 114-130) relies on exact floating-point equality, which is fragile. Different floating-point representations of the "same" value won't match. Consider binning values or using a tolerance-based approach.

       if (small_mz_diffs.empty())
       {
-        std::cerr << "Warning: No valid small m/z differences found after filtering. Using default sampling rate of 0.01" << std::endl;
+        OPENMS_LOG_WARN << "No valid small m/z differences found after filtering. Using default sampling rate of 0.01" << std::endl;
         return 0.01;
       }

For the mode calculation, consider rounding to a fixed precision before hashing:

// Round to 6 decimal places for binning
auto bin = [](double val) { return std::round(val * 1e6) / 1e6; };
std::unordered_map<double, int> freq_map;
for (double diff : small_mz_diffs)
{
  freq_map[bin(diff)]++;
}

218-228: Replace std::cerr with OpenMS logging.

These error messages should use OPENMS_LOG_ERROR or OPENMS_LOG_WARN for consistency with OpenMS conventions and to respect log-level filtering.

       if (!fwhm_array)
       {
-        std::cerr << "FWHM data array not found!" << std::endl;
+        OPENMS_LOG_WARN << "FWHM data array not found in picked_spectrum." << std::endl;
         return {};
       }

       if (fwhm_array->size() != picked_spectrum.size())
       {
-        std::cerr << "Size mismatch between FWHM array and picked peaks!" << std::endl;
+        OPENMS_LOG_WARN << "Size mismatch between FWHM array and picked peaks." << std::endl;
         return {};
       }

251-256: Replace std::cerr with OpenMS logging.

         if (center_idx == -1)
         {
-          std::cerr << "No raw peaks found near picked m/z: " << picked_mz << std::endl;
+          OPENMS_LOG_DEBUG << "No raw peaks found near picked m/z: " << picked_mz << std::endl;
           mobility_traces.emplace_back();
           continue;
         }

302-361: Replace std::cerr with OpenMS logging in computeCentroids_.

Multiple std::cerr usages in this function should use OpenMS logging for consistency.

         if (picked_float_arrays.empty())
         {
-          std::cerr << "No IM FWHM array found for picked_trace " << i << "!" << std::endl;
+          OPENMS_LOG_WARN << "No IM FWHM array found for picked_trace " << i << std::endl;
           continue;
         }
         // ...
         if (fwhm_array.size() != picked_trace.size())
         {
-          std::cerr << "FWHM array size mismatch with picked_trace size!" << std::endl;
+          OPENMS_LOG_WARN << "FWHM array size mismatch with picked_trace size." << std::endl;
           continue;
         }
         // ...
         if (raw_float_arrays.empty())
         {
-          std::cerr << "No raw m/z peaks found for raw_trace " << i << "!" << std::endl;
+          OPENMS_LOG_WARN << "No raw m/z peaks found for raw_trace " << i << std::endl;
           continue;
         }
         // ...
         if (raw_mz_values.size() != raw_trace.size())
         {
-          std::cerr << "raw_mz_values size mismatch with raw_trace size!" << std::endl;
+          OPENMS_LOG_WARN << "raw_mz_values size mismatch with raw_trace size." << std::endl;
           continue;
         }

Similarly for line 394:

           if (center_idx == -1)
           {
-            std::cerr << "Could not find nearest peak to centroid_im in raw_trace!" << std::endl;
+            OPENMS_LOG_WARN << "Could not find nearest peak to centroid_im in raw_trace." << std::endl;
             continue;
           }

302-661: Consider extracting helper functions to reduce complexity.

Static analysis flagged computeCentroids_ as a complex method (~360 lines). While the logic is coherent, extracting some inner operations into helper functions would improve readability and testability. Potential extractions:

  1. Spline-based apex finding and FWHM calculation (lines 545-638) into a helper like findApexAndFWHM(...).
  2. Left/right expansion logic (lines 401-424) into a reusable helper.

This is a nice-to-have refactor that could be deferred.


1277-1277: Address or remove the TODO comment.

The TODO at line 1277 asks why getIntensity() returns zero. If this is a known issue with MassTrace, document the workaround or file a tracking issue.

Would you like me to investigate the MassTrace::getIntensity() behavior or open an issue to track this?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50d4fd2 and 06f27ea.

📒 Files selected for processing (4)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (1 hunks)
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (1 hunks)
  • src/pyOpenMS/pxds/PeakPickerIM.pxd (1 hunks)
  • src/topp/PeakPickerIM.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
🧰 Additional context used
📓 Path-based instructions (1)
src/openms/**/*.{cpp,h,hpp,cc,cxx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms

Files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧠 Learnings (22)
📓 Common learnings
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:06.988Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-11-18T20:08:08.900Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8374
File: src/pyOpenMS/pxds/SimpleSVM.pxd:0-0
Timestamp: 2025-11-18T20:08:08.900Z
Learning: In pyOpenMS .pxd files, copy constructors should be declared for wrapped C++ classes (e.g., `ClassName(ClassName&) except + nogil`) even when the C++ class has a deleted copy constructor. This is a standard pyOpenMS/Cython convention required for proper wrapper generation and Python object semantics.

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-06-16T15:49:26.504Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:1-3
Timestamp: 2025-06-16T15:49:26.504Z
Learning: In OpenMS Python bindings (.pxd files), derived quantitation method classes like TMTThirtyTwoPlexQuantitationMethod only need to declare their constructors. All other public methods (getName, getChannelInformation, getNumberOfChannels, getIsotopeCorrectionMatrix, getReferenceChannel) are inherited from the base IsobaricQuantitationMethod class and don't need to be redeclared explicitly.

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
📚 Learning: 2025-04-07T21:16:06.557Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 7970
File: src/pyOpenMS/addons/MSSpectrum.pyx:24-28
Timestamp: 2025-04-07T21:16:06.557Z
Learning: In OpenMS, the proper way to access ion mobility data in MSSpectrum is to use the `getIMData()` method, which returns a tuple with (position, unit). The position corresponds to the index in the FloatDataArrays where the ion mobility data is stored. Always use this method rather than assuming the first FloatDataArray contains ion mobility data.

Applied to files:

  • src/pyOpenMS/pxds/PeakPickerIM.pxd
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-12-04T16:25:06.988Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp:5069-5074
Timestamp: 2025-12-04T16:25:06.988Z
Learning: In OpenMS mzML writing, PSI-MS term MS:1003441 "ion mobility centroid frame" is a spectrum-level cvParam. It should be written at spectrum level (not scan level).

Applied to files:

  • src/topp/PeakPickerIM.cpp
  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-29T19:09:45.997Z
Learnt from: jcharkow
Repo: OpenMS/OpenMS PR: 8188
File: src/topp/OpenSwathWorkflow.cpp:1118-1123
Timestamp: 2025-08-29T19:09:45.997Z
Learning: In OpenMS OpenSwathWorkflow, the use_ms1_ion_mobility parameter should be respected when applying estimated MS1 ion mobility extraction windows. The apply_window calls for MS1 ion mobility should check both pasef AND use_ms1_ion_mobility to avoid re-enabling disabled functionality.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
Repo: OpenMS/OpenMS PR: 8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the existing C++ coding conventions in the codebase

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use the established naming patterns for classes, methods, and variables

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-10-21T13:02:16.431Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8318
File: src/openms/include/OpenMS/ML/CLUSTERING/HashGrid.h:466-480
Timestamp: 2025-10-21T13:02:16.431Z
Learning: In OpenMS, when making internal methods public (e.g., in HashGrid.h), remove XXX/TODO comments about implementation details rather than documenting them in the public API documentation.

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms

Applied to files:

  • src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp
🧬 Code graph analysis (2)
src/topp/PeakPickerIM.cpp (2)
src/openms/include/OpenMS/CONCEPT/Constants.h (1)
  • OpenMS (19-634)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-126)
  • determineIMFormat (95-95)
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (5)
src/topp/PeakPickerIM.cpp (2)
  • spectrum (72-86)
  • spectrum (72-72)
src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h (4)
  • sgolay_frame_length_ (139-139)
  • sgolay_polynomial_order_ (140-140)
  • im_tolerance_cluster_ (142-146)
  • ppm_tolerance_elution_ (144-145)
src/openms/source/IONMOBILITY/IMTypes.cpp (4)
  • determineIMFormat (64-93)
  • determineIMFormat (64-64)
  • determineIMFormat (95-126)
  • determineIMFormat (95-95)
src/openms/source/CONCEPT/Exception.cpp (1)
  • InvalidValue (224-228)
src/openms/source/IONMOBILITY/IMDataConverter.cpp (2)
  • reshapeIMFrameToMany (94-148)
  • reshapeIMFrameToMany (94-94)
🪛 GitHub Check: CodeFactor
src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp

[notice] 601-601: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L601
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 309-670: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L309-L670
Complex Method


[notice] 629-629: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L629
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


[notice] 731-731: src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp#L731
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

🔇 Additional comments (11)
src/pyOpenMS/pxds/PeakPickerIM.pxd (1)

1-16: LGTM - pyOpenMS binding is correctly structured.

The binding properly exposes the PeakPickerIM class with its three peak picking methods. The class correctly inherits from DefaultParamHandler, and constructor declarations follow the standard pyOpenMS pattern with except + nogil.

src/topp/PeakPickerIM.cpp (3)

66-93: LGTM - Consumer class correctly implements streaming peak picking.

The low-memory consumer properly dispatches to the appropriate PeakPickerIM method based on the selected method string, and stores a copy of the picker for thread-safe access.


96-128: LGTM - Low-memory path now includes IMFormat validation.

The streaming path correctly validates IMFormat before processing, matching the in-memory path's behavior. The temporary PeakMap used for validation goes out of scope before streaming begins, recovering memory.


170-193: LGTM - In-memory parallel processing is correctly implemented.

The OpenMP parallel loop properly handles spectrum processing with correct method dispatch, and DataProcessing info is attached after processing. The use of SignedSize for the loop variable is correct for OpenMP compatibility.

src/openms/source/PROCESSING/CENTROIDING/PeakPickerIM.cpp (7)

677-708: LGTM - Constructor and parameter wiring look correct.

Default parameters are properly initialized and updateMembers_() correctly caches them into member variables for efficient access during processing.


710-745: Good use of anonymous namespace helper for IM format validation.

The validateIMFormatForPicking helper consolidates format validation logic with appropriate error messages and exceptions for unsupported formats. This avoids code duplication across the three picking methods.


747-770: LGTM - pickIMTraces entry validation and setup.

The method correctly validates IM format using the helper, sorts by position before m/z processing, and uses the configurable sum_tolerance_mz_ parameter.


953-961: LGTM - Proper metadata preservation and format update.

The code correctly copies SpectrumSettings from input to output, preserves essential attributes (MS level, name, RT), cleans up float data arrays except for the centroided IM array, and sets IMFormat::CENTROIDED.


972-1000: LGTM - pickIMCluster validation and data structure setup.

The method properly validates the spectrum, checks for IM data presence using containsIMData() before calling getIMData(), and sets up the Point structure for clustering.


1192-1198: LGTM - Proper cleanup after clustering.

The spectrum is sorted, ranges updated, IM array renamed to the centroided constant, format set to CENTROIDED, and extraneous float arrays removed.


1200-1225: LGTM - pickIMElutionProfiles properly converts IM frames.

The method correctly validates format, checks for IM data, and uses IMDataConverter::reshapeIMFrameToMany to convert the concatenated frame into multiple spectra for mass trace detection. Setting drift time as RT enables reuse of existing chromatographic algorithms.

- Fix IMSDataConsumer inheritance (use non-template version)
- Fix addDataProcessing_ call (use TOPPBase method)
- Update test baselines to reflect DataProcessing metadata and
  Ion Mobility Centroid array name changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
timosachsenberg added a commit that referenced this pull request Dec 5, 2025
* migrate relevant files from im_types branch to this new branch

* remove IDMassAccuracy, SpecLibCreator and SpecLibSearcher from old Cmake file

* clean up parameters registration

* eliminate padding points parameter

* adjust default mz sum tolerance

* added hard-coded im peak picking params. consistent variable naming

* include another common str for storing ion mobility array

* int fix

* keep parameter name consistent fix

* make tests smaller

* clean commits

* update test

* add set_test_properties

* added coderabbitai suggestions

* added IMData check before accessing the float array

* remove ppIM_test_2.cpp class test. Add missing libraries to avoid compile issues

* check im array spectrum index

* remove outdated code from SpectrumSettings.h

* Update src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h

Co-authored-by: Timo Sachsenberg <[email protected]>

* remove redundant param handling

* reverse deletion of im handling lines in EPD

* add single peak trace handling back

* remove id lines from SpectrumSettings.cpp

* remove param comments from PeakPickerIM

* add OpenNuXL back

* add AnnotatedMSRun_test line in executable.cmake

* review comments

* determine IM type

* small fixes to ensure IMType

* some more fixes

* fixed synthetic peakpickerIM test

* make sure IMCluster and IMElutionProfiles update the ion mobility array name to Ion Mobility

* update test files

* change loop variable from Size to SignedSize for windows compiler

* rewrite test mzml files in linux

* fix doxygen error and add description for PickIMTraces

* Address CodeRabbit review comments for PeakPickerIM PR #8177

- Fix MetaInfoInterface::addMetaValues to copy both String and UInt keys
- Fix ElutionPeakDetection empty trace crash and extend smoothing for 2-point traces
- Standardize IM array output name to "Ion Mobility Centroid" using constant
- Use Constants::UserParam::ION_MOBILITY and ION_MOBILITY_CENTROID throughout
- Add error when PeakPickerIM receives already centroided IM data
- Add early validation in PeakPickerIM TOPP tool for centroided/missing IM data
- Remove unused ION_MOBILITY_DESCRIPTION from OpenSwathScoring.h
- Update test files to use IM constants instead of hardcoded strings
- Add CHANGELOG entries for PeakPickerIM

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Update src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* minor fixes

* Fix incorrect Doxygen example in PeakPickerIM

Replace bogus IMFrame::toSpectrum reference with correct
PeakPickerIM::pickIMCluster usage example.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Refactor PeakPickerIM for consistent API and validation

- Make pickIMCluster and pickIMElutionProfiles non-static instance methods
  that use configured parameters (consistent with pickIMTraces)
- Remove unused tolerance parameters from method signatures
- Add DataProcessing metadata to in-memory path (was missing)
- Add IMFormat validation to low-memory path for consistent error handling
- Simplify TOPP tool code by removing redundant parameter extraction
- Update pyOpenMS bindings to expose pickIMCluster and pickIMElutionProfiles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Improve low-memory IMFormat validation to read only first spectrum

Use a FormatDetector consumer that aborts after reading the first
spectrum (via exception) instead of loading the entire file. This
maintains the low-memory property while providing proper validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix build errors and update test baselines

- Fix IMSDataConsumer inheritance (use non-template version)
- Fix addDataProcessing_ call (use TOPPBase method)
- Update test baselines to reflect DataProcessing metadata and
  Ion Mobility Centroid array name changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Fix Doxygen error and disable flaky test on Linux/macOS ARM64

- Add missing documentation for output_spectrum parameter in
  PeakPickerIM::sumFrame_ method
- Disable TOPP_PeakPickerIM_3_out1 test on Linux and macOS ARM64
  due to numeric differences

* [WIP] Fix doxygen error in documentation build (#8428)

* Initial plan

* Add explicit checks for MULTIPLE_SPECTRA and MIXED IMFormat, remove unused variable

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Restrict PeakPickerIM output tests to Linux amd64 (#8430)

* Fix copyright headers in PeakPickerIM files

- Change "The OpenMS Team" to "OpenMS Inc." in copyright line
- Fix overly long separator line to match standard format

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Address code review comments for PeakPickerIM

- Replace std::cerr/cout with OPENMS_LOG_* macros throughout file
- Remove misleading TODOs and add clarifying comments:
  - Empty mobilogram traces: explain they occur when no peaks found in FWHM window
  - getIntensity() vs computeIntensitySum(): explain FWHM indices requirement
  - sortByPosition()/updateRanges(): confirm both are needed, remove "maybe" TODOs
- Optimize sorting: remove redundant isSorted() check before sortByPosition()
  (sortByPosition already checks internally, saves O(n) in common unsorted case)
- Add explanatory comments for IM data flow and sorting requirements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Mohammed AlHigaylan <[email protected]>
Co-authored-by: alhigaylan <[email protected]>
Co-authored-by: Mohammed AlHigaylan <[email protected]>
Co-authored-by: Mohammed AlHigaylan <[email protected]>
Co-authored-by: alhigaylan <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>
@alhigaylan

Copy link
Copy Markdown
Collaborator Author

Closing this PR since it was addressed in #8427

@alhigaylan alhigaylan closed this Dec 9, 2025
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