Skip to content

refactor: separate ranges - #8021

Merged
timosachsenberg merged 26 commits into
developfrom
feature_separate_ranges
May 16, 2025
Merged

timosachsenberg merged 26 commits into
developfrom
feature_separate_ranges

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented May 6, 2025 •

Copy link
Copy Markdown
Contributor

Description

adds:

  • ranges for spectra
  • ranges for chromatograms
  • an overall range

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

    • Introduced detailed reporting of data ranges separated into combined, spectrum, chromatogram, and per-MS level ranges for improved clarity and granularity.
    • Added new range management classes for spectra and chromatograms with MS level-specific tracking.
    • Enabled direct access to spectrum and chromatogram ranges with extended query capabilities.
  • Refactor

    • Refactored internal range handling to use explicit range manager objects, removing inheritance-based range management.
    • Simplified and unified range update logic within the experiment class.
    • Modernized iteration patterns and replaced legacy calls with MS level-aware range queries.
  • Bug Fixes

    • Enhanced accuracy and specificity of range queries, particularly for MS level-specific data.
    • Prevented exceptions by conditionally printing ion mobility ranges only when data is present.
  • Documentation

    • Improved code comments clarifying range management behavior and purpose.
  • Tests

    • Expanded tests to validate the new dual-range system and MS level-specific range management.
    • Updated existing tests to use new range accessors and verify backward compatibility.
  • Style

    • Minor formatting and whitespace improvements in code and test files.

Introduces dual-range management for spectra and chromatograms

Replaces the single RangeManager with separate SpectrumRangeManager
and ChromatogramRangeManager, enabling independent handling of ranges
for MS spectra and chromatograms. Maintains backward compatibility
using a combined range manager. Adds extensive tests to validate
the new dual-range system and its integration with existing functionality.

This change aims to improve modularity and clarity in range handling,
while preserving legacy behavior for seamless integration.
@coderabbitai

coderabbitai Bot commented May 6, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces a refactored range management system for mass spectrometry data in the MSExperiment class. It replaces inheritance-based range handling with explicit management of spectrum, chromatogram, and combined ranges, including per-MS level support. The changes propagate to algorithms, visualization, file I/O, and tests, providing more granular and structured range reporting.

Changes

File(s) Change Summary
src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h, src/openms/source/KERNEL/SpectrumRangeManager.cpp Introduced SpectrumRangeManager class for managing spectrum ranges, including per-MS level support.
src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h, src/openms/source/KERNEL/ChromatogramRangeManager.cpp Introduced ChromatogramRangeManager class for managing chromatogram ranges.
src/openms/include/OpenMS/KERNEL/MSExperiment.h, src/openms/source/KERNEL/MSExperiment.cpp Refactored MSExperiment to manage spectrum, chromatogram, and combined ranges as explicit members; added accessors and updated range update logic.
src/openms/include/OpenMS/KERNEL/sources.cmake, src/openms/source/KERNEL/sources.cmake Registered new range manager headers and sources in build configuration.
src/topp/FileInfo.cpp Specialized range output functions for MSExperiment, providing detailed breakdowns by data type and MS level; updated range update call.
src/topp/ImageCreator.cpp, src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp, src/openms/source/FEATUREFINDER/MultiplexClustering.cpp, src/openms/source/FORMAT/MzQCFile.cpp, src/openms/source/IONMOBILITY/IMDataConverter.cpp, src/openms/source/KERNEL/ConversionHelper.cpp, src/topp/MapAlignerPoseClustering.cpp, src/topp/Resampler.cpp, src/openms_gui/include/OpenMS/VISUAL/LayerDataPeak.h, src/openms_gui/include/OpenMS/VISUAL/LayerDataChrom.h, src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp Updated all usages to access ranges via new spectrum/chromatogram range managers, often with per-MS level specificity; removed deprecated direct range calls.
src/tests/class_tests/openms/source/MSExperiment_test.cpp Rewrote and expanded tests to validate new dual-range system, including per-MS level and combined range checks.
src/tests/class_tests/openms/source/FeatureFinderAlgorithmPicked_test.cpp, src/tests/class_tests/openms/source/FeatureFinderMultiplexAlgorithm_test.cpp Updated tests to use new range update interface.
src/tests/topp/FileInfo_1_output.txt, src/tests/topp/FileInfo_2_output.txt, src/tests/topp/FileInfo_4_output.txt, src/tests/topp/FileInfo_5_output.txt, src/tests/topp/FileInfo_6_output.txt, src/tests/topp/FileInfo_9_output.txt, src/tests/topp/FileInfo_19_output.txt Expanded test outputs to show detailed, structured range information for spectra, chromatograms, and per-MS level.
doc/code_examples/Tutorial_MSExperiment.cpp Updated code comments and output to use new, explicit range accessors and to print detailed range information.
src/topp/FileMerger.cpp Added clarifying comment about RT offset assignment.
src/tests/class_tests/openms/source/MzMLFile_test.cpp Minor formatting changes in test code.
src/pyOpenMS/pxds/ChromatogramRangeManager.pxd, src/pyOpenMS/pxds/SpectrumRangeManager.pxd, src/pyOpenMS/pxds/MSExperiment.pxd, src/pyOpenMS/pxds/RangeManager.pxd Added Cython bindings for new range manager classes and updated MSExperiment bindings to reflect new range management design.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant MSExperiment
  participant SpectrumRangeManager
  participant ChromatogramRangeManager

  User->>MSExperiment: updateRanges()
  MSExperiment->>SpectrumRangeManager: clearRanges()
  MSExperiment->>ChromatogramRangeManager: clearRanges()
  MSExperiment->>SpectrumRangeManager: extend() for each spectrum (per MS level)
  MSExperiment->>ChromatogramRangeManager: extend() for each chromatogram
  MSExperiment->>MSExperiment: update combined_ranges_ from spectrum & chromatogram ranges
  User->>MSExperiment: spectrumRanges().byMSLevel(n).getMinMZ()
  MSExperiment->>SpectrumRangeManager: byMSLevel(n).getMinMZ()
Loading

Poem

In the garden of mass spec, new ranges bloom bright,
With spectra and chromatograms, each in their own light.
Per-MS level details, now easy to see—
Rabbits rejoice in such granularity!
From code to report, the structure is clear,
Hopping through data, new insights appear.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Introduces specialized templates for human-readable and machine-readable range reporting in MSExperiment, covering retention time, mass-to-charge, ion mobility, and intensity across combined, spectrum-specific, and chromatogram ranges. Enhances the clarity and granularity of data outputs.

@ingroup Kernel
*/
class OPENMS_DLLAPI ChromatogramRangeManager : public RangeManager<RangeRT, RangeIntensity, RangeMZ>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is more or less just a typedef.
but could turn into more...


@param ms_level MS level to consider for m/z range, RT range and intensity range (All MS levels if negative)
*/
void updateRanges(Int ms_level);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the level type update mechanism.
I think it is not needed anymore with the separate ranges and performance should not be an issue.

double mz_start = map_.getMinMZ();
intensity_rt_step_ = (map_.getMaxRT() - rt_start) / (double)intensity_bins_;
intensity_mz_step_ = (map_.getMaxMZ() - mz_start) / (double)intensity_bins_;
double rt_start = map_.spectrumRanges().byMSLevel(1).getMinRT();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is now much better and less error prone.
We clearly express that only MS1 ranges are considered.

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.

+1

addMetric("QC:4000135", exp.getChromatograms().size());
// Run time (RT duration)
addMetric("QC:4000053", UInt(exp.getMaxRT() - exp.getMinRT()));
addMetric("QC:4000053", UInt(exp.spectrumRanges().getMaxRT() - exp.spectrumRanges().getMinRT()));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cbielow can you confirm that this is the intended semantics?

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.

sounds correct

spectrum_ranges_.extendRT(it->getRT(), it->getMSLevel()); // RT is not part of the range of an individual spectrum

// For MS1 level, also include MS2 precursor m/z values
if (it->getMSLevel() == 2 && !it->getPrecursors().empty())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

including precursor mz was done before so they are considered for the overall spectra range

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

quite some output now... but I think it is fine like this

Comment thread src/topp/FileMerger.cpp
if (first_file) // no transformation necessary
{
rt_offset_ = map.getMaxRT() + rt_gap_;
rt_offset_ = map.getMaxRT() + rt_gap_; // overall range for all spectra

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
rt_offset_ = map.getMaxRT() + rt_gap_; // overall range for all spectra
rt_offset_ = map.getMaxRT() + rt_gap_; // overall range for all spectra and chromatograms

@timosachsenberg
timosachsenberg requested a review from jpfeuffer May 15, 2025 14:47
@timosachsenberg
timosachsenberg marked this pull request as ready for review May 15, 2025 14:47
@timosachsenberg
timosachsenberg requested a review from cbielow May 15, 2025 14:50
@timosachsenberg timosachsenberg changed the title Feature separate ranges refactor: separate ranges May 15, 2025

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

🔭 Outside diff range comments (1)
src/openms/include/OpenMS/KERNEL/MSExperiment.h (1)

679-684: ⚠️ Potential issue

OpenMP pragma inside header should be guarded

Placing #pragma omp in a header forces all translation units that include it to be compiled with OpenMP enabled, otherwise they fail to build. Wrap the pragma with an #ifdef _OPENMP guard (or move the heavy loop into a source file).

-   #pragma omp parallel for schedule(dynamic)
+#ifdef _OPENMP
+   #pragma omp parallel for schedule(dynamic)
+#endif
♻️ Duplicate comments (5)
src/topp/FileMerger.cpp (1)

124-124: Improved code documentation with clarifying comment

The added comment clarifies that the rt_offset_ calculation represents the overall retention time range for all spectra. This improves code readability without changing any logic.

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

13-41: Enhanced range reporting with populated chromatogram data

Unlike FileInfo_5, this file shows populated chromatogram range data (lines 37-40), demonstrating that the range separation system correctly handles cases with both spectrum and chromatogram data.

The double dots (..) used for range display are consistent with the formatting in other output files and, while flagged by static analysis, are the intended display format for ranges.

🧰 Tools
🪛 LanguageTool

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 0...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ...39 sec (0.0 min) mass-to-charge: 0.00 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... 0.00 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 31878566.00...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 31878566.00 Spectrum Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 1...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 110.07 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...10.07 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 ...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 MS Level 1 Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ...Level 1 Ranges: retention time: 18.25 .. 18.25 sec (0.0 min) mass-to-charge: 3...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 371.27 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...71.27 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 ...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 MS Level 2 Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 18.39 .. 18.39 sec (0.0 min) mass-to-charge: 1...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 110.07 .. 871.38 ion mobility: -65.00 .. -65.00...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...110.07 .. 871.38 ion mobility: -65.00 .. -65.00 intensity: 1030.52 .. 15416.40...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...: -65.00 .. -65.00 intensity: 1030.52 .. 15416.40 Chromatogram Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~38-~38: Two consecutive dots
Context: ...atogram Ranges: retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 0...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...39 sec (0.0 min) mass-to-charge: 0.00 .. 0.00 intensity: 117547.13 .. 31878566...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...ge: 0.00 .. 0.00 intensity: 117547.13 .. 31878566.00 Number of spectra per MS l...

(DOUBLE_PUNCTUATION)

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

15-43: MS level-specific range tracking provides detailed analysis capabilities

The output now separates MS level ranges, showing key differences:

  • MS Level 1: m/z range 0.00-14.00, intensity 1.00-15.00
  • MS Level 2: m/z range 0.00-18.00, intensity 2.00-20.00

This level-specific granularity provides valuable analytical information about the spectral characteristics at each MS level, enhancing the utility of the range reporting system.

🧰 Tools
🪛 LanguageTool

[typographical] ~16-~16: Two consecutive dots
Context: ... chromatograms): retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 1.00 .. 20.00 Spec...

(DOUBLE_PUNCTUATION)


[typographical] ~19-~19: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 20.00 Spectrum Ranges: retention tim...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 1.00 .. 20.00 MS L...

(DOUBLE_PUNCTUATION)


[typographical] ~25-~25: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 20.00 MS Level 1 Ranges: retention t...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 14.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...e: 0.00 .. 14.00 ion mobility: .. intensity: 1.00 .. 15.00 MS L...

(DOUBLE_PUNCTUATION)


[typographical] ~31-~31: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 15.00 MS Level 2 Ranges: retention t...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ... Level 2 Ranges: retention time: 5.20 .. 5.20 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...20 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 2.00 .. 20.00 Chro...

(DOUBLE_PUNCTUATION)


[typographical] ~37-~37: Two consecutive dots
Context: ...ity: .. intensity: 2.00 .. 20.00 Chromatogram Ranges: retention...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~42-~42: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

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

13-41: Edge case handling for incomplete range data

The reporting system appropriately handles cases with incomplete data, as shown in the MS Level 1 Ranges section where:

  • Only a single point exists for mass-to-charge (1748.15)
  • No retention time or intensity data is available (displayed as "")

This demonstrates robust handling of sparse or missing data in the range reporting system.

🧰 Tools
🪛 LanguageTool

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...61.30 .. 1748.15 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Spectrum Ranges: retention...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...61.30 .. 1748.15 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 MS Level 1 Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ...evel 1 Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... ( min) mass-to-charge: 1748.15 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...48.15 .. 1748.15 ion mobility: .. intensity: .. M...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...y: .. intensity: .. MS Level 2 Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...Level 2 Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Chromatogram Ranges: reten...

(DOUBLE_PUNCTUATION)


[typographical] ~38-~38: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

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

2938-2944: Same as above – adjust min/max MZ expectations once the fix is in

These follow-up assertions will need the same treatment as soon as
chromatogram_ranges_.extendMZ() skips default zeros.

🧹 Nitpick comments (11)
src/openms/source/KERNEL/ChromatogramRangeManager.cpp (1)

1-14: New implementation file structure looks good.

This new file provides the implementation structure for the ChromatogramRangeManager class. The comment indicating that the implementation is inline-only in the header file explains why this file is mostly empty.

However, there's a minor issue with the author information:

-// $Authors: Administrator $
+// $Authors: Timo Sachsenberg $

The generic "Administrator" author name should be replaced with the actual author name.

src/topp/ImageCreator.cpp (1)

307-310: Consider updating transposed case to use MS level 1-specific ranges.

While the non-transposed case (lines 288-290) now uses MS level 1-specific ranges, the transposed case still uses general getMinMZ(), getMaxMZ(), etc. methods. For consistency, consider updating these to use spectrumRanges().byMSLevel(1) as well.

- bilip.setMapping_0(0, exp.getMaxMZ(), rows - 1, exp.getMinMZ());
- bilip.setMapping_1(0, exp.getMinRT(), cols - 1, exp.getMaxRT());
+ bilip.setMapping_0(0, exp.spectrumRanges().byMSLevel(1).getMaxMZ(), rows - 1, exp.spectrumRanges().byMSLevel(1).getMinMZ());
+ bilip.setMapping_1(0, exp.spectrumRanges().byMSLevel(1).getMinRT(), cols - 1, exp.spectrumRanges().byMSLevel(1).getMaxRT());
src/openms/source/IONMOBILITY/IMDataConverter.cpp (1)

137-138: Use const reference to avoid an avoidable copy of the mobility range

RangeMobility(in.spectrumRanges()) creates a copy of the full mobility range structure, which is cheap but still unnecessary.
Since spectrumRanges() returns a const SpectrumRangeManager& that is already a RangeMobility, you can bind it directly:

-const auto range_IM = RangeMobility(in.spectrumRanges());
+const auto& range_IM = static_cast<const RangeMobility&>(in.spectrumRanges());

This avoids one temporary and makes it explicit that the range object is not modified.
(If casting feels too verbose, consider adding a const RangeMobility& accessor to SpectrumRangeManager.)

src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (1)

22-45: Minor polish: declare special members noexcept to propagate move-safety

Because this class is a thin typedef over RangeManager, all generated special members are already trivial.
Declaring the move constructor/assignment noexcept communicates this fact to the STL, enabling small optimisations (e.g. std::vector reallocation moves).

-  ChromatogramRangeManager(ChromatogramRangeManager&& source) = default;
+  ChromatogramRangeManager(ChromatogramRangeManager&& source) noexcept = default;
...
-  ChromatogramRangeManager& operator=(ChromatogramRangeManager&& source) = default;
+  ChromatogramRangeManager& operator=(ChromatogramRangeManager&& source) noexcept = default;

No functional change, just a best-practice tweak.

src/topp/FileInfo.cpp (1)

317-368: Potential performance nit: repeated look-ups inside MS-level loop

Inside the for (UInt ms_level : ms_levels) loop you repeatedly call
exp.spectrumRanges().byMSLevel(ms_level);.

byMSLevel() is cheap but not free; cache it:

for (UInt ms_level : ms_levels)
{
-  const auto& level_ranges = exp.spectrumRanges().byMSLevel(ms_level);
+  const auto& spec_mgr      = exp.spectrumRanges();
+  const auto& level_ranges  = spec_mgr.byMSLevel(ms_level);

Likewise, avoid calling exp.spectrumRanges() again inside the loop header.

src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1)

70-92: Minor: prefer extend() over extendUnsafe() unless you really need to skip checks

extendUnsafe() avoids empty-range checks, which is fine for tight loops,
but in a header-only helper that will be called sporadically the savings are
negligible while the risk of propagating NaN/∞ is higher.
Consider switching to extend() (or renaming the current call to make the
performance trade-off explicit).

src/openms/source/KERNEL/MSExperiment.cpp (1)

257-269: Only the first precursor m/z is considered

A spectrum may contain multiple precursors.
Limiting the range extension to getPrecursors()[0] silently ignores all
others and can lead to underestimated m/z ranges.

- if (it->getMSLevel() == 2 && !it->getPrecursors().empty())
- {
-   spectrum_ranges_.extendMZ(it->getPrecursors()[0].getMZ(), 1);
-   spectrum_ranges_.extendMZ(it->getPrecursors()[0].getMZ(), 0);
- }
+ if (it->getMSLevel() == 2)
+ {
+   for (const auto& prec : it->getPrecursors())
+   {
+     spectrum_ranges_.extendMZ(prec.getMZ(), 1);
+     spectrum_ranges_.extendMZ(prec.getMZ(), 0);
+   }
+ }
src/openms/include/OpenMS/KERNEL/MSExperiment.h (4)

65-70: Expose only the minimum required typedefs

SpectrumRangeManagerType and ChromatogramRangeManagerType are now part of the public API. This is fine, but their full definitions are included further down the file. If these classes are not intended for external construction/modification, consider forward-declaring them and keeping the concrete typedefs in the private section to avoid unnecessary coupling of user code to internal details.


588-596: Documentation says “will be sorted”, code keeps the input const

The comment promises that mz_rt_ranges is sorted in-place, but the parameter is const, and no sorting happens. Either drop the note or take the vector by value and std::sort it before further processing.


600-708: Potential race-free, yet still risky shared vector writes

Although each thread writes to a unique element of result[range_idx], the standard only guarantees race-freedom when different elements of a container are modified concurrently and no iterator invalidation occurs. This is satisfied here, but the intent is non-obvious. A short comment explaining that result is pre-sized and each (range_idx, spectrum_idx) cell is written exactly once would help future maintainers.


731-836: Large code duplication between aggregate and extractXICs

Both functions build the same spectra_view, compute rt_ranges_idcs, and create the spectrum→range mapping. Extract this common preparation code into an internal helper to reduce maintenance overhead and risk of divergence.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4a57f59 and fc9f39f.

📒 Files selected for processing (32)
  • doc/code_examples/Tutorial_MSExperiment.cpp (1 hunks)
  • src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (1 hunks)
  • src/openms/include/OpenMS/KERNEL/MSExperiment.h (5 hunks)
  • src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1 hunks)
  • src/openms/include/OpenMS/KERNEL/sources.cmake (1 hunks)
  • src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp (3 hunks)
  • src/openms/source/FEATUREFINDER/MultiplexClustering.cpp (2 hunks)
  • src/openms/source/FORMAT/MzQCFile.cpp (1 hunks)
  • src/openms/source/IONMOBILITY/IMDataConverter.cpp (2 hunks)
  • src/openms/source/KERNEL/ChromatogramRangeManager.cpp (1 hunks)
  • src/openms/source/KERNEL/ConversionHelper.cpp (1 hunks)
  • src/openms/source/KERNEL/MSExperiment.cpp (6 hunks)
  • src/openms/source/KERNEL/sources.cmake (1 hunks)
  • src/openms_gui/include/OpenMS/VISUAL/LayerDataChrom.h (1 hunks)
  • src/openms_gui/include/OpenMS/VISUAL/LayerDataPeak.h (1 hunks)
  • src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp (3 hunks)
  • src/tests/class_tests/openms/source/FeatureFinderAlgorithmPicked_test.cpp (1 hunks)
  • src/tests/class_tests/openms/source/FeatureFinderMultiplexAlgorithm_test.cpp (1 hunks)
  • src/tests/class_tests/openms/source/MSExperiment_test.cpp (6 hunks)
  • src/tests/class_tests/openms/source/MzMLFile_test.cpp (1 hunks)
  • src/tests/topp/FileInfo_19_output.txt (1 hunks)
  • src/tests/topp/FileInfo_1_output.txt (1 hunks)
  • src/tests/topp/FileInfo_2_output.txt (1 hunks)
  • src/tests/topp/FileInfo_4_output.txt (1 hunks)
  • src/tests/topp/FileInfo_5_output.txt (1 hunks)
  • src/tests/topp/FileInfo_6_output.txt (1 hunks)
  • src/tests/topp/FileInfo_9_output.txt (1 hunks)
  • src/topp/FileInfo.cpp (5 hunks)
  • src/topp/FileMerger.cpp (1 hunks)
  • src/topp/ImageCreator.cpp (2 hunks)
  • src/topp/MapAlignerPoseClustering.cpp (1 hunks)
  • src/topp/Resampler.cpp (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
src/openms/source/FORMAT/MzQCFile.cpp (1)
src/topp/ImageCreator.cpp (2)
  • exp (100-135)
  • exp (100-101)
src/openms/source/IONMOBILITY/IMDataConverter.cpp (1)
src/openms/include/OpenMS/KERNEL/RangeManager.h (1)
  • RangeMobility (481-539)
src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (3)
src/openms/source/KERNEL/MSExperiment.cpp (4)
  • source (38-55)
  • source (38-38)
  • source (58-62)
  • source (58-58)
src/openms/include/OpenMS/KERNEL/MSExperiment.h (2)
  • source (108-108)
  • source (114-114)
src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (2)
  • source (52-52)
  • source (55-55)
src/topp/FileInfo.cpp (6)
src/openms/source/KERNEL/MSExperiment.cpp (2)
  • os (918-940)
  • os (918-918)
src/openms/include/OpenMS/KERNEL/MSExperiment.h (1)
  • os (1447-1447)
src/openms/include/OpenMS/KERNEL/MSChromatogram.h (1)
  • os (419-419)
src/openms/source/KERNEL/FeatureMap.cpp (4)
  • os (21-30)
  • os (21-21)
  • os (32-46)
  • os (32-32)
src/openms/source/KERNEL/Mobilogram.cpp (2)
  • os (400-412)
  • os (400-400)
src/openms/source/KERNEL/MSChromatogram.cpp (2)
  • os (16-32)
  • os (16-16)
🪛 LanguageTool
src/tests/topp/FileInfo_4_output.txt

[typographical] ~15-~15: Two consecutive dots
Context: ... chromatograms): retention time: 0.26 .. 37.64 sec (0.6 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... sec (0.6 min) mass-to-charge: 207.51 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...07.51 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 0.26 .. 37.64 sec (0.6 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ... sec (0.6 min) mass-to-charge: 207.51 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...07.51 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 0.26 .. 32.24 sec (0.5 min) mass-to-charge: 4...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... sec (0.5 min) mass-to-charge: 402.48 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...02.48 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 MS Level 2 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 21.95 .. 37.64 sec (0.3 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 207.51 .. 1035.83 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...07.51 .. 1035.83 ion mobility: .. intensity: 13.39 .. 3633.01 C...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...ty: .. intensity: 13.39 .. 3633.01 Chromatogram Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_2_output.txt

[typographical] ~14-~14: Two consecutive dots
Context: ... chromatograms): retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 Sp...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 Spectrum Ranges: retention ti...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 MS...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 MS Level 1 Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 Ch...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 Chromatogram Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_5_output.txt

[typographical] ~16-~16: Two consecutive dots
Context: ...chromatograms): retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~19-~19: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...pectrum Ranges: retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~25-~25: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...Level 1 Ranges: retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~31-~31: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 MS Level 2 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 25.40 .. 39.11 sec (0.2 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ... sec (0.2 min) mass-to-charge: 500.10 .. 850.08 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...500.10 .. 850.08 ion mobility: .. intensity: 23.68 .. 729.68 Ch...

(DOUBLE_PUNCTUATION)


[typographical] ~37-~37: Two consecutive dots
Context: ...ty: .. intensity: 23.68 .. 729.68 Chromatogram Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~42-~42: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_19_output.txt

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 0...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ...39 sec (0.0 min) mass-to-charge: 0.00 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... 0.00 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 31878566.00...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 31878566.00 Spectrum Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 1...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 110.07 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...10.07 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 ...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 MS Level 1 Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ...Level 1 Ranges: retention time: 18.25 .. 18.25 sec (0.0 min) mass-to-charge: 3...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 371.27 .. 1590.88 ion mobility: -65.00 .. -65.0...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...71.27 .. 1590.88 ion mobility: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 ...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...ity: -65.00 .. -65.00 intensity: 0.00 .. 5057372.00 MS Level 2 Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 18.39 .. 18.39 sec (0.0 min) mass-to-charge: 1...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 110.07 .. 871.38 ion mobility: -65.00 .. -65.00...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...110.07 .. 871.38 ion mobility: -65.00 .. -65.00 intensity: 1030.52 .. 15416.40...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...: -65.00 .. -65.00 intensity: 1030.52 .. 15416.40 Chromatogram Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~38-~38: Two consecutive dots
Context: ...atogram Ranges: retention time: 18.25 .. 18.39 sec (0.0 min) mass-to-charge: 0...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...39 sec (0.0 min) mass-to-charge: 0.00 .. 0.00 intensity: 117547.13 .. 31878566...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...ge: 0.00 .. 0.00 intensity: 117547.13 .. 31878566.00 Number of spectra per MS l...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_6_output.txt

[typographical] ~15-~15: Two consecutive dots
Context: ...hromatograms): retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ...ectrum Ranges: retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ...evel 1 Ranges: retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 Chromatogram Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_9_output.txt

[typographical] ~16-~16: Two consecutive dots
Context: ... chromatograms): retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 1.00 .. 20.00 Spec...

(DOUBLE_PUNCTUATION)


[typographical] ~19-~19: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 20.00 Spectrum Ranges: retention tim...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 1.00 .. 20.00 MS L...

(DOUBLE_PUNCTUATION)


[typographical] ~25-~25: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 20.00 MS Level 1 Ranges: retention t...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 5.10 .. 5.40 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...40 sec (0.0 min) mass-to-charge: 0.00 .. 14.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...e: 0.00 .. 14.00 ion mobility: .. intensity: 1.00 .. 15.00 MS L...

(DOUBLE_PUNCTUATION)


[typographical] ~31-~31: Two consecutive dots
Context: ...ity: .. intensity: 1.00 .. 15.00 MS Level 2 Ranges: retention t...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ... Level 2 Ranges: retention time: 5.20 .. 5.20 sec (0.0 min) mass-to-charge: 0....

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...20 sec (0.0 min) mass-to-charge: 0.00 .. 18.00 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...e: 0.00 .. 18.00 ion mobility: .. intensity: 2.00 .. 20.00 Chro...

(DOUBLE_PUNCTUATION)


[typographical] ~37-~37: Two consecutive dots
Context: ...ity: .. intensity: 2.00 .. 20.00 Chromatogram Ranges: retention...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~42-~42: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/tests/topp/FileInfo_1_output.txt

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...61.30 .. 1748.15 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Spectrum Ranges: retention...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...61.30 .. 1748.15 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 MS Level 1 Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ...evel 1 Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... ( min) mass-to-charge: 1748.15 .. 1748.15 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...48.15 .. 1748.15 ion mobility: .. intensity: .. M...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...y: .. intensity: .. MS Level 2 Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...Level 2 Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Chromatogram Ranges: reten...

(DOUBLE_PUNCTUATION)


[typographical] ~38-~38: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

🔇 Additional comments (34)
src/openms/source/KERNEL/ConversionHelper.cpp (1)

23-23: Refactor updateRanges() call to use the new interface correctly

This change correctly removes the MS level parameter from the updateRanges() call, aligning with the refactoring of range management in the OpenMS project. The new implementation updates all ranges without filtering by MS level.

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

50-50: Update test to use refactored updateRanges() method

The test has been correctly updated to remove the MS level parameter from the updateRanges() call, matching the refactored API. This change is consistent with the PR's objective of separating range management for spectra and chromatograms.

src/openms/source/KERNEL/sources.cmake (1)

35-36: Add new range manager source files to build configuration

The addition of SpectrumRangeManager.cpp and ChromatogramRangeManager.cpp to the build system properly supports the new range management architecture. These files implement the dedicated range manager classes that replace the previous inheritance-based approach.

src/openms/include/OpenMS/KERNEL/sources.cmake (1)

36-37: LGTM: New header files for range management look properly integrated.

The addition of SpectrumRangeManager.h and ChromatogramRangeManager.h to the sources list aligns with the PR objective of introducing separate range management for spectra and chromatograms.

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

47-47: Interface update correctly applied.

The change from exp.updateRanges(1) to exp.updateRanges() reflects the refactored range management system that now updates both spectrum and chromatogram ranges without requiring an MS level parameter.

src/topp/MapAlignerPoseClustering.cpp (1)

165-165: Interface update correctly applied.

The change from exp.updateRanges(1) to exp.updateRanges() reflects the refactored range management system that now updates both spectrum and chromatogram ranges without requiring an MS level parameter.

src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp (3)

716-716: API update to parameterless updateRanges() method.

The call to updateRanges() has been updated to remove the explicit MS level parameter, aligning with the refactored range management system that now handles spectrum ranges internally across all MS levels.


2553-2553: API update to parameterless updateRanges() method.

The call to updateRanges() has been updated to remove the explicit MS level parameter, aligning with the refactored range management system.


2594-2594: API update to parameterless updateRanges() method.

The call to updateRanges() for chromatogram data has been updated to remove the explicit MS level parameter, consistent with the refactored range management system.

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

1031-1032: Minor formatting improvement.

Added a blank line after the temporary file creation for better code readability.


1035-1036: Minor formatting improvement.

Added a blank line before the test assertion and improved spacing for better readability.

src/openms_gui/include/OpenMS/VISUAL/LayerDataPeak.h (1)

63-63: Updated to use more specific spectrum range retrieval method.

Changed from using the generic getDataRange() to the more specific spectrumRanges() method, which aligns with the refactored range management system that separately handles spectrum and chromatogram ranges. This change provides more granular access to range information and is consistent with the architectural improvements in the MSExperiment class.

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

14-35: Output format improved with more detailed range organization

The output format has been restructured to show more granular range information, with clear separation between:

  • Combined ranges (spectra + chromatograms)
  • Spectrum-specific ranges
  • MS level-specific ranges
  • Chromatogram-specific ranges

This change improves clarity and better reflects the architectural changes in range management.

🧰 Tools
🪛 LanguageTool

[typographical] ~15-~15: Two consecutive dots
Context: ...hromatograms): retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ...ectrum Ranges: retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ...evel 1 Ranges: retention time: 474.56 .. 475.32 sec (0.0 min) mass-to-charge: ...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 937.28 .. 941.20 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...937.28 .. 941.20 ion mobility: .. intensity: 1639.00 .. 18025.00...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...: .. intensity: 1639.00 .. 18025.00 Chromatogram Ranges: retent...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/openms/source/FORMAT/MzQCFile.cpp (1)

110-112: Updated to use the new range management interface

The code now correctly uses spectrumRanges() accessor to retrieve range information instead of directly calling methods on the MSExperiment object. This is consistent with the refactored range management system.

@cbielow - This change relies on spectrumRanges() instead of direct range access from the experiment. Can you confirm this is the intended semantics as questioned in the previous review?

src/openms_gui/include/OpenMS/VISUAL/LayerDataChrom.h (1)

53-53: Updated to use chromatogram-specific range interface

The code now correctly uses chromatogramRanges() accessor to retrieve range information for chromatograms. This is consistent with the architectural change to separate range management for spectra and chromatograms.

src/topp/Resampler.cpp (3)

119-119: Updated isEmpty check to use the spectrum range manager

The code now correctly uses spectrumRanges() accessor before calling RangeRT::isEmpty(), adhering to the new range management architecture.


122-122: Updated to access RT range through spectrum range manager

The code now properly retrieves minimum retention time using spectrumRanges().getMinRT() instead of directly from the experiment.


127-127: Updated to access maximum RT through spectrum range manager

The code now properly retrieves maximum retention time using spectrumRanges().getMaxRT() instead of directly from the experiment.

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

13-34: LGTM! Updated output format with separate range types is clear and logical.

The output has been restructured to show detailed range information categorized by type (combined, spectrum, MS level-specific, and chromatogram ranges). This breakdown provides more granular information to users and is consistent with the PR's goal of enhancing range management.

🧰 Tools
🪛 LanguageTool

[typographical] ~14-~14: Two consecutive dots
Context: ... chromatograms): retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 Sp...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 Spectrum Ranges: retention ti...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 MS...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 MS Level 1 Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 0.00 .. 6.00 sec (0.1 min) mass-to-charge: 50...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.1 min) mass-to-charge: 500.00 .. 1100.00 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...00.00 .. 1100.00 ion mobility: .. intensity: 50.00 .. 400.00 Ch...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...ty: .. intensity: 50.00 .. 400.00 Chromatogram Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

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

14-41: LGTM! Enhanced range information display format.

The output format has been expanded to show detailed range information separated by category - combined ranges, spectrum ranges, MS level-specific ranges (both level 1 and 2), and chromatogram ranges. This change aligns with the refactored range management system and provides more detailed information to users.

🧰 Tools
🪛 LanguageTool

[typographical] ~15-~15: Two consecutive dots
Context: ... chromatograms): retention time: 0.26 .. 37.64 sec (0.6 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ... sec (0.6 min) mass-to-charge: 207.51 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...07.51 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ...Spectrum Ranges: retention time: 0.26 .. 37.64 sec (0.6 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ... sec (0.6 min) mass-to-charge: 207.51 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...07.51 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... Level 1 Ranges: retention time: 0.26 .. 32.24 sec (0.5 min) mass-to-charge: 4...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ... sec (0.5 min) mass-to-charge: 402.48 .. 1496.08 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...02.48 .. 1496.08 ion mobility: .. intensity: 12.15 .. 25903.89 ...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...ty: .. intensity: 12.15 .. 25903.89 MS Level 2 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 21.95 .. 37.64 sec (0.3 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 207.51 .. 1035.83 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ...07.51 .. 1035.83 ion mobility: .. intensity: 13.39 .. 3633.01 C...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...ty: .. intensity: 13.39 .. 3633.01 Chromatogram Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~39-~39: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

src/openms/source/FEATUREFINDER/FeatureFinderAlgorithmPicked.cpp (3)

245-248: LGTM! Improved range access with explicit MS level 1 specification.

Changed from using general range queries to explicitly specifying MS level 1 ranges. This makes it clearer that feature finding operates on MS1 data only and prevents potential issues from including ranges from other MS levels.


359-359: LGTM! Explicit MS level 1 range access for mass calculation.

The code now explicitly uses MS level 1 spectra ranges to determine the maximum mass for isotope distribution precalculation, which is more accurate than using the entire experiment range.


1832-1834: LGTM! Explicit MS level 1 range access for intensity scoring.

Changed from using general range values to explicitly querying MS level 1 ranges for intensity score calculation, making the code more precise about the data it uses.

src/openms/source/FEATUREFINDER/MultiplexClustering.cpp (2)

34-37: Consider consistency in range access approach.

This constructor uses spectrumRanges() without specifying an MS level, while the second constructor (lines 84-87) explicitly filters by MS level 1. If both should behave similarly, consider adding .byMSLevel(1) here as well.

Is exp_profile already guaranteed to contain only MS level 1 spectra, making the MS level filter unnecessary? Or should this constructor also filter by MS level 1 for consistency?


84-87: LGTM! Explicit MS level 1 range access.

Correctly updated to use MS level 1-specific ranges for experiment boundaries, which improves precision by excluding non-MS1 data from range calculations.

src/topp/ImageCreator.cpp (3)

272-272: LGTM! Updated range update method.

The updateRanges() call no longer takes a parameter, reflecting the refactored API that now updates all ranges collectively.


276-277: LGTM! Using MS level 1-specific ranges for image dimensions.

The calculation of image width now correctly uses MS level 1-specific m/z ranges, which is appropriate since the visualization focuses on MS1 data.


288-290: LGTM! MS level 1-specific ranges for coordinate mapping.

The bilinear interpolation mapping now uses MS level 1-specific ranges, ensuring that the image dimensions properly reflect the MS1 data being visualized.

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

15-43: Improved range reporting format provides detailed data segmentation

The output has been restructured to provide more granular range information by separating:

  1. Combined ranges (lines 15-19)
  2. Spectrum-specific ranges (lines 21-25)
  3. MS Level 1 ranges (lines 27-31)
  4. MS Level 2 ranges (lines 33-37)
  5. Chromatogram ranges (lines 39-42)

This implementation successfully fulfills the PR objective of defining and managing separate ranges for spectra, chromatograms, and combined ranges.

🧰 Tools
🪛 LanguageTool

[typographical] ~16-~16: Two consecutive dots
Context: ...chromatograms): retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~18-~18: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~19-~19: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 Spectrum Ranges: retention ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...pectrum Ranges: retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~24-~24: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~25-~25: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 MS Level 1 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...Level 1 Ranges: retention time: 20.87 .. 39.97 sec (0.3 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ... sec (0.3 min) mass-to-charge: 500.07 .. 1497.28 ion mobility: .. <none...

(DOUBLE_PUNCTUATION)


[typographical] ~30-~30: Two consecutive dots
Context: ...00.07 .. 1497.28 ion mobility: .. intensity: 16.30 .. 38920.12 ...

(DOUBLE_PUNCTUATION)


[typographical] ~31-~31: Two consecutive dots
Context: ...ty: .. intensity: 16.30 .. 38920.12 MS Level 2 Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...Level 2 Ranges: retention time: 25.40 .. 39.11 sec (0.2 min) mass-to-charge: 5...

(DOUBLE_PUNCTUATION)


[typographical] ~35-~35: Two consecutive dots
Context: ... sec (0.2 min) mass-to-charge: 500.10 .. 850.08 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~36-~36: Two consecutive dots
Context: ...500.10 .. 850.08 ion mobility: .. intensity: 23.68 .. 729.68 Ch...

(DOUBLE_PUNCTUATION)


[typographical] ~37-~37: Two consecutive dots
Context: ...ty: .. intensity: 23.68 .. 729.68 Chromatogram Ranges: retentio...

(DOUBLE_PUNCTUATION)


[typographical] ~40-~40: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~41-~41: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~42-~42: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

doc/code_examples/Tutorial_MSExperiment.cpp (1)

55-66: Updated API usage examples for the new range management system

The tutorial code has been properly updated to:

  1. Clarify that updateRanges() now affects both spectra and chromatograms
  2. Replace exp.printRange() with exp.spectrumRanges().printRange()
  3. Demonstrate the new getters for accessing specific range components

This provides clear guidance on how to use the new range access methods and follows good documentation practices by keeping the tutorial aligned with implementation changes.

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

209-210: Pure-formatting change looks good – the single-space indentation fix in the VSSC switch branch has no behavioural impact.

src/topp/FileInfo.cpp (1)

2087-2087: Update-call argument removal is correct

MSExperiment::updateRanges() was recently refactored to take no arguments.
The old updateRanges(1) call is fixed here; good catch.

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

2847-2853: Test expectation hides a real bug (minMZ == 0)

The combined range should never start at 0 Da here – the only m/z values
present are 100 Da (spectrum) and 305/405 Da (chromatograms).
The expectation of 0.0 masks the issue described in the production code
(comment above). After fixing the range logic, please update the assertion:

- TEST_REAL_SIMILAR(exp.combinedRanges().getMinMZ(), 0.0); // TODO: Why 0?
+ TEST_REAL_SIMILAR(exp.combinedRanges().getMinMZ(), 100.0);
src/openms/include/OpenMS/KERNEL/MSExperiment.h (1)

1119-1124: Template extend only touches the combined manager

For the same reason as above, extend(const RangeManager<...>&) should either (a) document that it only updates the legacy combined range, or (b) be extended to propagate to the dedicated spectrum/chromatogram managers as well. Silent divergence will be very hard to track later.

Comment thread src/topp/FileInfo.cpp
Comment on lines +219 to +267
void writeRangesHumanReadable_(const MSExperiment& exp, ostream &os)
{
// 1. Display Combined Ranges (same format as before for backward compatibility)
os << "Combined Ranges (spectra + chromatograms):" << '\n';
// Use the combinedRanges() accessor
if (exp.combinedRanges().RangeRT::isEmpty())
{
os << " retention time: <none> .. <none> sec (<none> min)\n";
}
else
{
os << " retention time: " << String::number(exp.combinedRanges().getMinRT(), 2) << " .. "
<< String::number(exp.combinedRanges().getMaxRT(), 2) << " sec ("
<< String::number((exp.combinedRanges().getMaxRT() - exp.combinedRanges().getMinRT()) / 60, 1) << " min)\n";
}

// Display m/z range
if (exp.combinedRanges().RangeMZ::isEmpty())
{
os << " mass-to-charge: <none> .. <none>\n";
}
else
{
os << " mass-to-charge: " << String::number(exp.combinedRanges().getMinMZ(), 2) << " .. "
<< String::number(exp.combinedRanges().getMaxMZ(), 2) << '\n';
}

// Display mobility range if present
if (exp.combinedRanges().RangeMobility::isEmpty())
{
os << " ion mobility: <none> .. <none>\n";
}
else
{
os << " ion mobility: " << String::number(exp.combinedRanges().getMinMobility(), 2) << " .. "
<< String::number(exp.combinedRanges().getMaxMobility(), 2) << '\n';
}

// Display intensity range
if (exp.combinedRanges().RangeIntensity::isEmpty())
{
os << " intensity: <none> .. <none>\n\n";
}
else
{
os << " intensity: " << String::number(exp.combinedRanges().getMinIntensity(), 2) << " .. "
<< String::number(exp.combinedRanges().getMaxIntensity(), 2) << "\n\n";
}

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.

🛠️ Refactor suggestion

Large duplication – factor out helper to print one dimension

The specialised writeRangesHumanReadable_(const MSExperiment&) re-implements the same four-line block (“if empty… else…”) for every dimension six times.
This is hard to maintain and already diverges from the generic template (note the missing newline after the opening quote there).

Consider extracting a tiny lambda/helper:

auto printDim = [&](auto&& rng, auto getterMin, auto getterMax,
                    const char* label, const char* unit_suffix = "") {
  if (rng.isEmpty())
    os << "  " << label << ": <none> .. <none>" << unit_suffix << '\n';
  else
    os << "  " << label << ": " << String::number((rng.*getterMin)(), 2)
       << " .. "              << String::number((rng.*getterMax)(), 2)
       << unit_suffix << '\n';
};

You would then write:

printDim(exp.combinedRanges(), &RangeRT::getMinRT, &RangeRT::getMaxRT,
         "retention time", " sec");

This trims ~150 lines and keeps the logic centralised.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 219-408: src/topp/FileInfo.cpp#L219-L408
Complex Method

🤖 Prompt for AI Agents
In src/topp/FileInfo.cpp between lines 219 and 267, the code repeatedly prints
range information for multiple dimensions using nearly identical if-else blocks,
causing duplication and maintenance issues. Refactor by extracting a helper
function or lambda that takes a range object, pointers to getter methods for min
and max values, a label, and an optional unit suffix, then prints the formatted
range or "<none>" if empty. Replace each duplicated block with calls to this
helper, passing the appropriate range and label parameters, to centralize and
simplify the printing logic.

Comment thread src/topp/FileInfo.cpp
Comment on lines +457 to 622
if (!exp.combinedRanges().RangeRT::isEmpty())
{
os << "general: combined ranges: retention time: min" << '\t' << String::number(exp.combinedRanges().getMinRT(), 2) << '\n'
<< "general: combined ranges: retention time: max" << '\t' << String::number(exp.combinedRanges().getMaxRT(), 2) << '\n';
}
else
{
os << "general: combined ranges: retention time: min" << '\t' << "<none>" << '\n'
<< "general: combined ranges: retention time: max" << '\t' << "<none>" << '\n';
}

if (!exp.combinedRanges().RangeMZ::isEmpty())
{
os << "general: combined ranges: mass-to-charge: min" << '\t' << String::number(exp.combinedRanges().getMinMZ(), 2) << '\n'
<< "general: combined ranges: mass-to-charge: max" << '\t' << String::number(exp.combinedRanges().getMaxMZ(), 2) << '\n';
}
else
{
os << "general: combined ranges: mass-to-charge: min" << '\t' << "<none>" << '\n'
<< "general: combined ranges: mass-to-charge: max" << '\t' << "<none>" << '\n';
}

if (!exp.combinedRanges().RangeMobility::isEmpty())
{
os << "general: combined ranges: ion-mobility: min" << '\t' << String::number(exp.combinedRanges().getMinMobility(), 2) << '\n'
<< "general: combined ranges: ion-mobility: max" << '\t' << String::number(exp.combinedRanges().getMaxMobility(), 2) << '\n';
}

if (!exp.combinedRanges().RangeIntensity::isEmpty())
{
os << "general: combined ranges: intensity: min" << '\t' << String::number(exp.combinedRanges().getMinIntensity(), 2) << '\n'
<< "general: combined ranges: intensity: max" << '\t' << String::number(exp.combinedRanges().getMaxIntensity(), 2) << '\n';
}
else
{
os << "general: combined ranges: intensity: min" << '\t' << "<none>" << '\n'
<< "general: combined ranges: intensity: max" << '\t' << "<none>" << '\n';
}

// 2. Spectrum Ranges (overall)
const auto& spec_ranges = exp.spectrumRanges();
if (!spec_ranges.RangeRT::isEmpty())
{
os << "general: spectrum ranges: retention time: min" << '\t' << String::number(spec_ranges.getMinRT(), 2) << '\n'
<< "general: spectrum ranges: retention time: max" << '\t' << String::number(spec_ranges.getMaxRT(), 2) << '\n';
}
else
{
os << "general: spectrum ranges: retention time: min" << '\t' << "<none>" << '\n'
<< "general: spectrum ranges: retention time: max" << '\t' << "<none>" << '\n';
}

// Similar code for m/z, mobility, intensity for spectrum ranges
if (!spec_ranges.RangeMZ::isEmpty())
{
os << "general: spectrum ranges: mass-to-charge: min" << '\t' << String::number(spec_ranges.getMinMZ(), 2) << '\n'
<< "general: spectrum ranges: mass-to-charge: max" << '\t' << String::number(spec_ranges.getMaxMZ(), 2) << '\n';
}
else
{
os << "general: spectrum ranges: mass-to-charge: min" << '\t' << "<none>" << '\n'
<< "general: spectrum ranges: mass-to-charge: max" << '\t' << "<none>" << '\n';
}

if (!spec_ranges.RangeMobility::isEmpty())
{
os << "general: spectrum ranges: ion-mobility: min" << '\t' << String::number(spec_ranges.getMinMobility(), 2) << '\n'
<< "general: spectrum ranges: ion-mobility: max" << '\t' << String::number(spec_ranges.getMaxMobility(), 2) << '\n';
}

if (!spec_ranges.RangeIntensity::isEmpty())
{
os << "general: spectrum ranges: intensity: min" << '\t' << String::number(spec_ranges.getMinIntensity(), 2) << '\n'
<< "general: spectrum ranges: intensity: max" << '\t' << String::number(spec_ranges.getMaxIntensity(), 2) << '\n';
}
else
{
os << "general: spectrum ranges: intensity: min" << '\t' << "<none>" << '\n'
<< "general: spectrum ranges: intensity: max" << '\t' << "<none>" << '\n';
}

// 3. MS Level-specific Ranges
std::set<UInt> ms_levels = exp.spectrumRanges().getMSLevels();
for (UInt ms_level : ms_levels)
{
const auto& level_ranges = exp.spectrumRanges().byMSLevel(ms_level);
if (!level_ranges.RangeRT::isEmpty())
{
os << "general: MS" << ms_level << " ranges: retention time: min" << '\t' << String::number(level_ranges.getMinRT(), 2) << '\n'
<< "general: MS" << ms_level << " ranges: retention time: max" << '\t' << String::number(level_ranges.getMaxRT(), 2) << '\n';
}
else
{
os << "general: MS" << ms_level << " ranges: retention time: min" << '\t' << "<none>" << '\n'
<< "general: MS" << ms_level << " ranges: retention time: max" << '\t' << "<none>" << '\n';
}

// Similar code for other dimensions
if (!level_ranges.RangeMZ::isEmpty())
{
os << "general: MS" << ms_level << " ranges: mass-to-charge: min" << '\t' << String::number(level_ranges.getMinMZ(), 2) << '\n'
<< "general: MS" << ms_level << " ranges: mass-to-charge: max" << '\t' << String::number(level_ranges.getMaxMZ(), 2) << '\n';
}
else
{
os << "general: MS" << ms_level << " ranges: mass-to-charge: min" << '\t' << "<none>" << '\n'
<< "general: MS" << ms_level << " ranges: mass-to-charge: max" << '\t' << "<none>" << '\n';
}

if (!level_ranges.RangeMobility::isEmpty())
{
os << "general: MS" << ms_level << " ranges: ion-mobility: min" << '\t' << String::number(level_ranges.getMinMobility(), 2) << '\n'
<< "general: MS" << ms_level << " ranges: ion-mobility: max" << '\t' << String::number(level_ranges.getMaxMobility(), 2) << '\n';
}

if (!level_ranges.RangeIntensity::isEmpty())
{
os << "general: MS" << ms_level << " ranges: intensity: min" << '\t' << String::number(level_ranges.getMinIntensity(), 2) << '\n'
<< "general: MS" << ms_level << " ranges: intensity: max" << '\t' << String::number(level_ranges.getMaxIntensity(), 2) << '\n';
}
else
{
os << "general: MS" << ms_level << " ranges: intensity: min" << '\t' << "<none>" << '\n'
<< "general: MS" << ms_level << " ranges: intensity: max" << '\t' << "<none>" << '\n';
}
}

// 4. Chromatogram Ranges
const auto& chrom_ranges = exp.chromatogramRanges();
if (!chrom_ranges.RangeRT::isEmpty())
{
os << "general: chromatogram ranges: retention time: min" << '\t' << String::number(chrom_ranges.getMinRT(), 2) << '\n'
<< "general: chromatogram ranges: retention time: max" << '\t' << String::number(chrom_ranges.getMaxRT(), 2) << '\n';
}
else
{
os << "general: chromatogram ranges: retention time: min" << '\t' << "<none>" << '\n'
<< "general: chromatogram ranges: retention time: max" << '\t' << "<none>" << '\n';
}

// Similar code for m/z and intensity for chromatogram ranges
if (!chrom_ranges.RangeMZ::isEmpty())
{
os << "general: chromatogram ranges: mass-to-charge: min" << '\t' << String::number(chrom_ranges.getMinMZ(), 2) << '\n'
<< "general: chromatogram ranges: mass-to-charge: max" << '\t' << String::number(chrom_ranges.getMaxMZ(), 2) << '\n';
}
else
{
os << "general: chromatogram ranges: mass-to-charge: min" << '\t' << "<none>" << '\n'
<< "general: chromatogram ranges: mass-to-charge: max" << '\t' << "<none>" << '\n';
}

if (!chrom_ranges.RangeIntensity::isEmpty())
{
os << "general: chromatogram ranges: intensity: min" << '\t' << String::number(chrom_ranges.getMinIntensity(), 2) << '\n'
<< "general: chromatogram ranges: intensity: max" << '\t' << String::number(chrom_ranges.getMaxIntensity(), 2) << '\n';
}
else
{
os << "general: chromatogram ranges: intensity: min" << '\t' << "<none>" << '\n'
<< "general: chromatogram ranges: intensity: max" << '\t' << "<none>" << '\n';
}
}

template <class T>
void writeSummaryStatisticsMachineReadable_(const Math::SummaryStatistics<T> &stats, ostream &os, String title)

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.

🛠️ Refactor suggestion

Machine-readable writer suffers from the same duplication – easy to drift out of sync

writeRangesMachineReadable_(const MSExperiment&) duplicates almost the same
four boiler-plate blocks (RT, m/z, IM, intensity) for combined, spectrum,
per-MS-level and chromatogram ranges.
If the string key ever changes, every copy must be touched.

After extracting the helper suggested above you can reuse it here; just pass
the category prefix (“general: combined ranges”, “general: spectrum ranges” …)
to generate the key.

This will:

  1. Reduce the function to ~80 LOC,
  2. Guarantee consistent formatting,
  3. Make adding a new dimension straightforward.
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 457-624: src/topp/FileInfo.cpp#L457-L624
Complex Method

🤖 Prompt for AI Agents
In src/topp/FileInfo.cpp lines 457 to 622, the writeRangesMachineReadable_
function duplicates similar blocks of code for different range categories
(combined, spectrum, MS-level, chromatogram) with repeated checks and output
formatting for RT, m/z, mobility, and intensity. To fix this, extract a helper
function that takes the range object and a category prefix string to handle the
printing of all dimensions consistently. Then replace the duplicated blocks in
writeRangesMachineReadable_ with calls to this helper, passing the appropriate
prefix and range. This will reduce code duplication, ensure consistent output
formatting, and simplify future extensions.

@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 (3)
src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1)

108-115: ⚠️ Potential issue

byMSLevel() throws although documentation promises global range fallback

The method's documentation indicates it should return the global range as a fallback when the requested MS level does not exist, but the implementation throws an exception instead. This creates a contract violation and forces callers to implement exception handling.

const BaseType& byMSLevel(UInt ms_level = 0) const
{
  if (ms_level == 0) return *this;               // global ⇒ BaseType
  auto it = ms_level_ranges_.find(ms_level);
- if (ms_level_ranges_.find(ms_level) == ms_level_ranges_.end())
- {
-   throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "No ranges for this MS level", String(ms_level));
- }
- return ms_level_ranges_.at(ms_level);
+ return (it == ms_level_ranges_.end()) ? *this : it->second;
}
src/openms/include/OpenMS/KERNEL/MSExperiment.h (2)

11-19: ⚠️ Potential issue

Missing standard library includes

This header uses std::copy_if, lower_bound, upper_bound, max_element, min_element, accumulate, distance, and iterator traits without directly including the necessary standard headers.

#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/KERNEL/AreaIterator.h>
#include <OpenMS/KERNEL/ChromatogramRangeManager.h>
#include <OpenMS/KERNEL/MSChromatogram.h>
#include <OpenMS/KERNEL/MSSpectrum.h>
#include <OpenMS/KERNEL/SpectrumRangeManager.h>
#include <OpenMS/METADATA/ExperimentalSettings.h>
#include <OpenMS/DATASTRUCTURES/Matrix.h>
+#include <algorithm>
+#include <numeric>
+#include <iterator>

#include <vector>

1121-1148: ⚠️ Potential issue

Range extension methods don't keep managers in sync

The extendRT, extendMZ, extendIntensity, and extendMobility methods only update the combined range manager, leaving the spectrum and chromatogram range managers out of sync. This will lead to inconsistent values when mixing legacy methods with the new per-container accessors.

void extendRT(double rt) 
{ 
  combined_ranges_.extendRT(rt); 
+  spectrum_ranges_.extendRT(rt, 0);  // Update global spectrum range
+  chromatogram_ranges_.extendRT(rt);
}

void extendMZ(double mz) 
{ 
  combined_ranges_.extendMZ(mz); 
+  spectrum_ranges_.extendMZ(mz, 0);  // Update global spectrum range
+  chromatogram_ranges_.extendMZ(mz);
}

void extendIntensity(double intensity) 
{ 
  combined_ranges_.extendIntensity(intensity); 
+  spectrum_ranges_.extendIntensity(intensity, 0);  // Update global spectrum range
+  chromatogram_ranges_.extendIntensity(intensity);
}

void extendMobility(double mobility) 
{ 
  combined_ranges_.extendMobility(mobility); 
+  spectrum_ranges_.extendMobility(mobility, 0);  // Update global spectrum range
}
🧹 Nitpick comments (3)
src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (3)

18-18: Remove redundant forward declaration of MSSpectrum

The MSSpectrum class is already included on line 12, making this forward declaration unnecessary.

-  class MSSpectrum;  // Forward declaration for MSSpectrum

122-130: Optimize getMSLevels() implementation

The current implementation creates a new set and inserts elements one by one. A more efficient approach would be to use a range constructor with std::transform.

std::set<UInt> getMSLevels() const
{
-  std::set<UInt> ms_levels;
-  for (const auto& [level, _] : ms_level_ranges_)
-  {
-    ms_levels.insert(level);
-  }
-  return ms_levels;
+  std::set<UInt> ms_levels;
+  ms_levels.reserve(ms_level_ranges_.size());  // Preallocate if possible
+  for (const auto& [level, _] : ms_level_ranges_)
+  {
+    ms_levels.insert(level);
+  }
+  return ms_levels;
}

183-197: Consider adding MS level parameter validation

The method accepts any unsigned integer as MS level without validation. In mass spectrometry, MS levels typically range from 1 to 10. Consider adding validation or documentation about valid MS level ranges.

void extendUnsafe(const MSSpectrum& spectrum, UInt ms_level)
{
+  // Validate ms_level if needed
+  // if (ms_level > MAX_MS_LEVEL) { /* handle error */ }
  if (ms_level == 0)
  {
    BaseType::extendUnsafe(spectrum.getRange());
  }
  else
  {
    if (ms_level_ranges_.find(ms_level) == ms_level_ranges_.end())
    {
      ms_level_ranges_[ms_level] = BaseType();
    }
    ms_level_ranges_[ms_level].extendUnsafe(spectrum.getRange());
  }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 303a393 and a52a60e.

📒 Files selected for processing (3)
  • src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (1 hunks)
  • src/openms/include/OpenMS/KERNEL/MSExperiment.h (5 hunks)
  • src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • 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 (macos-14, xcode, 15.0.1)
  • GitHub Check: cppcheck-test
🔇 Additional comments (5)
src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1)

155-174: LGTM - Fixed parameter name in extendMZ()

The parameter name and documentation now correctly refer to "mz" instead of "rt", resolving the previous issue.

src/openms/include/OpenMS/KERNEL/MSExperiment.h (4)

1077-1088: LGTM - Range clearing properly syncs all range managers

The clearRanges() method correctly clears all three range managers, ensuring consistent state.


1168-1178: LGTM - Updated updateRanges documentation

The documentation for updateRanges() now clearly explains that it updates all three range managers.


1388-1395: LGTM - Well-structured range manager members

Good organization of the range manager member variables with clear separation between spectrum, chromatogram, and combined ranges.


1398-1461: LGTM - Well-documented accessor methods

The accessor methods for the range managers are well-documented, clearly explaining their purpose and usage patterns.

Comment on lines +1162 to +1166
template<typename... RangeBasesOther>
void extend(const RangeManager<RangeBasesOther...>& rhs)
{
combined_ranges_.extendUnsafe(rhs);
}

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.

⚠️ Potential issue

extend() method should update all range managers

Similar to the individual extension methods, the extend() method only updates the combined range manager, which can lead to inconsistent state across range managers.

template<typename... RangeBasesOther>
void extend(const RangeManager<RangeBasesOther...>& rhs)
{
  combined_ranges_.extendUnsafe(rhs);
+  spectrum_ranges_.extend(rhs, 0);  // Update global spectrum range
+  chromatogram_ranges_.extend(rhs);
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/openms/include/OpenMS/KERNEL/MSExperiment.h around lines 1162 to 1166,
the extend() method currently updates only the combined_ranges_ manager, causing
inconsistency. Modify the method to also update all individual range managers
similarly to the individual extension methods, ensuring all range managers
remain in sync after the extension.

@cbielow cbielow 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.

partial review. will continue later :)

Comment on lines +69 to +72
typedef SpectrumRangeManager SpectrumRangeManagerType;

/// Chromatogram range manager type for tracking chromatogram-specific ranges
typedef ChromatogramRangeManager ChromatogramRangeManagerType;

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.

switch to more modern using ...??

Comment on lines +1345 to +1353
* @brief Returns a reference to the spectrum range manager
*
* The spectrum range manager provides access to m/z, intensity, retention time, and ion mobility
* ranges for spectra, with separate tracking for different MS levels.
*
* @return Reference to the spectrum range manager
* @see SpectrumRangeManager
*/
SpectrumRangeManagerType& spectrumRanges() { return spectrum_ranges_; }

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.

this would allow 'hacking' ranges externally and destroy the invariant.
Do we really want/need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah that is good point. ranges are already pretty lax regarding invariants. Will remove

double mz_start = map_.getMinMZ();
intensity_rt_step_ = (map_.getMaxRT() - rt_start) / (double)intensity_bins_;
intensity_mz_step_ = (map_.getMaxMZ() - mz_start) / (double)intensity_bins_;
double rt_start = map_.spectrumRanges().byMSLevel(1).getMinRT();

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.

+1

addMetric("QC:4000135", exp.getChromatograms().size());
// Run time (RT duration)
addMetric("QC:4000053", UInt(exp.getMaxRT() - exp.getMinRT()));
addMetric("QC:4000053", UInt(exp.spectrumRanges().getMaxRT() - exp.spectrumRanges().getMinRT()));

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.

sounds correct

Comment on lines +257 to +261
spectrum_ranges_.extendUnsafe(*it);
spectrum_ranges_.extendRT(it->getRT()); // RT is not part of the range of an individual spectrum

spectrum_ranges_.extendUnsafe(*it, it->getMSLevel());
spectrum_ranges_.extendRT(it->getRT(), it->getMSLevel()); // RT is not part of the range of an individual spectrum

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.

not sure if I get this right, but you could just do MS levels here and then update the overall range just once using all MS levels

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right. makes sense.
I think I did not do it because I was unsure about how to handle ms level dependent things like
precusors (technically level - 1).
Do you have an opinion on that?

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.

interesting point.
I can only think of one use case, which is TOPPView.
When viewing an MSExp with only MS2 in 2D Mode, you'd want to see to positions of the precursors.
This means (for TV), we would ideally put positions of PC's in the preceding MS-level.
This MS level range then is non-empty, even though there are no actual spectra in the experiment. Not sure if this is confusing.
Especially if you derive the available MS levels from that range information.

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.

maybe these 'virtual' ranges, which are not backed up by data should be flagged as 'from_precursor'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how would you flag them without adding rangemanager? already a lot of ranges :)
Maybe we just don't add the precursor information at all und extract this in TOPPView?

@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 (4)
src/openms/source/KERNEL/MSExperiment.cpp (4)

253-259: Optimize MS level handling

The current implementation processes each spectrum twice - once for the general ranges and once for the MS level-specific ranges. Consider updating all MS levels in a single pass through the data and then updating the overall range just once using all MS levels.

// Update spectrum range manager with this spectrum's ranges
// Add to both general ranges and MS level-specific ranges
- spectrum_ranges_.extendUnsafe(*it);
- spectrum_ranges_.extendRT(it->getRT()); // RT is not part of the range of an individual spectrum
  
- spectrum_ranges_.extendUnsafe(*it, it->getMSLevel());
- spectrum_ranges_.extendRT(it->getRT(), it->getMSLevel()); // RT is not part of the range of an individual spectrum
+ // Update only the MS level-specific ranges first
+ spectrum_ranges_.extendUnsafe(*it, it->getMSLevel());
+ spectrum_ranges_.extendRT(it->getRT(), it->getMSLevel()); // RT is not part of the range of an individual spectrum

Then after the loop, add:

// After processing all spectra, update the general ranges from MS level-specific ranges
for (UInt level : getMSLevels()) {
  spectrum_ranges_.extendUnsafe(spectrum_ranges_.byMSLevel(level));
}

227-235: ⚠️ Potential issue

Incorrect order of operations can lead to false warnings

The code captures the current range values before calling clearRanges() (in line 239), which resets all range managers, including combined_ranges_. This invalidates the snapshot and can cause false warnings when the ranges were actually already correct.

Move the code that captures range values to after the clearRanges() call to ensure the snapshot reflects the updated state:

#ifdef OPENMS_ASSERTIONS
-  double rt_min = combined_ranges_.RangeRT::isEmpty() ? 0 : combined_ranges_.getMinRT();
-  double rt_max = combined_ranges_.RangeRT::isEmpty() ? 0 : combined_ranges_.getMaxRT();
-  double mz_min = combined_ranges_.RangeMZ::isEmpty() ? 0 : combined_ranges_.getMinMZ();
-  double mz_max = combined_ranges_.RangeMZ::isEmpty() ? 0 : combined_ranges_.getMaxMZ();
-  double int_min = combined_ranges_.RangeIntensity::isEmpty() ? 0 : combined_ranges_.getMinIntensity();
-  double int_max = combined_ranges_.RangeIntensity::isEmpty() ? 0 : combined_ranges_.getMaxIntensity();
-  double im_min = combined_ranges_.RangeMobility::isEmpty() ? 0 : combined_ranges_.getMinMobility();
-  double im_max = combined_ranges_.RangeMobility::isEmpty() ? 0 : combined_ranges_.getMaxMobility();
#endif

// Reset all range managers
clearRanges();

#ifdef OPENMS_ASSERTIONS
+  double rt_min = combined_ranges_.RangeRT::isEmpty() ? 0 : combined_ranges_.getMinRT();
+  double rt_max = combined_ranges_.RangeRT::isEmpty() ? 0 : combined_ranges_.getMaxRT();
+  double mz_min = combined_ranges_.RangeMZ::isEmpty() ? 0 : combined_ranges_.getMinMZ();
+  double mz_max = combined_ranges_.RangeMZ::isEmpty() ? 0 : combined_ranges_.getMaxMZ();
+  double int_min = combined_ranges_.RangeIntensity::isEmpty() ? 0 : combined_ranges_.getMinIntensity();
+  double int_max = combined_ranges_.RangeIntensity::isEmpty() ? 0 : combined_ranges_.getMaxIntensity();
+  double im_min = combined_ranges_.RangeMobility::isEmpty() ? 0 : combined_ranges_.getMinMobility();
+  double im_max = combined_ranges_.RangeMobility::isEmpty() ? 0 : combined_ranges_.getMaxMobility();
#endif

279-280: ⚠️ Potential issue

Guard against default m/z values in chromatograms

The cp.getMZ() method can return 0 when the product m/z is unset, which widens the global m/z range to include 0. This can lead to incorrect m/z range calculations and unexpected behavior in downstream components.

Add a guard condition to avoid extending the m/z range with default values:

// Add RT and intensity ranges to the chromatogram manager
chromatogram_ranges_.extend(cp.getRange());
- chromatogram_ranges_.extendMZ(cp.getMZ()); // MZ is not part of the range of an individual chromatogram
+ double mz = cp.getMZ();
+ if (mz > 0) { // Only extend if it's a meaningful m/z value
+   chromatogram_ranges_.extendMZ(mz); // MZ is not part of the range of an individual chromatogram
+ }

834-836: 🛠️ Refactor suggestion

Chromatograms should not be treated as metadata

Chromatograms are data elements, not metadata, and should be cleared regardless of the clear_meta_data flag. Consider moving the chromatogram clearing outside the if (clear_meta_data) block.

void MSExperiment::clear(bool clear_meta_data)
{
  spectra_.clear();
+ chromatograms_.clear(); // Always clear chromatograms as they are data, not metadata

  if (clear_meta_data)
  {
    clearRanges(); // reset all ranges
    this->ExperimentalSettings::operator=(ExperimentalSettings());             // no "clear" method
-   chromatograms_.clear(); // TODO: should this be cleared even if clear_meta_data is false?
  }
}
🧹 Nitpick comments (2)
src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (2)

30-36: Class implements inheritance without any additional functionality

The ChromatogramRangeManager class currently just inherits from RangeManager with specific template parameters without adding any functionality. While this approach provides type safety and better code documentation than a typedef, consider explicitly declaring the rule of zero (default constructors/destructors/assignment operators) for clarity.

class OPENMS_DLLAPI ChromatogramRangeManager : public RangeManager<RangeRT, RangeIntensity, RangeMZ>
{
public:
  /// Base type
  using BaseType = RangeManager<RangeRT, RangeIntensity, RangeMZ>;

+  /// Default constructor
+  ChromatogramRangeManager() = default;
+  
+  /// Default copy constructor
+  ChromatogramRangeManager(const ChromatogramRangeManager&) = default;
+  
+  /// Default move constructor
+  ChromatogramRangeManager(ChromatogramRangeManager&&) = default;
+  
+  /// Default destructor
+  ~ChromatogramRangeManager() = default;
+  
+  /// Default copy assignment operator
+  ChromatogramRangeManager& operator=(const ChromatogramRangeManager&) = default;
+  
+  /// Default move assignment operator
+  ChromatogramRangeManager& operator=(ChromatogramRangeManager&&) = default;
};
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 35-35: src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h#L35
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)


35-35: Remove redundant blank line

The blank line at the end of the class definition is redundant and should be removed.

public:
  /// Base type
  using BaseType = RangeManager<RangeRT, RangeIntensity, RangeMZ>;
-
};
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 35-35: src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h#L35
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between cb039ae and 473a340.

📒 Files selected for processing (5)
  • doc/code_examples/Tutorial_MSExperiment.cpp (1 hunks)
  • src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (1 hunks)
  • src/openms/include/OpenMS/KERNEL/MSExperiment.h (6 hunks)
  • src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h (1 hunks)
  • src/openms/source/KERNEL/MSExperiment.cpp (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • doc/code_examples/Tutorial_MSExperiment.cpp
  • src/openms/include/OpenMS/KERNEL/MSExperiment.h
  • src/openms/include/OpenMS/KERNEL/SpectrumRangeManager.h
🧰 Additional context used
🪛 GitHub Check: CodeFactor
src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h

[notice] 35-35: src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h#L35
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 (6)
  • 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)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: cppcheck-test
🔇 Additional comments (8)
src/openms/include/OpenMS/KERNEL/ChromatogramRangeManager.h (1)

15-29: Good class documentation

The class documentation clearly explains the purpose of the ChromatogramRangeManager and its relationship with other components in the system. This provides valuable context for developers.

src/openms/source/KERNEL/MSExperiment.cpp (7)

28-31: Initialization of range manager members

The initialization of the three range manager members looks good. This approach clearly separates the concerns of spectrum and chromatogram ranges while maintaining backward compatibility with combined ranges.


48-52: Explicit copying of range managers in assignment operator

Good job explicitly copying the range managers in the assignment operator. This ensures proper resource management during assignment operations.


425-427: Good reset logic for range managers

The call to clearRanges() in the reset() method ensures all ranges are properly reset when the experiment is reset. This approach maintains consistency between the data and the range metadata.


633-635: Well-structured swap operation

The explicit swapping of the range managers in the swap() method is well implemented, ensuring that all aspects of the experiment's state are properly exchanged.


843-846: Good use of modern C++ algorithms

The refactoring of containsScanOfLevel() to use std::any_of is a good modernization that makes the code more concise and clearer in expressing intent.


850-858: Well-structured modern implementation of hasZeroIntensities

The refactoring of hasZeroIntensities() using nested std::any_of calls with lambdas is a good example of modern C++ programming. The code is concise, clear, and expresses the intent well.


284-286: Unified approach for updating the combined ranges

The approach to update the combined ranges by extending them with both spectrum and chromatogram ranges is clean and maintains backward compatibility while supporting the new separated range management.

"value": [
0,
445
18

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

now the MZ acquisition range is small for that data.
@cbielow if you want to include precursor ranges you could do this here

@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/source/KERNEL/MSExperiment.cpp (1)

272-273: ⚠️ Potential issue

Unguarded zero MZ values from chromatograms remain an issue

The code is still extending chromatogram_ranges_ with potentially zero MZ values from chromatograms, which could incorrectly widen the global m/z range to [0, …].

Add a guard condition to avoid including default values:

- chromatogram_ranges_.extendMZ(cp.getMZ()); // MZ is not part of the range of an individual chromatogram
+ double mz = cp.getMZ();
+ if (mz > 0)                          // Only extend if MZ is set (non-zero)
+   chromatogram_ranges_.extendMZ(mz);
🧹 Nitpick comments (3)
src/tests/topp/FileInfo_1_output.txt (3)

13-13: Ensure consistent capitalization in section headers.

The parenthetical terms in
Combined Ranges (spectra + chromatograms):
use lowercase, whereas other section titles (e.g., Spectrum Ranges:) capitalize key words. Consider changing to:
Combined Ranges (Spectra + Chromatograms):
for consistency throughout the output.


25-29: Consolidate per-MS level ranges when single level.

The MS Level 2 Ranges mirror the Spectrum Ranges for this single-level dataset. You might consider grouping per-level ranges under the main Spectrum Ranges section or omitting the per-level block when only one MS level is present to streamline the output.

🧰 Tools
🪛 LanguageTool

[typographical] ~26-~26: Two consecutive dots
Context: ...Level 2 Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Chromatogram Ranges: reten...

(DOUBLE_PUNCTUATION)


31-34: Conditionally display Chromatogram ranges.

All metrics in Chromatogram Ranges are <none> because there are no chromatograms in this test input. It may improve clarity to suppress this section entirely when no chromatogram data is available.

🧰 Tools
🪛 LanguageTool

[typographical] ~32-~32: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 473a340 and 54bc24d.

📒 Files selected for processing (5)
  • src/openms/source/KERNEL/MSExperiment.cpp (6 hunks)
  • src/tests/topp/FileFilter_47_output.mzML (6 hunks)
  • src/tests/topp/FileFilter_48_output.mzML (6 hunks)
  • src/tests/topp/FileInfo_1_output.txt (1 hunks)
  • src/tests/topp/QCCalculator_2_output.mzQC (4 hunks)
✅ Files skipped from review due to trivial changes (2)
  • src/tests/topp/FileFilter_47_output.mzML
  • src/tests/topp/FileFilter_48_output.mzML
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/topp/QCCalculator_2_output.mzQC
🧰 Additional context used
🪛 LanguageTool
src/tests/topp/FileInfo_1_output.txt

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Spectrum Ranges: retention...

(DOUBLE_PUNCTUATION)


[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 MS Level 2 Ranges: retenti...

(DOUBLE_PUNCTUATION)


[typographical] ~26-~26: Two consecutive dots
Context: ...Level 2 Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~27-~27: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~28-~28: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~29-~29: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Chromatogram Ranges: reten...

(DOUBLE_PUNCTUATION)


[typographical] ~32-~32: Two consecutive dots
Context: ...togram Ranges: retention time: .. sec ( min) mass-to-charg...

(DOUBLE_PUNCTUATION)


[typographical] ~33-~33: Two consecutive dots
Context: ...c ( min) mass-to-charge: .. intensity: .. N...

(DOUBLE_PUNCTUATION)


[typographical] ~34-~34: Two consecutive dots
Context: ...e: .. intensity: .. Number of spectra per MS level:...

(DOUBLE_PUNCTUATION)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • 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 (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: cppcheck-test
🔇 Additional comments (13)
src/tests/topp/FileInfo_1_output.txt (2)

14-17: Clarify range notation.

The double-dot syntax (..) is intentional here to denote numeric ranges and aligns with the other range sections. The static analysis flags for “double punctuation” can be safely ignored in this context.

🧰 Tools
🪛 LanguageTool

[typographical] ~14-~14: Two consecutive dots
Context: ...chromatograms): retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~15-~15: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~16-~16: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~17-~17: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 Spectrum Ranges: retention...

(DOUBLE_PUNCTUATION)


19-23: Review redundancy of Combined vs. Spectrum sections.

For pure spectral inputs, the values in Combined Ranges and Spectrum Ranges are identical. Please confirm whether displaying both sections is necessary, or if Combined Ranges should be omitted when no chromatogram data exists to reduce duplication.

🧰 Tools
🪛 LanguageTool

[typographical] ~20-~20: Two consecutive dots
Context: ...pectrum Ranges: retention time: -1.00 .. -1.00 sec (0.0 min) mass-to-charge: 2...

(DOUBLE_PUNCTUATION)


[typographical] ~21-~21: Two consecutive dots
Context: ... sec (0.0 min) mass-to-charge: 261.30 .. 783.50 ion mobility: .. ...

(DOUBLE_PUNCTUATION)


[typographical] ~22-~22: Two consecutive dots
Context: ...261.30 .. 783.50 ion mobility: .. intensity: 3672.00 .. 272411.0...

(DOUBLE_PUNCTUATION)


[typographical] ~23-~23: Two consecutive dots
Context: ...: .. intensity: 3672.00 .. 272411.00 MS Level 2 Ranges: retenti...

(DOUBLE_PUNCTUATION)

src/openms/source/KERNEL/MSExperiment.cpp (11)

28-31: LGTM: Constructor properly initializes the new range managers

The constructor now correctly initializes the three separate range managers that replace the inheritance-based approach.


49-52: LGTM: Proper range manager copying in assignment operator

The assignment operator now properly copies all three range managers explicitly.


238-239: LGTM: Ranges reset before updating

Good change to reset all range managers explicitly with clearRanges() before updating them.


227-235: LGTM: Snapshot moved after clearRanges()

This implementation addresses the previous issue where the snapshot of ranges was taken before clearRanges(), which could invalidate the comparison. The screenshot will now properly capture a value of 0 for empty ranges.


254-260: Good approach to MS level-specific ranges

The implementation now correctly handles both general spectrum ranges and MS level-specific ranges, extending both with the current spectrum data and retention time.


277-279: LGTM: Combining ranges correctly

The implementation properly combines spectrum and chromatogram ranges into the combined_ranges_ for backward compatibility.


625-628: LGTM: Swap method correctly handles all range managers

The swap method now properly swaps all three range managers.


824-825: LGTM: Clear method now handles chromatograms as well

The clear method now properly clears both spectra and chromatograms.


836-839: LGTM: Modernized containsScanOfLevel method

Good use of std::any_of with a lambda for a more concise and readable implementation.


842-852: LGTM: Modernized hasZeroIntensities method

Good use of std::any_of with nested lambdas for a more concise and readable implementation.


283-290: Consistent naming pattern for new/old range comparisons

The code follows a consistent naming pattern with _new suffix for the updated range values, which improves readability.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

tested in TOPPView. Works

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

I merge for nowas it looks fine now. If the qc is an issue we can change that.

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