Skip to content

Implement to_df directly in Cython files - #8520

Merged
timosachsenberg merged 14 commits into
developfrom
claude/cython-to-df-implementation-6sEWt
Dec 20, 2025
Merged

timosachsenberg merged 14 commits into
developfrom
claude/cython-to-df-implementation-6sEWt

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

Instead of using Python wrapper classes in _dataframes.py to add DataFrame export functionality, implement get_df() directly in the Cython addon files alongside get_data_dict(). This simplifies the architecture by:

  • Removing the "duck typing hack" of wrapper classes that override Cython classes
  • Putting all DataFrame logic in one place (the Cython addon files)
  • Making the code flow more straightforward

Changes:

  • MSSpectrum.pyx: Added get_df()
  • MSChromatogram.pyx: Added get_df()
  • Mobilogram.pyx: Added get_df()
  • MSExperiment.pyx: Added get_df_columns(), get_df(), get_ion_df(), get_massql_df()
  • ConsensusMap.pyx: Added get_df_columns(), get_intensity_df(), get_metadata_df(), get_df()
  • FeatureMap.pyx: Added get_df_columns(), get_df(), get_assigned_peptide_identifications()
  • MRMTransitionGroupCP.pyx: New addon with get_chromatogram_df(), get_feature_df() methods
  • _dataframes.py: Simplified to only export standalone functions
  • README.md: Updated documentation to reflect new pattern

Description

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

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

Advanced commands (admins / reviewer only)

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

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

Summary by CodeRabbit

  • New Features
    • Unified, expanded tabular exports (pandas DataFrame and Apache Arrow) for spectra, chromatograms, features, consensus maps, experiments and identifications, with column discovery, separate intensity/metadata views, selectable columns, and in-place score updates.
  • Documentation
    • README and docstrings updated with the new DataFrame/column-discovery API and examples; lazy-import guidance for optional dependencies.
  • Bug Fixes
    • Improved meta-value handling, dtype stability, and clearer errors when optional dependencies are missing.
  • Tests
    • Extensive tests for DataFrame/Arrow exports, column selection, peptide-ID flows, score updates, and edge cases.
  • Chores
    • Pandas made optional for install; CI adjusted to install optional deps for testing.

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

Instead of using Python wrapper classes in _dataframes.py to add DataFrame
export functionality, implement get_df() directly in the Cython addon files
alongside get_data_dict(). This simplifies the architecture by:

- Removing the "duck typing hack" of wrapper classes that override Cython classes
- Putting all DataFrame logic in one place (the Cython addon files)
- Making the code flow more straightforward

Changes:
- MSSpectrum.pyx: Added get_df()
- MSChromatogram.pyx: Added get_df()
- Mobilogram.pyx: Added get_df()
- MSExperiment.pyx: Added get_df_columns(), get_df(), get_ion_df(), get_massql_df()
- ConsensusMap.pyx: Added get_df_columns(), get_intensity_df(), get_metadata_df(), get_df()
- FeatureMap.pyx: Added get_df_columns(), get_df(), get_assigned_peptide_identifications()
- MRMTransitionGroupCP.pyx: New addon with get_chromatogram_df(), get_feature_df() methods
- _dataframes.py: Simplified to only export standalone functions
- README.md: Updated documentation to reflect new pattern
- Add get_df() and update_scores_from_df() methods to PeptideIdentificationList.pyx
  following the same pattern as other data structures
- Update _dataframes.py to use backwards-compatible wrapper functions that call the
  new methods (peptide_identifications_to_df → peps.get_df(), update_scores_from_df → peps.update_scores_from_df())
- Simplify _dataframes.py by removing duplicate implementation code
- Add comprehensive tests for:
  - PeptideIdentificationList.get_df() with various parameters
  - PeptideIdentificationList.update_scores_from_df()
  - Mobilogram.get_df() column selection
  - Backwards-compatible wrapper functions
@OpenMS OpenMS deleted a comment from coderabbitai Bot Dec 18, 2025
@jpfeuffer

Copy link
Copy Markdown
Contributor

Nice! You'll probably need pandas at build time now, not just during testing.
Not sure if we are checking for this in cake or setup.py/project.toml

Bonus points for doing it with arrow, too.

- Use lazy pandas imports inside methods to avoid module-level import issues
- Replace bool() calls with len() > 0 to avoid Cython type conflicts
- Replace {bool: ...} dict keys with {type(True): ...} for same reason
- Rename 'long' parameter to 'long_format' to avoid Cython keyword conflict

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds standardized DataFrame and Arrow export APIs (get_df_columns, get_df, to_arrow) across many pyOpenMS addons, centralizes a few DataFrame helpers in pyopenms/_dataframes.py, updates README and tests, implements selective column and meta-value handling, and uses lazy pandas/pyarrow imports.

Changes

Cohort / File(s) Summary
Documentation
src/pyOpenMS/README.md
README updated to document the new DataFrame export pattern (get_df_columns, get_data_dict, get_df) and examples updated for lazy pandas import and centralized helpers.
ConsensusMap addon
src/pyOpenMS/addons/ConsensusMap.pyx
Added get_df_columns, get_metadata_df, get_intensity_df, get_df, to_arrow; added numpy and _defaultdict imports; supports selective columns and Arrow conversion with dependency checks.
FeatureMap addon
src/pyOpenMS/addons/FeatureMap.pyx
Added get_df_columns, _get_prot_id_filename_from_pep_id, get_df, to_arrow, get_assigned_peptide_identifications; handles meta-values, peptide-ID export, and dtype mapping for DataFrame construction.
MRMTransitionGroupCP addon
src/pyOpenMS/addons/MRMTransitionGroupCP.pyx
Added chromatogram/feature export helpers and Arrow converters (get_chromatogram_df_columns, get_feature_df_columns, get_chromatogram_df, get_feature_df, chromatograms_to_arrow, features_to_arrow); supports meta-value typing and structured arrays.
Spectrum / Chromatogram / Mobilogram addons
src/pyOpenMS/addons/MSSpectrum.pyx, src/pyOpenMS/addons/MSChromatogram.pyx, src/pyOpenMS/addons/Mobilogram.pyx
Added get_df and to_arrow wrappers that call existing get_data_dict and convert to pandas DataFrame / pyarrow Table with lazy imports and ImportError messaging.
MSExperiment addon
src/pyOpenMS/addons/MSExperiment.pyx
Added get_df_columns, get_df, to_arrow, get_ion_df, get_massql_df to export peak data (long/compact/MassQL formats); includes numpy usage and column filtering.
PeptideIdentificationList addon
src/pyOpenMS/addons/PeptideIdentificationList.pyx
Added get_df, to_arrow, and update_scores_from_df; supports ontology decoding, default-missing-value handling, optional export of unidentified entries, and in-place rescoring from DataFrame.
Centralized utilities
src/pyOpenMS/pyopenms/_dataframes.py
Added wrappers peptide_identifications_to_df, update_scores_from_df, constant common_meta_value_types, helper _add_meta_values, updated __all__; wrappers now delegate to Cython get_df implementations.
Tests & API usage
src/pyOpenMS/tests/unittests/test_dataframe_columns.py, src/pyOpenMS/tests/unittests/test000.py
Extensive tests added/updated for DataFrame/Arrow exports, column selection, long_format keyword, edge cases (empty inputs, zero intensities, missing native IDs), and wrapper compatibility.
Packaging & CI
src/pyOpenMS/setup.py, .github/workflows/pyopenms-wheels.yml
Removed pandas from install_requires; CI workflow now installs pandas and pyarrow in test job to run optional-dependency tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Inspect duplicated or overlapping get_df/to_arrow implementations (notably MSSpectrum.pyx) for redefinition or inconsistent behavior.
  • Verify consistency of meta-value → numpy dtype mappings between addons and common_meta_value_types in pyopenms/_dataframes.py.
  • Check lazy-import ImportError messages and that missing-dependency code paths raise clear errors only when invoked.
  • Confirm Arrow conversions preserve column order, numeric types, and index semantics across addons.
  • Review newly added tests for coverage of reported edge cases and for any brittle assumptions about column names or index types.

Possibly related PRs

Suggested reviewers

  • poshul
  • singjc

Poem

🐰 I nibble rows and hop through fields of data,

get_df wakes pandas, arrows stack the strata,
Columns found, meta tucked neatly in line,
I hop, I stitch, I make the table fine,
A rabbit's cheer for tidy export time!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title "Implement to_df directly in Cython files" accurately reflects the main objective: moving DataFrame export logic from Python wrapper classes into Cython addon files by implementing get_df() methods directly.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 658518f and b908cf0.

📒 Files selected for processing (10)
  • src/pyOpenMS/addons/ConsensusMap.pyx (5 hunks)
  • src/pyOpenMS/addons/FeatureMap.pyx (5 hunks)
  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1 hunks)
  • src/pyOpenMS/addons/MSChromatogram.pyx (3 hunks)
  • src/pyOpenMS/addons/MSExperiment.pyx (2 hunks)
  • src/pyOpenMS/addons/MSSpectrum.pyx (3 hunks)
  • src/pyOpenMS/addons/Mobilogram.pyx (3 hunks)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (5 hunks)
  • src/pyOpenMS/pyopenms/_dataframes.py (3 hunks)
  • src/pyOpenMS/tests/unittests/test000.py (1 hunks)

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (6)
src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1)

178-184: Confusing column filtering logic - potential dead code.

The logic on lines 180-183 appears convoluted:

  1. feature_id is set as the DataFrame index (line 176), so it won't be in df.columns
  2. Line 180's condition c == 'feature_id' will always be False since feature_id isn't a column
  3. Lines 181-182 are effectively dead code

Consider simplifying:

🔎 Suggested simplification:
         # Filter columns if requested
         if columns is not None:
-            available_cols = [c for c in columns if c in df.columns or c == 'feature_id']
-            if 'feature_id' not in available_cols:
-                available_cols = [c for c in columns if c in df.columns]
-            df = df[[c for c in available_cols if c in df.columns]]
+            available_cols = [c for c in columns if c in df.columns]
+            df = df[available_cols]
 
         return df
src/pyOpenMS/addons/ConsensusMap.pyx (1)

197-208: Non-deterministic column ordering from set.

Using list(set([...])) at lines 199 and 203 produces non-deterministic ordering. While functionally correct, this could cause inconsistent column order between calls or Python versions.

🔎 Consider using a deterministic approach:
         if labelfree:
             # File-wide columns for label-free
-            files = list(set([header.filename for header in filemeta.values()]))
+            files = sorted(set(header.filename for header in filemeta.values()))
             cols.extend(files)
         else:
             # Label columns for labelled experiments
-            labels = list(set([header.label for header in filemeta.values()]))
+            labels = sorted(set(header.label for header in filemeta.values()))
             if len(labels) == 1:
                 labels[0] = "intensity"
             cols.extend(labels)
             cols.append('file')
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)

239-251: Consider using itertuples() for better performance.

df.iterrows() is known to be slow due to creating Series objects for each row. For large DataFrames, itertuples() would be significantly faster.

🔎 Optional performance improvement:
-        for index, row in df.iterrows():
-            pid_index = int(row["P_ID"])
+        p_id_col = df.columns.get_loc("P_ID")
+        score_col = df.columns.get_loc(main_score_name)
+        for row in df.itertuples(index=False):
+            pid_index = int(row[p_id_col])
             pi = _PeptideIdentification(self[pid_index])
             pi.setScoreType(main_score_name)
             hits = pi.getHits()
             if len(hits) > 0:
                 best_hit = hits[0]
-                best_hit.setScore(float(row[main_score_name]))
+                best_hit.setScore(float(row[score_col]))
                 hits[0] = best_hit
                 pi.setHits(hits)
 
             self[pid_index] = pi
src/pyOpenMS/addons/FeatureMap.pyx (1)

280-288: Column filtering logic could be simplified.

The current logic for handling feature_id as both an index and potential column is a bit convoluted. Consider simplifying:

🔎 Suggested simplification:
         # Filter columns if requested
         if columns is not None:
-            available_cols = [c for c in columns if c in df.columns or c == 'feature_id']
-            # feature_id is the index, handle it specially
-            if 'feature_id' not in available_cols:
-                available_cols = [c for c in columns if c in df.columns]
-            df = df[[c for c in available_cols if c in df.columns]]
+            # feature_id is the index, so filter only actual columns
+            cols_to_keep = [c for c in columns if c in df.columns]
+            df = df[cols_to_keep]
 
         return df
src/pyOpenMS/pyopenms/_dataframes.py (2)

15-20: Consider sorting __all__ alphabetically.

For consistency and maintainability, consider sorting the exported names alphabetically.

🔎 Apply this diff to sort the exports:
 __all__ = [
+    '_add_meta_values',
+    'common_meta_value_types',
     'peptide_identifications_to_df',
     'update_scores_from_df',
-    'common_meta_value_types',
-    '_add_meta_values',
 ]

149-150: Consider more specific exception handling.

The broad except Exception clause could mask underlying issues and make debugging difficult. Consider catching specific exceptions (e.g., ValueError, AttributeError) or at least logging the exception details.

🔎 View suggested improvement:
-        except Exception:
+        except (ValueError, AttributeError, TypeError) as e:
+            # Log or warn about the conversion failure if needed
             df[col_name] = _np.full(df.shape[0], str(dv), dtype='object')
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d731d1 and 0e0fb9f.

📒 Files selected for processing (11)
  • src/pyOpenMS/README.md (2 hunks)
  • src/pyOpenMS/addons/ConsensusMap.pyx (2 hunks)
  • src/pyOpenMS/addons/FeatureMap.pyx (2 hunks)
  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1 hunks)
  • src/pyOpenMS/addons/MSChromatogram.pyx (1 hunks)
  • src/pyOpenMS/addons/MSExperiment.pyx (2 hunks)
  • src/pyOpenMS/addons/MSSpectrum.pyx (1 hunks)
  • src/pyOpenMS/addons/Mobilogram.pyx (1 hunks)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (2 hunks)
  • src/pyOpenMS/pyopenms/_dataframes.py (3 hunks)
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/pyOpenMS/tests/**/*.py

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

Write pyOpenMS tests for new Python bindings

Files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
🧠 Learnings (4)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • src/pyOpenMS/addons/MSChromatogram.pyx
🧬 Code graph analysis (1)
src/pyOpenMS/tests/unittests/test_dataframe_columns.py (1)
src/pyOpenMS/pyopenms/_dataframes.py (2)
  • update_scores_from_df (80-92)
  • peptide_identifications_to_df (58-77)
🪛 markdownlint-cli2 (0.18.1)
src/pyOpenMS/README.md

89-89: Heading style
Expected: setext; Actual: atx

(MD003, heading-style)

🪛 Ruff (0.14.8)
src/pyOpenMS/pyopenms/_dataframes.py

15-20: __all__ is not sorted

Apply an isort-style sorting to __all__

(RUF022)


59-59: PEP 484 prohibits implicit Optional

Convert to T | None

(RUF013)

🔇 Additional comments (19)
src/pyOpenMS/addons/MSSpectrum.pyx (1)

318-364: LGTM! Clean implementation of get_df method.

The lazy import pandas as pd inside the method is a good pattern for optional dependencies, and the delegation to get_data_dict keeps the logic DRY.

src/pyOpenMS/addons/MSChromatogram.pyx (1)

208-255: LGTM! Consistent implementation pattern with MSSpectrum.

The get_df method follows the same clean pattern: lazy pandas import and delegation to get_data_dict.

src/pyOpenMS/addons/MSExperiment.pyx (3)

256-269: Hardcoded MS level 1 - is this intentional?

get_ion_df only retrieves MS level 1 spectra. Unlike other methods, there's no ms_levels parameter to customize this. If this is intentional, consider adding a brief comment explaining why, or add an ms_level parameter for consistency.


177-203: LGTM! Clean column discovery implementation.

The get_df_columns method correctly returns different column sets based on long_format.


204-254: LGTM! Good implementation of get_df with column filtering.

The method correctly handles MS level filtering and column selection. The lazy pandas import pattern is consistently applied.

src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1)

7-81: LGTM! Clean implementation of chromatogram DataFrame methods.

The get_chromatogram_df_columns and get_chromatogram_df methods follow consistent patterns with proper empty-case handling.

src/pyOpenMS/addons/ConsensusMap.pyx (2)

281-324: LGTM! Correct implementation of metadata extraction.

The get_metadata_df method correctly handles cases with and without peptide identifications, and the count parameter matches the actual number of rows yielded.


326-392: LGTM! Efficient column-based computation.

The get_df method smartly determines which sub-DataFrames to compute based on requested columns, avoiding unnecessary work.

src/pyOpenMS/README.md (1)

89-140: Documentation accurately reflects the new DataFrame export pattern.

The updated documentation clearly explains the three-method pattern (get_df_columns(), get_data_dict(), get_df()) and provides a good example. The guidance on lazy pandas imports and standalone utility functions is helpful.

src/pyOpenMS/addons/Mobilogram.pyx (1)

269-304: LGTM! Clean implementation following the established pattern.

The get_df() method correctly:

  • Imports pandas lazily to avoid requiring it at module load
  • Delegates to get_data_dict() for data extraction
  • Returns a properly constructed DataFrame

The documentation is thorough with clear examples.

src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)

78-115: Well-documented method with clear parameter descriptions.

The docstring thoroughly explains parameters, return values, and provides usage examples. The handling of Cython's bool type conflict using type(True) is a pragmatic workaround.

src/pyOpenMS/tests/unittests/test_dataframe_columns.py (3)

345-387: Good test coverage for Mobilogram DataFrame functionality.

The tests verify:

  • get_df_columns() returns expected column names
  • get_df() default behavior with correct values
  • Minimal column selection works correctly

389-533: Comprehensive test coverage for PeptideIdentificationList DataFrame methods.

Excellent coverage including:

  • Basic DataFrame structure and values
  • Empty list handling
  • Unidentified entry export toggle
  • Ontology decoding option
  • Custom missing values
  • Score update functionality

The fixtures are well-structured with realistic test data (sequences, target/decoy flags, etc.).


535-576: Backwards compatibility tests ensure wrapper functions work correctly.

These tests verify that the wrapper functions in _dataframes.py correctly delegate to the underlying get_df() and update_scores_from_df() methods, ensuring existing code continues to work.

src/pyOpenMS/addons/FeatureMap.pyx (2)

88-124: Well-structured column discovery method.

The get_df_columns() method properly:

  • Returns core columns by default
  • Conditionally includes peptide ID columns based on parameter
  • Supports 'all' mode to discover meta values dynamically

290-320: Clean implementation of peptide identification extraction.

The method properly:

  • Creates a new PeptideIdentificationList result container
  • Annotates each hit with feature_id, ID_filename, and ID_native_id meta values
  • Handles missing spectrum_native_id gracefully with 'unknown' fallback
src/pyOpenMS/pyopenms/_dataframes.py (3)

31-55: LGTM!

The type mapping dictionary is well-documented and the structure is appropriate for numpy dtype conversion.


80-92: LGTM!

The wrapper function correctly delegates to the underlying implementation and maintains backwards compatibility.


27-28: Pandas dependency is properly declared and enforced.

The module's direct pandas import at lines 27-28 is safe. The build system enforces this dependency through multiple mechanisms: pandas is listed in install_requires in setup.py (ensuring availability for end users), included in requirements_bld.txt (build-time validation), and checked by CMakeLists.txt during the build process.

Comment thread src/pyOpenMS/addons/ConsensusMap.pyx Resolved
Comment thread src/pyOpenMS/addons/FeatureMap.pyx Resolved
Comment thread src/pyOpenMS/addons/MSExperiment.pyx Resolved
Comment thread src/pyOpenMS/pyopenms/_dataframes.py Resolved
Comment thread src/pyOpenMS/pyopenms/_dataframes.py Resolved
Add to_arrow() methods to pyOpenMS classes following the Polars naming convention:
- MSSpectrum.to_arrow() - reuses get_data_dict() for efficient numpy-to-Arrow conversion
- MSChromatogram.to_arrow() - reuses get_data_dict()
- Mobilogram.to_arrow() - reuses get_data_dict()
- MSExperiment.to_arrow() - supports long_format parameter like get_df()
- ConsensusMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- FeatureMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- MRMTransitionGroupCP.chromatograms_to_arrow(), features_to_arrow()
- PeptideIdentificationList.to_arrow()

All methods use lazy imports for pyarrow to keep it as an optional dependency.

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (5)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)

78-209: Potential UnboundLocalError if meta value doesn't exist on any hit.

In the extract function (lines 195-206), if besthit.metaValueExists(k) is False for a particular key, the code falls through to line 206 which references val. However, val is only assigned when metaValueExists returns True. This will cause an UnboundLocalError when accessing default_missing_values[type(val)].

🔎 Apply this diff to fix the issue:
             for k in metavals:
                 if besthit.metaValueExists(k):
                     val = besthit.getMetaValue(k)
                     if k == b"target_decoy":
                         if val[0] == 't':
                             ret.append(True)
                         else:
                             ret.append(False)
                     else:
                         ret.append(val)
                 else:
-                    ret.append(default_missing_values[type(val)])
+                    # Use the pre-computed default for this meta value
+                    idx = metavals.index(k)
+                    ret.append(dmv[idx])
             return tuple(ret)
src/pyOpenMS/addons/MSExperiment.pyx (2)

424-443: Potential division by zero when spectrum has zero intensities.

If a spectrum has all zero intensities (or is empty), the calculations inty/np.amax(inty, initial=0) and inty/np.sum(inty) will result in inf or nan values. While this may not crash, it could produce unexpected results in the DataFrame.

🔎 Apply this diff to fix:
                     mz, inty = spec.get_peaks()
+                    max_inty = np.amax(inty, initial=1)  # Use 1 to avoid div by zero
+                    sum_inty = np.sum(inty) if np.sum(inty) > 0 else 1
                     # data for both DataFrames: i, i_norm, i_tic_norm, mz, scan, rt, polarity
-                    data = (inty, inty/np.amax(inty, initial=0), inty/np.sum(inty), mz, scan_num + 1, spec.getRT()/60, _get_polarity(spec))
+                    data = (inty, inty/max_inty, inty/sum_inty, mz, scan_num + 1, spec.getRT()/60, _get_polarity(spec))

459-482: Same division by zero issue exists here.

The _get_ion_spec_arrays function at line 467 has the same potential division by zero problem as _get_spec_arrays.

🔎 Apply this diff to fix:
                     mz, inty = spec.get_peaks()
                     ion_array_idx, ion_unit = spec.getIMData()
                     ion_data_arr = spec.getFloatDataArrays()[ion_array_idx]
                     ion_data = ion_data_arr.get_data()
 
+                    max_inty = np.amax(inty, initial=1)
+                    sum_inty = np.sum(inty) if np.sum(inty) > 0 else 1
                     # data for both DataFrames: i, i_norm, i_tic_norm, mz, scan, rt, polarity
-                    data = (inty, inty/np.amax(inty, initial=0), inty/np.sum(inty), mz, scan_num + 1, spec.getRT()/60, _get_polarity(spec), ion_data)
+                    data = (inty, inty/max_inty, inty/sum_inty, mz, scan_num + 1, spec.getRT()/60, _get_polarity(spec), ion_data)
src/pyOpenMS/addons/ConsensusMap.pyx (1)

236-261: Bug: Incorrect count parameter in np.fromiter for labelled experiments.

For labelled experiments with multiple files, extract_rows_channel_wide_file_long yields one row per file per feature. However, count=self.size() at line 259 assumes one row per feature, causing np.fromiter to stop early and truncate data when features span multiple files.

🔎 Apply this fix:
-            intyarr = np.fromiter(iter=gen(self, extract_rows_channel_wide_file_long), dtype=dtypes, count=self.size())
+            # Use -1 to let fromiter determine count dynamically
+            intyarr = np.fromiter(iter=gen(self, extract_rows_channel_wide_file_long), dtype=dtypes, count=-1)
src/pyOpenMS/addons/FeatureMap.pyx (1)

246-256: Missing check for spectrum_native_id meta value existence.

Lines 252 and 254 call f.getMetaValue('spectrum_native_id') without first checking if the meta value exists using f.metaValueExists(). This is inconsistent with the pattern used in get_assigned_peptide_identifications() (lines 345-348) and may return unexpected values or cause errors if the meta value is absent.

🔎 Apply this fix for consistency:
             if need_pep_ids:
                 if pep.size() > 0:
                     ID_filename = self._get_prot_id_filename_from_pep_id(pep[0])
                     hits = pep[0].getHits()
+                    native_id = f.getMetaValue('spectrum_native_id') if f.metaValueExists('spectrum_native_id') else None
                     if len(hits) > 0:
                         besthit = hits[0]
-                        pep_values = (besthit.getSequence().toString(), besthit.getScore(), ID_filename, f.getMetaValue('spectrum_native_id'))
+                        pep_values = (besthit.getSequence().toString(), besthit.getScore(), ID_filename, native_id)
                     else:
-                        pep_values = (None, None, ID_filename, f.getMetaValue('spectrum_native_id'))
+                        pep_values = (None, None, ID_filename, native_id)
                 else:
                     pep_values = (None, None, None, None)
🧹 Nitpick comments (2)
src/pyOpenMS/addons/MSExperiment.pyx (1)

341-354: Consider documenting the hardcoded MS level.

The method hardcodes ms_level=1 in the call to get2DPeakDataIMLong(). This is likely intentional since ion mobility data is typically associated with MS1 spectra, but it would be helpful to document this behavior or make it configurable.

🔎 Suggested documentation improvement:
     def get_ion_df(self):
         """
         get_ion_df(self: MSExperiment) -> pd.DataFrame
 
-        Generates a pandas DataFrame with all peaks and the ion mobility in the MSExperiment
+        Generates a pandas DataFrame with all MS1 peaks and their ion mobility values.
+
+        Note: Only MS1 spectra are included as ion mobility data is typically
+        associated with MS1 acquisitions.
 
         Returns:
         pd.DataFrame: feature information stored in a DataFrame
         """
src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1)

83-185: LGTM: Feature DataFrame construction with meta value support.

The method correctly builds a structured array from features and handles meta value type mapping. The count=len(features) parameter is appropriate since each feature yields exactly one row.

Optional: Simplify redundant dict lookup at line 168

Line 168 uses .get(meta_value, 'U50') but the default is never reached since line 167 already checks membership:

             # Add meta_values to mddtypes
             for meta_value in meta_values_list:
                 if meta_value in common_meta_value_types:
-                    mddtypes.append((meta_value.decode() if isinstance(meta_value, bytes) else meta_value, common_meta_value_types.get(meta_value, 'U50')))
+                    mddtypes.append((meta_value.decode() if isinstance(meta_value, bytes) else meta_value, common_meta_value_types[meta_value]))
                 else:
                     mddtypes.append((meta_value.decode() if isinstance(meta_value, bytes) else meta_value, 'U50'))
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0fb9f and 5cf0b4b.

📒 Files selected for processing (8)
  • src/pyOpenMS/addons/ConsensusMap.pyx (2 hunks)
  • src/pyOpenMS/addons/FeatureMap.pyx (2 hunks)
  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1 hunks)
  • src/pyOpenMS/addons/MSChromatogram.pyx (1 hunks)
  • src/pyOpenMS/addons/MSExperiment.pyx (2 hunks)
  • src/pyOpenMS/addons/MSSpectrum.pyx (1 hunks)
  • src/pyOpenMS/addons/Mobilogram.pyx (1 hunks)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)

Applied to files:

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

Applied to files:

  • src/pyOpenMS/addons/ConsensusMap.pyx
  • src/pyOpenMS/addons/MSChromatogram.pyx
  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx
  • src/pyOpenMS/addons/MSSpectrum.pyx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
🔇 Additional comments (30)
src/pyOpenMS/addons/MSSpectrum.pyx (2)

318-364: LGTM! Clean implementation of get_df().

The method correctly delegates to get_data_dict() and uses a lazy import for pandas, which is good practice for optional dependencies. Documentation is comprehensive with clear examples.


366-401: LGTM! Consistent implementation of to_arrow().

The method follows the same pattern as get_df() with lazy pyarrow import and proper delegation to get_data_dict(). The docstring correctly highlights zero-copy conversion benefits with pandas 2.0+.

src/pyOpenMS/addons/Mobilogram.pyx (2)

269-304: LGTM! Appropriately simplified API for Mobilogram.

The method correctly omits the export_meta_values parameter since Mobilogram doesn't support MetaInfoInterface. The docstring clearly documents this limitation.


306-337: LGTM!

Consistent implementation of to_arrow() following the same pattern.

src/pyOpenMS/addons/MSChromatogram.pyx (2)

208-254: LGTM!

The get_df() implementation is consistent with the pattern established in MSSpectrum.pyx. Good documentation of default vs non-default columns.


256-287: LGTM!

Consistent to_arrow() implementation.

src/pyOpenMS/addons/PeptideIdentificationList.pyx (3)

1-2: LGTM!

Numpy imports added to support array operations in the new methods.


211-240: LGTM! Appropriate use of from_pandas for complex dtypes.

Using pa.Table.from_pandas(df) instead of from_pydict is the right choice here since get_df() returns a DataFrame with structured numpy dtypes that are better preserved through pandas conversion.


242-283: LGTM! Clean rescoring update implementation.

The method modifies in place and returns self for method chaining. The implementation correctly retrieves the PeptideIdentification by index, updates the score type and hit score, then reassigns it back.

src/pyOpenMS/addons/MSExperiment.pyx (5)

1-2: LGTM!

Numpy imports added to support array operations.


177-203: LGTM!

Clear documentation of available columns for both long and compact formats.


204-254: LGTM! Well-structured DataFrame export with format flexibility.

The implementation correctly handles both long and compact formats. The column filtering at the end (lines 250-252) appropriately handles cases where requested columns may not exist.


256-339: LGTM! Native Arrow construction avoids pandas overhead.

Good choice to build the Arrow table directly from numpy arrays in to_arrow() instead of going through pandas, which provides better performance for large datasets.


484-503: LGTM!

The MassQL DataFrame creation logic correctly handles the case when there are no spectra of a given MS level by returning an empty DataFrame with the correct schema.

src/pyOpenMS/addons/ConsensusMap.pyx (5)

2-4: LGTM: Imports are appropriate.

The numpy and collections imports are necessary for the structured array construction and file-row aggregation logic below.


172-209: LGTM: Column discovery logic is correct.

The method correctly derives column names based on experiment type and handles the single-label case appropriately.


281-324: LGTM: Metadata extraction logic is correct.

The method correctly extracts one row per consensus feature, and the count=cnt parameter is appropriate since each feature yields exactly one row.


326-392: LGTM: DataFrame composition with smart column selection.

The method efficiently determines which sub-DataFrames to compute based on requested columns. However, correctness depends on the get_intensity_df() fix mentioned above.


394-421: LGTM: Arrow export wrapper is straightforward.

The method appropriately delegates to get_df() and uses lazy pyarrow import.

src/pyOpenMS/addons/FeatureMap.pyx (5)

2-3: LGTM: Standard numpy imports.

Necessary for structured array construction in the DataFrame export methods.


88-124: LGTM: Column discovery with meta value support.

The method correctly handles optional peptide identification columns and dynamic meta value discovery. The bytes-to-string decoding for meta value keys is appropriate.


126-144: LGTM: Defensive filename lookup.

The method appropriately validates the filename list before accessing elements and returns a sensible default.


290-320: LGTM: Arrow export wrapper delegates correctly.

The method appropriately passes all parameters to get_df() and uses lazy pyarrow import.


322-352: LGTM: Correct meta value existence checking.

The method properly checks f.metaValueExists('spectrum_native_id') before calling getMetaValue() (lines 345-348), demonstrating the pattern that should be used throughout.

src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (6)

1-2: LGTM: Standard numpy imports.

Necessary for structured array construction in DataFrame export methods.


7-24: LGTM: Delegates to chromatogram for column names.

The method appropriately uses the first chromatogram to determine columns, with a sensible fallback when no chromatograms exist.


26-49: LGTM: Column discovery with meta value support.

The method correctly handles dynamic meta value discovery with proper bytes-to-string decoding.


51-81: LGTM: DataFrame aggregation from chromatograms.

The method appropriately concatenates individual chromatogram DataFrames and handles the empty case.


187-207: LGTM: Arrow export wrapper for chromatograms.

The method appropriately delegates to get_chromatogram_df() and uses lazy pyarrow import.


209-229: LGTM: Arrow export wrapper for features.

The method appropriately delegates to get_feature_df() and uses lazy pyarrow import.

When a PeptideHit doesn't have a particular metavalue, the code would
reference an undefined 'val' variable. Fix by using the precomputed
dmv[idx] array which already contains the correct default missing value
for each metavalue's type.

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (2)

137-137: Use more idiomatic empty check.

The expression if not len(hits) == 0 can be simplified to if len(hits) > 0 or if hits for better readability.

🔎 Apply this diff for more Pythonic code:
             hits = pep.getHits()
-            if not len(hits) == 0:
+            if hits:
                 mvs = []

And similarly at lines 151-152:

                 hits = p.getHits()
-                if not len(hits) == 0:
+                if hits:
                     if hits[0].metaValueExists(k):

Also applies to: 151-152


270-281: Consider itertuples() for better performance.

iterrows() is significantly slower than itertuples() for large DataFrames because it creates a Series object for each row. For rescoring workflows with many peptides, switching to itertuples() could provide substantial performance gains.

🔎 Apply this diff to improve iteration performance:
-        for index, row in df.iterrows():
-            pid_index = int(row["P_ID"])
+        for row in df.itertuples():
+            pid_index = int(row.P_ID)
             pi = _PeptideIdentification(self[pid_index])
             pi.setScoreType(main_score_name)
             hits = pi.getHits()
             if len(hits) > 0:
                 best_hit = hits[0]
-                best_hit.setScore(float(row[main_score_name]))
+                best_hit.setScore(float(getattr(row, main_score_name)))
                 hits[0] = best_hit
                 pi.setHits(hits)
 
             self[pid_index] = pi
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cf0b4b and 5954b09.

📒 Files selected for processing (1)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/addons/PeptideIdentificationList.pyx
🔇 Additional comments (1)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)

211-240: LGTM!

Clean delegation to get_df() with lazy pyarrow import. The implementation correctly passes through all parameters and provides good documentation with usage examples.

Bug fixes:
- ConsensusMap.get_intensity_df(): Fix np.fromiter count truncation
  by computing actual row count (one row per file per feature)
- MSExperiment.get_massql_df(): Fix division by zero in intensity
  normalization for empty spectra or all-zero intensities
- _dataframes.py: Fix 'any' to 'Any' type hint import

Tests added:
- TestToArrowMethods: 7 tests for to_arrow() across all classes
- TestBugFixes: 3 tests for the bug fixes above

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
src/pyOpenMS/addons/MSExperiment.pyx (1)

231-235: Consider simplifying the ms_levels default handling.

The current pattern checks if ms_levels is None then separately checks if not ms_levels. This is safe but can be simplified.

🔎 Simplified version:
-        if ms_levels is None:
-            ms_levels = []
         self.updateRanges()
-        if not ms_levels:
+        if ms_levels is None or not ms_levels:
             ms_levels = self.getMSLevels()

Note: The same pattern appears in to_arrow() at lines 285-289.

src/pyOpenMS/tests/unittests/test_dataframe_columns.py (1)

807-833: Prefix unused ms2_df variables with underscore.

The static analysis correctly identifies that ms2_df is unpacked but never used in these tests. Prefix with underscore to indicate intentional non-use.

🔎 Apply this diff:
-        ms1_df, ms2_df = exp.get_massql_df()
+        ms1_df, _ms2_df = exp.get_massql_df()

And at line 828:

-        ms1_df, ms2_df = exp.get_massql_df()
+        ms1_df, _ms2_df = exp.get_massql_df()
src/pyOpenMS/pyopenms/_dataframes.py (3)

15-20: Consider removing underscore-prefixed _add_meta_values from __all__.

The underscore prefix conventionally indicates a private/internal function, but exporting it in __all__ makes it part of the public API. Either remove the underscore or don't export it.

🔎 Option 1 - Remove from __all__ (keep as internal):
 __all__ = [
     'peptide_identifications_to_df',
     'update_scores_from_df',
     'common_meta_value_types',
-    '_add_meta_values',
 ]
🔎 Option 2 - Rename to public (if needed externally):
 __all__ = [
     'peptide_identifications_to_df',
     'update_scores_from_df',
     'common_meta_value_types',
-    '_add_meta_values',
+    'add_meta_values',
 ]

And rename the function accordingly.


58-60: Fix implicit Optional type hint.

The default_missing_values parameter uses dict = None which implicitly allows None. Per PEP 484, this should be explicitly typed as dict | None or Optional[dict].

🔎 Apply this diff:
-def peptide_identifications_to_df(peps: _PeptideIdentificationList, decode_ontology: bool = True,
-                                  default_missing_values: dict = None,
+def peptide_identifications_to_df(peps: _PeptideIdentificationList, decode_ontology: bool = True,
+                                  default_missing_values: dict | None = None,
                                   export_unidentified: bool = True):

22-28: Unused imports: List and Union are imported but not used.

Only Any is used from the typing module.

🔎 Apply this diff:
-from typing import Any, List, Union
+from typing import Any
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5954b09 and bd6bcc3.

📒 Files selected for processing (4)
  • src/pyOpenMS/addons/ConsensusMap.pyx (2 hunks)
  • src/pyOpenMS/addons/MSExperiment.pyx (2 hunks)
  • src/pyOpenMS/pyopenms/_dataframes.py (3 hunks)
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/pyOpenMS/tests/**/*.py

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

Write pyOpenMS tests for new Python bindings

Files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
🧠 Learnings (2)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

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

Applied to files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
🪛 Ruff (0.14.8)
src/pyOpenMS/pyopenms/_dataframes.py

15-20: __all__ is not sorted

Apply an isort-style sorting to __all__

(RUF022)


59-59: PEP 484 prohibits implicit Optional

Convert to T | None

(RUF013)

src/pyOpenMS/tests/unittests/test_dataframe_columns.py

809-809: Unpacked variable ms2_df is never used

Prefix it with an underscore or any other dummy variable pattern

(RUF059)


828-828: Unpacked variable ms2_df is never used

Prefix it with an underscore or any other dummy variable pattern

(RUF059)

🔇 Additional comments (17)
src/pyOpenMS/addons/MSExperiment.pyx (3)

177-202: LGTM! Clean and well-documented column discovery API.

The method provides a clear interface for discovering available columns before export.


256-339: LGTM! Arrow export with proper empty-data handling.

The method correctly handles both long and compact formats with appropriate fallbacks for empty data.


356-513: LGTM! Division-by-zero guards properly implemented.

The past review concern about division by zero has been addressed with proper guards at lines 428-431 and 472-475. The method now safely handles spectra with zero or all-zero intensities by checking before division and using np.zeros_like() as a fallback.

The logic for handling missing precursors (lines 439-442, 483-486) is also correct.

src/pyOpenMS/tests/unittests/test_dataframe_columns.py (4)

345-387: LGTM! Good test coverage for Mobilogram column selection.

The tests cover the essential cases: column discovery, default behavior, and minimal column selection. This aligns well with the pattern established for MSSpectrum and MSChromatogram.


389-533: LGTM! Comprehensive tests for PeptideIdentificationList.get_df().

The tests cover key scenarios including:

  • Basic DataFrame structure and values
  • Empty list handling
  • Unidentified entries export control
  • Ontology decoding options
  • Custom missing values
  • Score update functionality

535-576: LGTM! Good coverage for backwards-compatible wrapper functions.

The tests verify that the wrapper functions in _dataframes.py correctly delegate to the underlying get_df() and update_scores_from_df() methods.


622-746: LGTM! Comprehensive Arrow export tests.

Good use of pytest.importorskip('pyarrow') to handle optional dependency gracefully. The roundtrip test at lines 732-746 is particularly valuable for ensuring data integrity between pandas and Arrow representations.

src/pyOpenMS/addons/ConsensusMap.pyx (7)

1-6: LGTM! Clean import structure.

The new imports are appropriately placed and the underscore-prefixed _defaultdict alias follows Python convention for internal use.


172-209: LGTM! Well-documented column discovery method.

The get_df_columns() method correctly handles both label-free and labelled experiment types, with appropriate column naming conventions.


265-281: LGTM! Label-free intensity extraction is correct.

For label-free experiments, each feature yields exactly one row (file-wide format), so count=self.size() is appropriate here.


283-326: LGTM! Clean metadata extraction.

The get_metadata_df() method correctly handles the case where peptide identifications or hits may be missing, yielding None for the sequence in those cases.


328-394: LGTM! Efficient column-based DataFrame construction.

The implementation smartly avoids computing unnecessary DataFrames by checking which columns are requested before calling get_metadata_df() or get_intensity_df().


396-422: LGTM! Clean Arrow export implementation.

The to_arrow() method properly delegates to get_df() and includes helpful docstring examples for both pandas and polars conversion.


236-263: Row count calculation is correct.

The pre-computation of total_rows by summing the length of filerows dictionaries (unique filenames per feature) correctly matches the number of tuples yielded by extract_rows_channel_wide_file_long, which produces one row per file per feature. The count parameter now aligns with the actual generator output.

src/pyOpenMS/pyopenms/_dataframes.py (3)

31-55: LGTM! Well-documented type mapping dictionary.

The common_meta_value_types dictionary provides clear documentation for its purpose and usage.


80-92: LGTM! Clean backwards-compatible wrapper.

The wrapper correctly delegates to the new method while preserving the original function signature for backwards compatibility.


95-151: LGTM! Robust meta value handling.

The _add_meta_values function handles multiple value types gracefully with appropriate fallbacks and exception handling.

Comment thread src/pyOpenMS/addons/MSExperiment.pyx Resolved
@jpfeuffer

Copy link
Copy Markdown
Contributor

I meant exposing it in arrow Format from c++ for zero copy.
Let's just remove it again. AI is too dumb for this.

Also the interface/parameter names were changed. The tests need to be adapted accordingly.

Add existence check for 'spectrum_native_id' meta value before calling
getMetaValue() in extract_meta_data(). This follows the same pattern
used in get_assigned_peptide_identifications().

Without this check, calling get_df() on a FeatureMap where some features
lack the 'spectrum_native_id' meta value could fail unexpectedly.

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/pyOpenMS/tests/unittests/test_dataframe_columns.py (1)

809-809: Prefix unused variable with underscore.

The ms2_df variable is unpacked but never used in these tests. Following Python conventions and the static analysis hint, prefix it with an underscore to indicate it's intentionally unused.

🔎 Apply this diff:
 # Line 809
-        ms1_df, ms2_df = exp.get_massql_df()
+        ms1_df, _ms2_df = exp.get_massql_df()

 # Line 828
-        ms1_df, ms2_df = exp.get_massql_df()
+        ms1_df, _ms2_df = exp.get_massql_df()

Also applies to: 828-828

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd6bcc3 and 9a73915.

📒 Files selected for processing (2)
  • src/pyOpenMS/addons/FeatureMap.pyx (2 hunks)
  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/pyOpenMS/tests/**/*.py

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

Write pyOpenMS tests for new Python bindings

Files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
🧠 Learnings (1)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings

Applied to files:

  • src/pyOpenMS/tests/unittests/test_dataframe_columns.py
🪛 Ruff (0.14.8)
src/pyOpenMS/tests/unittests/test_dataframe_columns.py

809-809: Unpacked variable ms2_df is never used

Prefix it with an underscore or any other dummy variable pattern

(RUF059)


828-828: Unpacked variable ms2_df is never used

Prefix it with an underscore or any other dummy variable pattern

(RUF059)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
🔇 Additional comments (12)
src/pyOpenMS/addons/FeatureMap.pyx (6)

2-3: LGTM!

The dual numpy imports (cimport and import) are the standard pattern for Cython files that need both compile-time and runtime numpy functionality.


88-124: LGTM!

The get_df_columns() method correctly discovers available columns based on the requested mode ('default' vs 'all') and properly collects meta values from all features when needed.


126-144: LGTM!

The helper method correctly looks up the primary MS run path from protein identifications and provides a sensible fallback ('unknown') when no match is found.


146-292: LGTM!

The get_df() implementation is robust and handles several important edge cases correctly:

  • Lines 249-252 properly check for spectrum_native_id existence before accessing (addresses past review feedback)
  • Line 244 guards all meta value accesses with existence checks
  • Lazy pandas import reduces dependencies
  • The selective column export logic (lines 202-210, 284-290) efficiently avoids unnecessary computation

294-324: LGTM!

The to_arrow() method cleanly wraps get_df() and provides a simple interface for Arrow export. The lazy pyarrow import is appropriate.


326-356: LGTM!

The get_assigned_peptide_identifications() method correctly annotates hits with metadata and properly checks for spectrum_native_id existence (lines 349-352) before accessing it, consistent with the pattern used in get_df().

src/pyOpenMS/tests/unittests/test_dataframe_columns.py (6)

345-387: LGTM!

The Mobilogram column selection tests provide good coverage of the basic get_df() functionality, including column discovery and minimal column selection.


389-533: LGTM!

Comprehensive test coverage for PeptideIdentificationList.get_df(), including edge cases like empty lists, unidentified entries, and custom missing values. The update_scores_from_df() test validates the round-trip functionality.


535-576: LGTM!

The backwards compatibility tests ensure that the wrapper functions in _dataframes module correctly delegate to the new get_df() and update_scores_from_df() methods, maintaining API compatibility.


622-747: LGTM!

Excellent coverage of the to_arrow() methods across multiple classes. The round-trip test (lines 732-746) is particularly valuable for ensuring consistency between get_df() and to_arrow().to_pandas().


752-833: LGTM!

The bug fix tests are excellent regression tests with clear documentation of what issues they're preventing. They target specific edge cases:

  • Missing metavalues that could cause UnboundLocalError
  • Division by zero with empty/zero-intensity spectra
  • Proper handling of missing spectrum_native_id

835-885: LGTM!

This regression test directly validates the fix applied in FeatureMap.pyx (lines 249-252) for handling missing spectrum_native_id meta values. The comment at line 885 helpfully explains the numpy string dtype behavior.

@timosachsenberg

This comment was marked as outdated.

Copilot AI commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

@timosachsenberg I've opened a new pull request, #8523, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits December 19, 2025 07:10
* Initial plan

* Fix test parameter name: change long= to long_format= in MSExperiment test

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/pyOpenMS/pyopenms/_dataframes.py (1)

58-77: Fix implicit Optional type hint.

The default_missing_values parameter uses dict = None which implicitly allows None. Per PEP 484, this should be explicitly typed as dict | None.

🔎 Apply this diff to fix the type hint:
 def peptide_identifications_to_df(peps: _PeptideIdentificationList, decode_ontology: bool = True,
-                                  default_missing_values: dict = None,
+                                  default_missing_values: dict | None = None,
                                   export_unidentified: bool = True):
🧹 Nitpick comments (1)
src/pyOpenMS/pyopenms/_dataframes.py (1)

15-20: Consider sorting __all__ alphabetically.

Static analysis suggests alphabetical ordering for __all__ to improve consistency and maintainability.

🔎 Proposed fix
 __all__ = [
+    '_add_meta_values',
+    'common_meta_value_types',
     'peptide_identifications_to_df',
     'update_scores_from_df',
-    'common_meta_value_types',
-    '_add_meta_values',
 ]
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19bf5f7 and 4f22e65.

📒 Files selected for processing (1)
  • src/pyOpenMS/pyopenms/_dataframes.py (3 hunks)
🧰 Additional context used
🪛 Ruff (0.14.8)
src/pyOpenMS/pyopenms/_dataframes.py

15-20: __all__ is not sorted

Apply an isort-style sorting to __all__

(RUF022)


59-59: PEP 484 prohibits implicit Optional

Convert to T | None

(RUF013)

🔇 Additional comments (4)
src/pyOpenMS/pyopenms/_dataframes.py (4)

22-28: LGTM!

The imports are clean and all necessary. The previously flagged unused imports (List, Union) have been correctly removed.


32-55: LGTM!

The common_meta_value_types dictionary is well-structured with clear documentation. The dtype mappings are appropriate for the meta value types.


80-92: LGTM!

The wrapper function correctly delegates to the underlying Cython implementation with proper parameter passing and clear documentation.


95-152: LGTM!

The function demonstrates robust type handling with appropriate fallbacks. The broad exception handler at line 149 is intentional defensive programming that ensures meta values are always exported (as strings if necessary), preventing export failures due to unexpected types.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

I would say: let's get this merged, as it removes a class of bugs around the duck typing. We can improve / optimize in another PR

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

Awesome! I like this separation, makes it easier to reference the specific structures dataframe methods.

Comment thread src/pyOpenMS/addons/ConsensusMap.pyx Resolved
Comment thread src/pyOpenMS/addons/ConsensusMap.pyx Outdated
Returns:
pd.DataFrame: intensity DataFrame
"""
import pandas as pd

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.

Can we move the pandas import to the top with numpy? Or is it per defined per function to gate issues with pandas not being installed?

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.

yes that was the idea. I am not sure if this is the best way to do it but I think I saw other libraries do it this way. You basically get an import error if it is not installed

Comment thread src/pyOpenMS/addons/FeatureMap.pyx Resolved
Comment thread src/pyOpenMS/addons/FeatureMap.pyx Resolved
Comment thread src/pyOpenMS/addons/FeatureMap.pyx Resolved

According to massql positive polarity is represented by 1 and negative by 2.

Parameters:

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.

Suggested change
Parameters:
Args:

'i_tic_norm' the intensity values are divided by the maximum intensity value in the spectrum and
the sum of intensity values, respectively.

Parameters:

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.

Suggested change
Parameters:
Args:

'i_tic_norm' the intensity values are divided by the maximum intensity value in the spectrum and
the sum of intensity values, respectively.

Parameters:

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.

Suggested change
Parameters:
Args:

Comment thread src/pyOpenMS/addons/ConsensusMap.pyx Resolved
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (2)

212-241: Inconsistent docstring style.

This method uses "Parameters:" (line 218) while get_df() uses "Args:" (line 84). Maintain consistent docstring formatting across the class.

🔎 Suggested change
-        Parameters:
+        Args:
             decode_ontology (bool): Decode meta value names using the PSI-MS ontology.

271-282: Consider using itertuples() for better performance.

df.iterrows() is significantly slower than itertuples() for large DataFrames. For peptide rescoring workflows with many identifications, this could noticeably impact performance.

🔎 Proposed optimization
-        for index, row in df.iterrows():
-            pid_index = int(row["P_ID"])
+        for row in df.itertuples():
+            pid_index = int(row.P_ID)
             pi = _PeptideIdentification(self[pid_index])
             pi.setScoreType(main_score_name)
             hits = pi.getHits()
             if len(hits) > 0:
                 best_hit = hits[0]
-                best_hit.setScore(float(row[main_score_name]))
+                best_hit.setScore(float(getattr(row, main_score_name)))
                 hits[0] = best_hit
                 pi.setHits(hits)
 
             self[pid_index] = pi
src/pyOpenMS/addons/FeatureMap.pyx (3)

126-144: Inconsistent docstring formatting.

The "Args:" section (line 132) lacks proper indentation compared to other methods in this file. Maintain consistent formatting for better readability.

🔎 Suggested formatting
         Gets the primary MS run path of the ProteinIdentification linked with the given PeptideIdentification.
 
         Args:
-        pep_id: PeptideIdentification
+            pep_id (PeptideIdentification): PeptideIdentification to look up.
 
         Returns:
-        str: primary MS run path (filename) of the ProteinIdentification with the same identifier as the given PeptideIdentification
+            str: Primary MS run path (filename) of the ProteinIdentification.

274-278: Weak type inference for uncommon meta values.

Lines 274-278 default unknown meta values to 'U50' (string type). If a numeric meta value is not in common_meta_value_types, it would be incorrectly typed as a string, potentially losing precision or causing downstream type errors.

Consider dynamically inferring the type by sampling the first non-null occurrence, similar to the pattern used in PeptideIdentificationList.get_df() (lines 145-156).


285-291: Simplify column filtering logic for clarity.

The column filtering logic checks for 'feature_id' multiple times and could be more straightforward. Since feature_id is the DataFrame index, the current approach is correct but harder to follow.

🔎 Proposed simplification
         # Filter columns if requested
         if columns is not None:
-            available_cols = [c for c in columns if c in df.columns or c == 'feature_id']
-            # feature_id is the index, handle it specially
-            if 'feature_id' not in available_cols:
-                available_cols = [c for c in columns if c in df.columns]
-            df = df[[c for c in available_cols if c in df.columns]]
+            # feature_id is the index, filter only column names (not index)
+            available_cols = [c for c in columns if c in df.columns]
+            if available_cols:
+                df = df[available_cols]
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f22e65 and 69bc45b.

📒 Files selected for processing (2)
  • src/pyOpenMS/addons/FeatureMap.pyx (2 hunks)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

  • src/pyOpenMS/addons/PeptideIdentificationList.pyx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-lnx-arm

Comment on lines +159 to +163
def get_key(val):
for key, value in switchDict.items():
if val == value:
return key
dmv = [default_missing_values[get_key(t)] for t in types]

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 | 🟠 Major

Add safety check for unknown types in get_key.

The get_key function can return None if the type is not found in switchDict. Line 163 would then raise a KeyError when trying to access default_missing_values[None].

While this is unlikely with the current type inference logic, it could occur if the type inference produces an unexpected type that's not in switchDict. Consider adding validation or a default case.

🔎 Proposed fix
 def get_key(val):
     for key, value in switchDict.items():
         if val == value:
             return key
+    return type('')  # Default to string type if not found
 dmv = [default_missing_values[get_key(t)] for t in types]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_key(val):
for key, value in switchDict.items():
if val == value:
return key
dmv = [default_missing_values[get_key(t)] for t in types]
def get_key(val):
for key, value in switchDict.items():
if val == value:
return key
return type('') # Default to string type if not found
dmv = [default_missing_values[get_key(t)] for t in types]
🤖 Prompt for AI Agents
In src/pyOpenMS/addons/PeptideIdentificationList.pyx around lines 159-163, the
helper get_key can return None for unknown types which leads to a KeyError on
line 163; update get_key to explicitly handle missing matches (either raise a
descriptive KeyError/ValueError including the unknown val, or return a known
fallback key), and before constructing dmv validate the returned key(s) so you
never index default_missing_values with None — if a fallback is used, ensure
that default_missing_values contains that fallback entry or map unknown types to
a sensible default and log/raise a clear error otherwise.

@jpfeuffer

jpfeuffer commented Dec 19, 2025 •

Copy link
Copy Markdown
Contributor
  • if you want to fail at runtime because pandas is optional, you should remove it from the requirements in setup.py/project.toml etc (one could also think about a "nicer" error)
  • the docstrings are all in the wrong format I think. Should be sphinx restructured text. But the first line with the type signature needs to stay (it is used by autodoc)

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot to fail at runtime because pandas is optional, you should remove it from the requirements in setup.py/project.toml etc and print a "nicer" error. Also the docstrings
the docstrings are all in the wrong format. Should be sphinx restructured text. Important: the first line with the type signature needs to stay (it is used by autodoc).

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

@timosachsenberg I've opened a new pull request, #8535, to work on those changes. Once the pull request is ready, I'll request review from you.

…8535)

* Initial plan

* Remove pandas from required dependencies and fix docstrings

- Removed pandas from install_requires in setup.py (now optional)
- Added ImportError with helpful message when pandas is not installed
- Fixed all docstrings to use Sphinx reStructuredText format (:param, :type, :return, :rtype, :raises)
- Updated docstrings in 8 addon files (ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList)
- Also added ImportError handling for pyarrow imports (optional dependency)

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

* Fix remaining to_arrow() docstrings to use Sphinx format

- Updated all to_arrow() method docstrings to use Sphinx reStructuredText format
- Fixed docstrings in ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList
- All DataFrame and Arrow export methods now have consistent Sphinx-style documentation

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/pyOpenMS/addons/PeptideIdentificationList.pyx (1)

166-170: Verify get_key() robustness against unknown types.

The get_key() helper at line 166 returns None if the type value isn't found in switchDict. While the type inference loop (lines 153-163) should only populate types with values from switchDict, there's no explicit handling for the case where get_key() returns None, which would cause a KeyError at line 170.

Consider adding defensive error handling or an assertion to make the code more robust:

🔎 Proposed safety improvement
 def get_key(val):
     for key, value in switchDict.items():
         if val == value:
             return key
+    # Should never reach here given type inference logic, but be defensive
+    raise ValueError(f"Unknown type value: {val}. This indicates a bug in type inference.")
 dmv = [default_missing_values[get_key(t)] for t in types]
src/pyOpenMS/addons/ConsensusMap.pyx (1)

211-289: Consider caching row data to avoid double computation.

At line 268, the code counts total rows by calling extract_row_blocks_channel_wide_file_long(f)[1] for each feature, then immediately iterates again at line 269 with the same generator function. This computes the feature row dictionaries twice.

For better performance, consider:

🔎 Proposed optimization
-            # Count actual rows: one row per file per feature (not one per feature)
-            total_rows = sum(len(extract_row_blocks_channel_wide_file_long(f)[1]) for f in self)
-            intyarr = np.fromiter(iter=gen(self, extract_rows_channel_wide_file_long), dtype=dtypes, count=total_rows)
+            # Pre-compute all rows to avoid double iteration
+            all_rows = []
+            for f in self:
+                uniqueid, rowdict = extract_row_blocks_channel_wide_file_long(f)
+                for file, row in rowdict.items():
+                    row.append(file)
+                    all_rows.append(tuple([uniqueid] + row))
+            
+            intyarr = np.fromiter(iter=all_rows, dtype=dtypes, count=len(all_rows))
src/pyOpenMS/addons/MSExperiment.pyx (1)

369-390: Document the MS level 1 limitation in get_ion_df().

The method at line 389 is hardcoded to MS level 1 (self.get2DPeakDataIMLong(..., 1)), but the docstring doesn't mention this limitation. Users might expect it to export all MS levels.

🔎 Proposed documentation improvement
     def get_ion_df(self):
         """
         get_ion_df(self: MSExperiment) -> pd.DataFrame
 
-        Generates a pandas DataFrame with all peaks and the ion mobility in the MSExperiment
+        Generates a pandas DataFrame with MS1 peaks and ion mobility data.
+        
+        Note: This method only exports MS1 (ms_level=1) spectra.
+        Returns an empty DataFrame if no MS1 spectra are present.
 
         :return: Feature information stored in a DataFrame
         :rtype: pd.DataFrame

Based on past review comments, this documentation issue was already raised and acknowledged by reviewers.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69bc45b and a97d3f5.

📒 Files selected for processing (9)
  • src/pyOpenMS/addons/ConsensusMap.pyx (2 hunks)
  • src/pyOpenMS/addons/FeatureMap.pyx (2 hunks)
  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1 hunks)
  • src/pyOpenMS/addons/MSChromatogram.pyx (1 hunks)
  • src/pyOpenMS/addons/MSExperiment.pyx (2 hunks)
  • src/pyOpenMS/addons/MSSpectrum.pyx (1 hunks)
  • src/pyOpenMS/addons/Mobilogram.pyx (1 hunks)
  • src/pyOpenMS/addons/PeptideIdentificationList.pyx (2 hunks)
  • src/pyOpenMS/setup.py (0 hunks)
💤 Files with no reviewable changes (1)
  • src/pyOpenMS/setup.py
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings

Applied to files:

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

Applied to files:

  • src/pyOpenMS/addons/MRMTransitionGroupCP.pyx
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Update relevant documentation when modifying existing functionality

Applied to files:

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

Applied to files:

  • src/pyOpenMS/addons/MSExperiment.pyx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build-macos-arm
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-lnx
  • GitHub Check: build-win
  • GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
  • GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
  • GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
  • GitHub Check: build-and-test (macos-14, xcode, 15.4)
  • GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
  • GitHub Check: cppcheck-test
🔇 Additional comments (15)
src/pyOpenMS/addons/MSSpectrum.pyx (2)

318-369: LGTM! Clean DataFrame export implementation.

The get_df() method correctly delegates to get_data_dict() and handles the optional pandas dependency with clear error messaging. The docstring follows Sphinx/reStructuredText format as required.


371-417: LGTM! Clean Arrow export implementation.

The to_arrow() method correctly delegates to get_data_dict() and handles the optional pyarrow dependency with clear error messaging. The docstring follows Sphinx/reStructuredText format.

src/pyOpenMS/addons/Mobilogram.pyx (1)

269-352: LGTM! Consistent DataFrame/Arrow export implementation.

Both methods follow the same clean delegation pattern as other addons, with proper error handling and Sphinx-formatted docstrings.

src/pyOpenMS/addons/MSChromatogram.pyx (1)

208-301: LGTM! Consistent implementation across addons.

The DataFrame and Arrow export methods follow the established pattern with proper error handling and documentation.

src/pyOpenMS/addons/PeptideIdentificationList.pyx (3)

78-217: Complex but functional DataFrame export with proper type handling.

The implementation correctly handles peptide identifications with type inference, meta value handling, and optional ontology decoding. The previous concerns about UnboundLocalError and missing metaValueExists checks have been addressed.


219-261: LGTM! Arrow export delegates to get_df().

The to_arrow() method correctly converts the DataFrame to Arrow format with proper error handling.


263-304: LGTM! Score update functionality is well-implemented.

The update_scores_from_df() method correctly updates scores in-place and returns self for method chaining.

src/pyOpenMS/addons/ConsensusMap.pyx (2)

172-209: LGTM! Well-structured DataFrame export with metadata/intensity split.

The implementation correctly handles both label-free and labelled experiments, with proper column discovery and efficient column selection logic.

Also applies to: 291-342, 344-419


421-457: LGTM! Arrow export implementation.

Correctly converts DataFrame to Arrow Table with proper error handling.

src/pyOpenMS/addons/FeatureMap.pyx (2)

146-304: LGTM! Comprehensive feature DataFrame export with proper meta value handling.

The implementation correctly:

  • Checks metaValueExists before accessing meta values
  • Handles peptide identifications with ID_filename and ID_native_id
  • Provides efficient column filtering
  • Maps common meta value types to appropriate numpy dtypes

The previous concern about missing spectrum_native_id checks has been addressed (lines 261-264).


88-124: LGTM! Well-designed helper methods and Arrow export.

The helper methods for column discovery, protein ID filename resolution, Arrow export, and peptide identification extraction are all correctly implemented.

Also applies to: 126-144, 306-349, 351-381

src/pyOpenMS/addons/MRMTransitionGroupCP.pyx (1)

7-273: LGTM! Comprehensive MRM transition group DataFrame export.

This new addon correctly implements:

  • Separate DataFrame exports for chromatograms and features
  • Delegation to underlying MSChromatogram.get_df() for chromatogram data
  • Meta value handling with type mapping for features
  • Column selection and filtering
  • Arrow Table exports for both data types

The implementation follows the established patterns from other addons and includes proper error handling for optional dependencies.

src/pyOpenMS/addons/MSExperiment.pyx (3)

177-202: LGTM! Clean DataFrame export with proper format selection.

The get_df_columns() and get_df() methods correctly handle both long and compact formats, with proper MS level filtering and column selection.

Note: The parameter is correctly named long_format (not long), which addresses the API compatibility issue mentioned in PR comments. Tests calling get_df(long=True) will need to be updated to get_df(long_format=True).

Also applies to: 204-269


271-367: LGTM! Efficient Arrow export with format support.

The to_arrow() method efficiently builds Arrow Tables for both long and compact formats. The compact format correctly uses list-type columns for mz_array and intensity_array.


392-556: LGTM! MassQL DataFrame export with proper safety checks.

The get_massql_df() implementation correctly:

  • Handles division by zero at lines 471-474 and 515-518 (previously flagged issue now resolved)
  • Exports separate MS1 and MS2 DataFrames with appropriate columns
  • Supports optional ion mobility data
  • Handles missing precursor information with fallback values (-1)
  • Uses safe polarity extraction via helper function

The complex implementation is well-structured with nested helper functions for clarity.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@copilot now the pyopenms-wheels-and-packages / test (ubuntu-latest) (pull_request)Failing after 1m action fails because we don't have the optional dependency installed. it is need for running the test

Copilot AI commented Dec 20, 2025

Copy link
Copy Markdown
Contributor

@timosachsenberg I've opened a new pull request, #8539, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits December 20, 2025 17:48
* Initial plan

* Install pandas and pyarrow in test job for optional dependency tests

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
@timosachsenberg
timosachsenberg merged commit 1556aa1 into develop Dec 20, 2025
@timosachsenberg
timosachsenberg deleted the claude/cython-to-df-implementation-6sEWt branch December 20, 2025 21:43
timosachsenberg added a commit that referenced this pull request Dec 29, 2025
* [FEATURE] Add FAIMS support to ProteomicsLFQ (#8478)

- Annotate peptide IDs with FAIMS_CV from spectrum data before feature
  detection, enabling proper per-CV filtering in FeatureFinderIdentificationAlgorithm
- Add documentation describing FAIMS support: automatic detection,
  per-CV processing, feature merging, and downstream alignment/linking

FAIMS data is now automatically handled:
1. FFI splits data by compensation voltage and processes each CV group
2. Features from different CVs representing the same analyte are merged
3. Merged features are aligned and linked based on RT and m/z

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

Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add append() and extend() methods to pyOpenMS map classes with __len__ support (#8510)

Implements feature request #8124 by adding Pythonic methods to:
- ConsensusMap: __len__, append, extend
- FeatureMap: __len__, append, extend
- PeptideIdentificationList: append, extend (already had __len__)

These methods provide a more Pythonic interface:
- __len__() enables use of built-in len() function
- append() adds single items (equivalent to push_back())
- extend() adds multiple items from iterables or other map objects

Includes comprehensive unit tests for all new methods.

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

* Store PeptideIndexer settings as metavalues in SearchParameters (#8489)

* Initial plan

* Add PeptideIndexer settings as metavalues in ProteinIdentification

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

* Extract metavalue keys as constants to improve maintainability

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

* Remove trailing whitespace from PeptideIndexing.h

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

* Use !empty() instead of size() > 0 for better readability

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

* Store PeptideIndexer settings in SearchParameters instead of ProteinIdentification

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

* Remove unnecessary static constants for metavalue keys

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

* Fix PeptideIndexing test and update test output files

- Fix unit test to provide ProteinIdentification before running
  (the test was creating an empty prot_ids vector but expecting
  metavalues to be set - the code only updates existing
  ProteinIdentifications)
- Update all PeptideIndexer TOPP test expected output files to
  include the new metavalues in SearchParameters

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

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

* Add PeptideIndexer settings to TOPP test expected output files (#8509)

Update expected output files to include PeptideIndexer settings that are
now written to SearchParameters. This includes decoy_string, enzyme,
enzyme_specificity, and related parameters.

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

Co-authored-by: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add PeptideIndexer params to SageAdapter test output (#8518)

Update the SageAdapter_1_out.idXML test file to include the
PeptideIndexer metavalues that were missing from the PR #8509
update which added these to other adapter test files.

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

* Check the return value of configure so that we stop on configure errors (#8515)

* Check the return value of configure so that we stop on configure errors

* make sure nsis is in path.

* Simplify notarization step in CI workflow

Removed redundant notarization parameters from CI workflow.

* fix cat-on-keyboard error

Updated the workflow to use a structured THIRDPARTY directory.

* Simplify CI workflow by removing deb dependency check

Removed conditional dependency installation for deb packages in CI workflow.

* Use external libraries from Debian repos to prevent deb package conflicts (#8496)

* Initial plan

* Use external SQLite3, SQLiteCpp, nlohmann-json, and SIMDe from Debian repos

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

* Fix debian package dependencies - SQLiteCpp is static library

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

* Add documentation for USE_EXTERNAL_* CMake options

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>

* Use unsigned channel identifiers in peptide quantification (#8516)

* Remove non-schema CMakeLists.txt from OPENSWATH directory (#8513)

* Initial plan

* Remove non-standard CMakeLists.txt from OPENSWATH directory

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>

* explicitly add timestamping to notarization process (#8527)

* Hide Eigen from OpenMS public API (Issue #8456) (#8511)

* Hide Eigen from OpenMS public API (Issue #8456)

This implements Option D from issue #8456: use Eigen::Map only without PIMPL.

Changes:
- Move Eigen3::Eigen from PUBLIC to PRIVATE linking in CMakeLists.txt
- Rewrite Matrix<T> to use std::vector<T> storage (column-major)
- Add internal MatrixEigen.h with eigenView() for zero-copy Eigen access
- Refactor TraceFitter/LevMarqFitter1D GenericFunctor to use raw double*
  instead of Eigen types in public interface
- Update all internal code to use eigenView() where Eigen operations needed
- Add missing includes (<cmath>, <Eigen/LU>, <Eigen/QR>) where needed
- Update tests to link against Eigen when using eigenView() directly

The Matrix class now provides:
- std::vector storage with data() pointer access
- getValue/setValue methods for element access
- eigenView() (internal) for full Eigen matrix operations

Downstream users no longer need Eigen headers when using OpenMS.

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

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

* Add pyOpenMS test for Matrix column-major ordering

Add testMatrixDoubleColumnMajorOrdering() to verify that the Matrix class
correctly preserves row/column ordering when passing data between numpy
and C++. This test catches potential column-major vs row-major issues that
could cause data transposition.

The test verifies:
- Shape preservation (3x4 matrix stays 3x4, not transposed to 4x3)
- Element-by-element verification via getValue matches numpy indexing
- Round-trip preservation (numpy -> C++ -> numpy)
- View indexing matches getValue for all elements
- Modifications through numpy view are reflected in C++ object
- Highly non-square matrices (2x5) work correctly

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

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

* Fix Doxygen for solveNNLS_ to document in-place matrix modification

Update the documentation for the non-const solveNNLS_ overload to correctly
indicate that correction_matrix is modified in-place by the NNLS solver.
Changed @param[in] to @param[in,out] and added a @note explaining that
this overload mutates the matrix for efficiency, with a reference to the
const-preserving overload for cases where the original must be preserved.

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

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

* Fix Doxygen for computeStats_ to correctly document parameters

- Change @param[out] x_naive to @param[in] (it's const reference input)
- Change @param[in] stats to @param[in,out] (it's modified by function)
- Clarify that x_naive is LU-decomposition solution, not "uncorrected"

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

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

* Fix Doxygen param annotations for NonNegativeLeastSquaresSolver

Add proper @param[in], @param[out], @param[in,out] annotations based on
actual implementation behavior:
- const Matrix& overload: A and b are [in] (copies made internally)
- raw pointer overload: A and b are [in,out] (modified by NNLS solver)
- Matrix& overload: A and b are [in,out] (passed to raw pointer version)

Also clarify in @brief that const overload preserves originals while
non-const overloads modify inputs in-place for efficiency.

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

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

* Fix misleading comments about Matrix template instantiations

Remove contradictory comment that said "No explicit template instantiations
needed" when explicit instantiations are present. Clarify that these are
explicit instantiations to compile template code into libOpenMS.so, not
"default instances for backwards compatibility".

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

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

* Remove Eigen dependency from NonNegativeLeastSquaresSolver_test

Remove include of internal MatrixEigen.h header and replace Eigen::Index
with Size. This aligns with the PR goal of hiding Eigen from the public API.

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

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

* Add unit tests for internal MatrixEigen utilities

Test coverage for the internal Eigen-based utilities in MatrixEigen.h:
- eigenView() for mutable and const Matrix
- eigenVectorView() for std::vector and raw pointers
- eigenMatrixView() for raw pointers
- Zero-copy verification (modifications through view affect original)
- Eigen operations work correctly on views
- Matrix/view consistency with column-major storage

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

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

* Add pointer-safety documentation for NNLS raw-pointer overload

Document memory requirements, ownership semantics, and lifetime constraints
for the double* A parameter:
- Must be non-null, pointing to A_rows * A_cols contiguous doubles
- Column-major storage order required
- Caller retains ownership and must ensure validity during call
- Contents modified in-place and undefined after call
- nullptr or undersized buffer is undefined behavior

Also add note recommending Matrix& overload for safety and mention
std::span as potential future improvement.

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

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

* Link MRMScoring_test to Eigen3::Eigen

MRMScoring_test.cpp includes MatrixEigen.h which requires Eigen headers.
Since Eigen is a PRIVATE dependency of OpenMS, tests that directly include
internal Eigen-dependent headers must explicitly link to Eigen3::Eigen.

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

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

* Remove Eigen dependency from ImageCreator

- Add maxValue() and minValue() methods to Matrix class using std::max_element/std::min_element
- Update ImageCreator.cpp to use Matrix::maxValue() instead of eigenView().maxCoeff()
- Remove MatrixEigen.h include from ImageCreator.cpp

This fixes the build error where ImageCreator failed to compile because
it included MatrixEigen.h but TOPP tools don't link against Eigen3::Eigen.

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

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

* Replace Eigen::Index with Size in test files

Part of hiding Eigen from the public API. Tests should not use
Eigen types directly since Eigen is an internal implementation detail.

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

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

* Add missing <atomic> include to MzMLHandler.cpp

Fix build failure caused by missing std::atomic include. This was
previously provided transitively through Eigen headers.

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

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

* Fix Doxygen documentation warnings in Matrix.h (#8529)

* Initial plan

* Fix Doxygen warnings in Matrix.h getValue/setValue documentation

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Copilot <[email protected]>

* Wrap Math::getPPM template functions for Python bindings (#8525)

* Initial plan

* Add Math.pxd wrapper and unit tests for Math::getPPM functions

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

* Update Math.pxd to properly handle template functions with concrete double type

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

* Remove unnecessary wrap-as directives from Math.pxd

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

* Improve documentation for Math class wrapper with usage examples

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

* Add wrap-doc documentation at function level for all Math functions

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

* Update Math class documentation to be more general and extensible

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Add precursor m/z range filter to PeakFileOptions (#8526)

* Initial plan

* Add precursor m/z range filter support to PeakFileOptions

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

* Implement precursor m/z range filtering in MzML, MzXML, and MzData handlers

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

* Fix MzXMLHandler to properly skip filtered spectra by removing from spectrum_data_

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Initial plan

* Changes before error encountered

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

* Remove MS level check from precursor m/z range filter

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

* [DOC] Add AGENTS.md guidance (#8537)

* [DOC] Add AGENTS.md guidance

* [DOC] Update TOPP tool documentation paths

* Implement to_df directly in Cython files (#8520)

* Move get_df() methods directly into Cython .pyx addon files

Instead of using Python wrapper classes in _dataframes.py to add DataFrame
export functionality, implement get_df() directly in the Cython addon files
alongside get_data_dict(). This simplifies the architecture by:

- Removing the "duck typing hack" of wrapper classes that override Cython classes
- Putting all DataFrame logic in one place (the Cython addon files)
- Making the code flow more straightforward

Changes:
- MSSpectrum.pyx: Added get_df()
- MSChromatogram.pyx: Added get_df()
- Mobilogram.pyx: Added get_df()
- MSExperiment.pyx: Added get_df_columns(), get_df(), get_ion_df(), get_massql_df()
- ConsensusMap.pyx: Added get_df_columns(), get_intensity_df(), get_metadata_df(), get_df()
- FeatureMap.pyx: Added get_df_columns(), get_df(), get_assigned_peptide_identifications()
- MRMTransitionGroupCP.pyx: New addon with get_chromatogram_df(), get_feature_df() methods
- _dataframes.py: Simplified to only export standalone functions
- README.md: Updated documentation to reflect new pattern

* Add get_df() to PeptideIdentificationList and comprehensive tests

- Add get_df() and update_scores_from_df() methods to PeptideIdentificationList.pyx
  following the same pattern as other data structures
- Update _dataframes.py to use backwards-compatible wrapper functions that call the
  new methods (peptide_identifications_to_df → peps.get_df(), update_scores_from_df → peps.update_scores_from_df())
- Simplify _dataframes.py by removing duplicate implementation code
- Add comprehensive tests for:
  - PeptideIdentificationList.get_df() with various parameters
  - PeptideIdentificationList.update_scores_from_df()
  - Mobilogram.get_df() column selection
  - Backwards-compatible wrapper functions

* Fix Cython compilation errors in get_df() addon methods

- Use lazy pandas imports inside methods to avoid module-level import issues
- Replace bool() calls with len() > 0 to avoid Cython type conflicts
- Replace {bool: ...} dict keys with {type(True): ...} for same reason
- Rename 'long' parameter to 'long_format' to avoid Cython keyword conflict

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

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

* Add to_arrow() methods for Apache Arrow Table export

Add to_arrow() methods to pyOpenMS classes following the Polars naming convention:
- MSSpectrum.to_arrow() - reuses get_data_dict() for efficient numpy-to-Arrow conversion
- MSChromatogram.to_arrow() - reuses get_data_dict()
- Mobilogram.to_arrow() - reuses get_data_dict()
- MSExperiment.to_arrow() - supports long_format parameter like get_df()
- ConsensusMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- FeatureMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- MRMTransitionGroupCP.chromatograms_to_arrow(), features_to_arrow()
- PeptideIdentificationList.to_arrow()

All methods use lazy imports for pyarrow to keep it as an optional dependency.

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

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

* Fix UnboundLocalError in PeptideIdentificationList.get_df()

When a PeptideHit doesn't have a particular metavalue, the code would
reference an undefined 'val' variable. Fix by using the precomputed
dmv[idx] array which already contains the correct default missing value
for each metavalue's type.

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

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

* Fix bugs and add tests for DataFrame/Arrow export

Bug fixes:
- ConsensusMap.get_intensity_df(): Fix np.fromiter count truncation
  by computing actual row count (one row per file per feature)
- MSExperiment.get_massql_df(): Fix division by zero in intensity
  normalization for empty spectra or all-zero intensities
- _dataframes.py: Fix 'any' to 'Any' type hint import

Tests added:
- TestToArrowMethods: 7 tests for to_arrow() across all classes
- TestBugFixes: 3 tests for the bug fixes above

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

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

* Fix FeatureMap.get_df() missing spectrum_native_id check

Add existence check for 'spectrum_native_id' meta value before calling
getMetaValue() in extract_meta_data(). This follows the same pattern
used in get_assigned_peptide_identifications().

Without this check, calling get_df() on a FeatureMap where some features
lack the 'spectrum_native_id' meta value could fail unexpectedly.

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

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

* Fix test parameter name mismatch in MSExperiment.get_df() test (#8523)

* Initial plan

* Fix test parameter name: change long= to long_format= in MSExperiment test

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Potential fix for pull request finding 'Unused import'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggestions from code review

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

* Make pandas and pyarrow optional dependencies with Sphinx docstrings (#8535)

* Initial plan

* Remove pandas from required dependencies and fix docstrings

- Removed pandas from install_requires in setup.py (now optional)
- Added ImportError with helpful message when pandas is not installed
- Fixed all docstrings to use Sphinx reStructuredText format (:param, :type, :return, :rtype, :raises)
- Updated docstrings in 8 addon files (ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList)
- Also added ImportError handling for pyarrow imports (optional dependency)

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

* Fix remaining to_arrow() docstrings to use Sphinx format

- Updated all to_arrow() method docstrings to use Sphinx reStructuredText format
- Fixed docstrings in ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList
- All DataFrame and Arrow export methods now have consistent Sphinx-style documentation

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Install pandas and pyarrow for CI test job (#8539)

* Initial plan

* Install pandas and pyarrow in test job for optional dependency tests

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* some review comments (#8540)

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Add security patterns to .gitignore to prevent credential leaks (#8545)

* Add security patterns to .gitignore to prevent credential leaks

Add comprehensive gitignore rules for common credential and secret files:
- Environment files (.env, .env.*)
- Private keys and certificates (.pem, .key, .p12, .pfx, .crt)
- Credential files (credentials.json, secrets.yaml, etc.)
- Cloud provider credentials (AWS, SSH keys)
- API tokens and keys (.npmrc, .pypirc, .netrc, *.token)
- Docker and Kubernetes secrets
- Database files that may contain credentials
- OAuth tokens and client secrets
- GPG keys
- Terraform and Ansible vault files
- IDE credential storage
- Shell history files
- Local config files that may contain secrets
- Jupyter notebook checkpoints
- GitHub and AI service tokens

* Remove database extensions from gitignore

OpenMS uses SQLite databases (via SQLiteCpp library, MzMLSqliteHandler,
SqliteConnector, etc.) so *.sqlite, *.sqlite3, and *.db should not be ignored.

---------

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

* MetaboliteSpectralMatcher fixes from playing with Nucleosides (#8163)

* Update src/openms/source/ANALYSIS/ID/MetaboliteSpectralMatching.cpp

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

* Update src/openms/source/ANALYSIS/ID/MetaboliteSpectralMatching.cpp

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

* Apply suggestions from code review

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

* Update MetaboliteSpectralMatching.cpp

* fix

* add test with GNPS MGF

---------

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

* propagate extern libs settings to package (#8556)

* fix macos pkg logo (#8554)

* Inital steps for moving to LightTransition (WIP) (#8544)

* inital commit

* Fix pyOpenMS build for C++20 and modern dependencies

IDFilter.h:
- Add IsNotIdentificationVector concept to disambiguate template overloads
- Add removeEmptyIdentifications(PeptideIdentificationList&) overload
- Fixes autowrap-generated binding compilation with C++20 concepts

setup.py:
- Use numpy.get_include() for numpy 2.x compatibility
- Update C++ standard from C++17 to C++20 (required for OpenMS concepts)
- Change Qt5 to Qt6 on Linux (matches OpenMS build)
- Change libomp to gomp (GNU OpenMP runtime for GCC builds)
- Fix libraries.extend() bug: was iterating string characters instead of append

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

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

* Fix issues from CodeRabbit PR review

- MRMDecoy.cpp: Fix shuffle check to use decoy_temp_peptide instead of temp_peptide
- LightTargetedExperiment.pxd: Add missing isPrecursorImSet() and getPrecursorIM() methods
- OpenSwathAssayGenerator.cpp: Fix if/else-if chain for output file type handling
- OpenSwathDecoyGenerator.cpp: Add division by zero protection and fix if/else-if chain

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

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

* Add tests for light and heavy decoy generation paths

Add test 6 (light path) and test 7 (heavy path) for OpenSwathDecoyGenerator
to verify both code paths produce correct output:
- Test 6: TSV -> TSV using LightTargetedExperiment (memory-efficient path)
- Test 7: TSV -> TraML using TargetedExperiment (full feature path)

Both tests use the same input (OpenSwathDecoyGenerator_input_4.tsv) and
parameters to verify that the light and heavy paths generate equivalent
decoy sequences.

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

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

* Add debug logging for transition sequence parsing failures

Add OPENMS_LOG_DEBUG statement when transitions are skipped due to
unparseable sequences, improving debuggability.

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

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

* Implement pure light-path decoy generation methods

Address PR review feedback from singjc regarding memory efficiency:
- Add reversePeptideLight() for light peptide sequence reversal
- Add shufflePeptideLight() for light peptide shuffling with mods
- Add pseudoreversePeptideLight_() for pseudo-reverse (keep C-term)
- Add switchKRLight() for terminal K/R switching
- Add hasCNterminalModsLight_() for terminal mod detection
- Update generateDecoysLight() to use pure light methods

These methods operate directly on std::string and LightModification
vectors, avoiding temporary TargetedExperiment::Peptide allocations
for improved memory efficiency with large spectral libraries.

Also includes:
- Documentation for detecting/quantifying transition defaults
- PQP output tests for light path
- TODO comment for future IPF light path support
- Comprehensive unit tests comparing light vs heavy methods

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

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

* Refactor MRMDecoy heavy methods to delegate to light implementations

Reduces code duplication by having heavy methods call their light
counterparts with conversion helpers:

- Add detail::toLightMods() to convert heavy Peptide::Modification to
  LightModification format
- Add detail::applyLocationUpdates() to apply location changes back
- shufflePeptide() now delegates to shufflePeptideLight()
- reversePeptide() now delegates to reversePeptideLight()
- switchKR() now delegates to switchKRLight()
- hasCNterminalMods_() now delegates to hasCNterminalModsLight_()

Also fixes identity comparison in shufflePeptideLight to compare against
the working copy (peptide_seq) rather than original sequence, matching
the original heavy method behavior where the peptide object gets updated
during mutation phases.

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

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

* Add FuzzyDiff -sort flag for order-independent file comparison

- Add -sort flag to FuzzyDiff that sorts data lines before comparison
  (preserves header as first line)
- Update PQP roundtrip test to use -sort flag since PQP reader returns
  transitions ordered by ID, not by original insertion order
- Update light-path roundtrip test to use -sort flag
- Add expected output files for roundtrip tests with correct TSV format
  (UniprotId is empty in PQP roundtrip since PQP format doesn't store it)

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

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

* Implement light-path IPF support for uisTransitionsLight()

Add memory-efficient light version of uisTransitions() to enable IPF
(Identification Peptide Fragment) workflows for large-scale spectral
libraries without loading full TargetedExperiment objects.

Key implementations:
- generateTargetInSilicoMapLight_(): Generate theoretical peptidoforms
- generateDecoyInSilicoMapLight_(): Generate decoy peptidoforms
- generateTargetAssaysLight_(): Create UIS transitions with peptidoforms
- generateDecoyAssaysLight_(): Create decoy UIS transitions (filtered)
- uisTransitionsLight(): Main orchestrator following 4-step pipeline

Critical bug fixes applied during review:
- Use target peptide's SWATH index for decoy generation (not decoy's)
- Use target compound id as DecoyPeptideMap key (matching heavy version)
- Remove incorrect DECOY_ prefix stripping in decoy assay generation

Update OpenSwathAssayGenerator to use light path with -enable_ipf when
input/output formats support it (PQP, TSV, MRM).

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

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

* Add IPF light path tests and fix sequence reconstruction bug

- Fix getAASequenceFromLightCompound() to handle both PQP input (full
  modified sequence) and TraML input (unmodified + modifications vector)
- Fix generateDecoyAssaysLight_() to use target_precursor_swath for
  DecoyIonMap lookup (matching heavy path behavior)
- Add UIS SWATH window generation and post-IPF restriction to light path
- Add command-line parameters for IPF decoy seed and disable flag
- Add class tests for uisTransitionsLight() with light/heavy equivalence
- Add TOPP test for PQP input with IPF enabled (test_4)
- Remove duplicate include in MRMDecoy_test.cpp

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

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

* Fix light-path TSV output to match heavy-path format

- Default empty GeneName and PeptideGroupLabel fields to "NA"
- Change CollisionEnergy format from "-1" to "-1.0" for consistency
- Update expected test output files

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

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

* Fix test mode to disable decoy transitions for reproducibility

The refactoring that added command-line flags for IPF decoy parameters
accidentally removed the automatic disabling of decoy transitions in
test mode. This caused TOPP_OpenSwathAssayGenerator tests to fail by
generating extra UISDECOY transitions not present in expected outputs.

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

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

* Fix light-path IPF UIS window generation to respect enable_swath_specifity

The light-path IPF code only checked swathes.empty(), causing divergence
from the heavy path which respects the enable_swath_specifity flag. Changed
the condition to (!enable_swath_specifity || swathes.empty()) to match the
heavy path behavior. Also fixed the loop calculation to use Math::round()
instead of truncation for consistent window count computation.

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

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

* Optimize LightTransition memory layout with compact types

Memory optimizations for LightTransition struct:
- Add FragmentIonType enum (1 byte vs 32+ bytes for std::string)
- Add TransitionFlags bitfield for packed bools (1 byte vs 4+ bytes)
- Change fragment_charge from int to int8_t (4 bytes → 1 byte)
- Change fragment_nr from int to int16_t (4 bytes → 2 bytes)

Estimated savings: ~39+ bytes per transition (~19 MB for 500K transitions)

Updated all consumers to use new getter/setter API:
- TransitionPQPFile.cpp, TransitionTSVFile.cpp (I/O)
- MRMAssay.cpp, MRMDecoy.cpp (assay/decoy generation)
- DataAccessHelper.cpp, OpenSwathHelper.cpp (utilities)
- MRMFeatureFinderScoring.cpp (feature finding)
- pyOpenMS bindings (LightTargetedExperiment.pxd)

All 2383 relevant tests pass.

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

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

* Eliminate annotation string field from LightTransition

Replace stored annotation string with getAnnotation() method that
reconstructs annotations from existing fields (fragment_type, fragment_nr,
fragment_charge). This saves ~32 bytes per transition.

Key changes:
- Add getAnnotation() method to LightTransition that builds annotation
  strings like "b4^1", "y10^2", "prec" from fragment metadata
- Update MRMAssay.cpp to extract charge from annotation strings when
  parsing (format: type + ordinal + "^" + charge)
- Update MRMDecoy.cpp similarly for decoy transition generation
- Update TransitionTSVFile.cpp and TransitionPQPFile.cpp to use
  getAnnotation() instead of direct field access
- Update pyOpenMS bindings to expose getAnnotation() method

The annotation format matches MRMIonSeries.cpp which generates
annotations as: type + ordinal + "^" + charge (e.g., "b4^1")

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

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

* Fix decoy compound ID bug in light-path IPF generation

The light-path decoy generation was incorrectly setting decoy_compound.id
to "DECOY_" + compound.id, causing decoy transitions to reference
non-existent compound IDs. This differed from the heavy-path behavior
where decoy peptide IDs are kept identical to target peptide IDs.

Fixed by removing the "DECOY_" prefix, matching the heavy-path approach
where decoy transitions reference target compounds (which exist) and are
distinguished by their decoy flag instead of a different compound ID.

Also updated test reference file to reflect correct annotation
reconstruction from structured fields (FragmentType + FragmentSeriesNumber
+ FragmentCharge).

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

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

* Fix heavy-path UIS swath window generation when swathes is empty

The heavy-path IPF code only checked !enable_swath_specifity to decide
whether to generate default UIS swath windows, while the light-path
correctly checks (!enable_swath_specifity || swathes.empty()).

This caused the heavy-path to use empty swathes when enable_swath_specifity
was true but no swathes were provided, resulting in no swath windows being
generated for UIS transitions.

Fixed by adding || swathes.empty() to match the light-path logic.

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

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

* Fix duplicate conditions in stringToFragmentIonType

Remove redundant duplicate OR operands in z-prime and z-dot ion checks.
The conditions (s == "z'" || s == "z'") and (s == "z." || s == "z.")
were copy-paste mistakes with identical strings on both sides.

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

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

* Fix ambiguous operator+ between String and std::string

Explicitly wrap tr.getFragmentType() in String() to avoid ambiguous
overload resolution between String::operator+ and std::string::operator+
on some compilers/platforms.

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

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

* Light-path TSV output: use NA for empty fields and fix pyOpenMS bindings

- Add NA handling for empty fields in light-path TSV output:
  label_type, compound_name, sum_formula, smiles, adducts,
  peptide_sequence, full_peptide_name, protein_names, uniprot_ids
- Fix pyOpenMS LightTargetedExperiment.pxd: use int instead of
  signed char/short for fragment_charge and fragment_nr to avoid
  Cython treating int8_t as bytes type
- Update test reference files to reflect new NA values

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

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

* Add light/heavy path equivalence tests for TransitionTSVFile

Add comprehensive unit tests verifying equivalence between light and
heavy paths for transition library I/O:

- Light path TSV roundtrip test
- Light vs Heavy path equivalence via PQP roundtrip
- Light path preserves transition flags (detecting/quantifying/identifying)
- Light path preserves fragment annotation

Tests use field normalization to handle expected empty/"NA" differences
between paths while catching real bugs.

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

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

* Add streaming TSV parser for ~5x memory reduction

Implement streamTSVToLightTargetedExperiment_() which reads TSV files
directly into LightTargetedExperiment without creating an intermediate
vector<TSVTransition>. This eliminates the memory duplication where
data was stored twice during parsing.

Memory improvement for 1M transitions:
- Old: ~630MB peak (500MB TSVTransition vector + 130MB LightExperiment)
- New: ~130MB peak (only LightTargetedExperiment + small tracking maps)

Key implementation details:
- Single TSVTransition buffer reused for each line
- Inline mixed sequence group detection during streaming
- Immediate conversion to LightTransition/LightCompound/LightProtein
- Progress tracking with line count pre-scan

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

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

* Add streaming PQP reader for ~5x memory reduction

Implement streamPQPToLightTargetedExperiment_() which reads PQP files
directly into LightTargetedExperiment without creating an intermediate
vector<TSVTransition>. This eliminates memory duplication during parsing.

Memory improvement for 1M transitions:
- Old: ~630MB peak (500MB TSVTransition vector + 130MB LightExperiment)
- New: ~130MB peak (only LightTargetedExperiment + small tracking maps)

Key implementation details:
- Direct SQL row to LightTransition conversion
- Compound/protein deduplication inline during streaming
- Same SQL queries as original for compatibility

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

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

* Light-path TSV: use empty fields for LabelType, CompoundName, SumFormula, SMILES

Remove NA handling for these 4 fields to match heavy-path output format.
Only Adducts remains as NA when not set.

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

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

* Cleanup: remove dead code and refactor PQP SQL query building

- Remove unused TSVToTargetedExperiment_ overload for LightTargetedExperiment
  (now handled by streaming parser)
- Extract duplicated SQL query building into buildPQPSelectQuery_() helper
- Add PQPSqlQueryInfo struct to hold query and column availability flags
- Net reduction of ~240 lines of code

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

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

* Use std::map for MRMIonSeries::IonSeries for ARM64 portability

Change IonSeries typedef from std::unordered_map to std::map to ensure
deterministic iteration order across all platforms. This fixes potential
ARM64 portability issues where hash table iteration order differs from
x86_64, causing different ion annotation results when tie-breaking in
annotateIon().

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

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

* Fix switchKRLight() to use portable deterministic hash

Replace static RNG with FNV-1a hash of peptide sequence for selecting
replacement amino acids. This ensures:
- Same peptide always gets the same replacement AA (reproducible)
- Results are independent of processing order (portable across platforms)
- Fixes ARM64 portability issue where hash table iteration order differs

Updated test expected outputs to reflect the new deterministic behavior.

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

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

* Remove dead srand() calls in MRMDecoy

The srand(time(nullptr)) calls seeded C's rand() function, but
portable_random_shuffle() uses boost::mt19937_64 which is independent.
These calls had no effect on program behavior.

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

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

* Light-path TSV: use empty fields for Adducts and UniprotId

For consistency with heavy-path output, leave Adducts and UniprotId
columns empty instead of "NA" when not set.

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

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

* Fix OpenSwathAssayGenerator test_4 for cross-platform portability

PQP files (SQLite binary format) have platform-dependent internal
layout, causing byte-by-byte comparison to fail on macOS ARM64.
Changed test to use TSV roundtrip comparison with -sort flag for
portable testing.

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

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

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>

* [DOC] Improve AGENTS.md based on best practices research (#8560)

Restructure AGENTS.md following the AGENTS.md standard best practices:
- Add Critical Constraints section upfront (what NOT to do)
- Add Quick Commands section with copy-paste ready commands
- Add code examples for naming conventions and file structure
- Add testing pattern examples with actual code
- Add verification commands section
- Create concise change impact checklist table
- Consolidate external links to essential resources only
- Improve overall structure for agent consumption

Based on research from GitHub's analysis of 2,500+ repositories
and the official AGENTS.md specification.

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

* Remove outdated template files and update test creation documentation (#8548)

* Initial plan

* Remove outdated templates and update documentation references

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* [DOC] Improve AGENTS.md based on best practices research (#8563)

* [DOC] Improve AGENTS.md based on best practices research

Enhance AGENTS.md following the AGENTS.md standard best practices while
preserving all original content:

Added:
- Critical Constraints section upfront (explicit "NEVER do" list)
- Quick Commands section with copy-paste ready bash commands
- Visual directory tree for repo layout
- Code examples for naming conventions, file structure, and tests
- Commit message example
- Debugging command examples

Preserved:
- All original build/install instructions
- All testing guidelines and details
- All coding conventions
- All pyOpenMS wrapping details
- All external documentation links
- All CI/packaging information

Based on research from GitHub's analysis of 2,500+ repositories
and the official AGENTS.md specification.

* [DOC] Add Doxygen style guide and OS-specific build gotchas to AGENTS.md

Expand AGENTS.md with detailed information researched from the codebase:

Doxygen Documentation Style:
- File header format with $Maintainer$ and $Authors$ markers
- Class documentation with @brief, @ingroup, @htmlinclude
- Method documentation with @param[in/out], @return, @throws
- Constructor/destructor grouping with @name and //@{
- Inline documentation with /// comments
- Common Doxygen tags reference table

Platform-Specific Build Gotchas:
- Windows: MSVC requirements, MinGW not supported, Release/Debug mixing
- macOS: AppleClang linker flag, Qt PrintSupport, code signing
- Linux: PIC flags, STL debug mode, headless GUI testing
- Qt6: version requirements, component dependencies, WebEngine
- Boost: Homebrew static linking issues and workarounds
- CMake: CMAKE_SIZEOF_VOID_P bug, Eigen3 version detection

Also added:
- Required and optional dependency lists
- CMake minimum version (3.21) and C++20 standard requirement

---------

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

* Cleanup TOPP tests, clean gitignore (#8555)

* Fix some race conditions in topp tests

* remove files that shouldn''t be tracked

* start moving temporary topp files into separate directory

* second batch of topp tests fixed.

* third batch

* fourth pass

* ixed the hardcoded CSV output path to use the input file's directory instead of the test execution directory, and corrected all 8 instances of "ambigious" → "ambiguous" spelling

* re-add idripper idxmls

* re-organize .gitignore

* more .gitignore cleanup

* create proper temp files for tests

* gitignore cleanup

* remove dupes from merge

* address coderabbit comments

* Fix temp file location

* use QDir for constructing paths in OpenNuXL

* Remove overbroad test file exclusions from gitignore

* Address code comments.

* Document ProteomicsLFQ automatic median normalization behavior (#8438)

* Initial plan

* Document ProteomicsLFQ normalization behavior

- Add detailed normalization documentation to Doxygen header
- Clarify automatic median normalization for feature intensity quantification
- Document when normalization is disabled (MSstats/Triqler output)
- Explain relationship between consensus feature normalization and ProteinQuantification:consensus:normalize
- Add inline code comments for better code clarity
- Update PeptideAndProteinQuant parameter description
- Provide workaround for using alternative normalization methods

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

* Fix hyphenation in documentation

Use proper compound adjective form "feature-intensity-based" instead of "feature intensity-based"

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

* Apply suggestions from code review

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Enhance DataValue conversion error messages with type and value context (#8572)

* Initial plan

* Improve DataValue error messages to include type and value information

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

* Add tests to verify improved DataValue error messages

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Document wrapping classes with deleted/private constructors in pyOpenMS (#8561)

* Initial plan

* Document how to wrap classes with deleted/private constructors in pyOpenMS

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

* Fix spacing in wrap-ignore comment for consistency

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

* Add namespace context to XMLHandler example for accuracy

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

* Add clarifying notes about singleton getInstance() overloads

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

* Improve documentation for wrap-manual-memory and fix Pattern 4 example

- Add wrap-manual-memory directive to "Hints to autowrap" section
- Document autowrap naming convention for wrap-ignore'd functions
- Fix misleading wrap-manual-dealloc reference (not a real directive)
- Update Pattern 4 example to match actual ConsensusIDAlgorithm.pxd
- Use PeptideIdentificationList instead of outdated libcpp_vector type

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

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add precursor m/z range filter option to PeakFileOptions

Adds setPrecursorMZRange(), hasPrecursorMZRange(), and getPrecursorMZRange()
methods to filter spectra based on their precursor m/z values. Updates
hasFilters() to include this new filter type.

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

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

---------

Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
timosachsenberg added a commit that referenced this pull request Dec 29, 2025
* Add PeakFileOptions support to OnDiscMSExperiment

This enables users to set filtering options (m/z range, intensity range,
RT range, MS levels, etc.) for OnDiscMSExperiment, similar to how it works
for in-memory MSExperiment loading via FileHandler.

Changes:
- Added PeakFileOptions member and getOptions/setOptions methods
- Options are applied when loading metadata (RT range, MS levels filter)
- Options are applied when retrieving spectra (m/z, intensity filters)
- Options are applied when retrieving chromatograms (RT, intensity filters)
- Updated copy constructor to copy options
- Added pyOpenMS bindings for new methods
- Added comprehensive tests for the new functionality

* Optimize OnDiscMSExperiment to skip I/O for filtered spectra

When RT range or MS level filters are set, check metadata BEFORE loading
peak data. If a spectrum doesn't pass these filters, return it with
metadata but skip the expensive I/O operation to load peaks.

This allows efficient iteration over large files where only a subset
of spectra are needed based on RT or MS level criteria.

* Fix metadata loading to maintain index correspondence

Changed loadMetaData_() to always load ALL metadata without RT/MS level
filters. This ensures index correspondence between indexed_mzml_file_ and
meta_ms_experiment_ is maintained.

Filtering behavior for OnDiscMSExperiment:
- RT range and MS level filters are checked at retrieval time (skips I/O)
- Filtered spectra return with metadata but no peaks
- All indices are preserved (unlike in-memory loading where filtered
  spectra are removed from the container)

Also added comprehensive documentation explaining this behavior.

* feature: Add PeakFileOptions support to OnDiscMSExperiment (#8534)

* [FEATURE] Add FAIMS support to ProteomicsLFQ (#8478)

- Annotate peptide IDs with FAIMS_CV from spectrum data before feature
  detection, enabling proper per-CV filtering in FeatureFinderIdentificationAlgorithm
- Add documentation describing FAIMS support: automatic detection,
  per-CV processing, feature merging, and downstream alignment/linking

FAIMS data is now automatically handled:
1. FFI splits data by compensation voltage and processes each CV group
2. Features from different CVs representing the same analyte are merged
3. Merged features are aligned and linked based on RT and m/z

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

Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add append() and extend() methods to pyOpenMS map classes with __len__ support (#8510)

Implements feature request #8124 by adding Pythonic methods to:
- ConsensusMap: __len__, append, extend
- FeatureMap: __len__, append, extend
- PeptideIdentificationList: append, extend (already had __len__)

These methods provide a more Pythonic interface:
- __len__() enables use of built-in len() function
- append() adds single items (equivalent to push_back())
- extend() adds multiple items from iterables or other map objects

Includes comprehensive unit tests for all new methods.

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

* Store PeptideIndexer settings as metavalues in SearchParameters (#8489)

* Initial plan

* Add PeptideIndexer settings as metavalues in ProteinIdentification

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

* Extract metavalue keys as constants to improve maintainability

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

* Remove trailing whitespace from PeptideIndexing.h

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

* Use !empty() instead of size() > 0 for better readability

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

* Store PeptideIndexer settings in SearchParameters instead of ProteinIdentification

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

* Remove unnecessary static constants for metavalue keys

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

* Fix PeptideIndexing test and update test output files

- Fix unit test to provide ProteinIdentification before running
  (the test was creating an empty prot_ids vector but expecting
  metavalues to be set - the code only updates existing
  ProteinIdentifications)
- Update all PeptideIndexer TOPP test expected output files to
  include the new metavalues in SearchParameters

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

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

* Add PeptideIndexer settings to TOPP test expected output files (#8509)

Update expected output files to include PeptideIndexer settings that are
now written to SearchParameters. This includes decoy_string, enzyme,
enzyme_specificity, and related parameters.

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

Co-authored-by: Claude Opus 4.5 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add PeptideIndexer params to SageAdapter test output (#8518)

Update the SageAdapter_1_out.idXML test file to include the
PeptideIndexer metavalues that were missing from the PR #8509
update which added these to other adapter test files.

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

* Check the return value of configure so that we stop on configure errors (#8515)

* Check the return value of configure so that we stop on configure errors

* make sure nsis is in path.

* Simplify notarization step in CI workflow

Removed redundant notarization parameters from CI workflow.

* fix cat-on-keyboard error

Updated the workflow to use a structured THIRDPARTY directory.

* Simplify CI workflow by removing deb dependency check

Removed conditional dependency installation for deb packages in CI workflow.

* Use external libraries from Debian repos to prevent deb package conflicts (#8496)

* Initial plan

* Use external SQLite3, SQLiteCpp, nlohmann-json, and SIMDe from Debian repos

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

* Fix debian package dependencies - SQLiteCpp is static library

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

* Add documentation for USE_EXTERNAL_* CMake options

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>

* Use unsigned channel identifiers in peptide quantification (#8516)

* Remove non-schema CMakeLists.txt from OPENSWATH directory (#8513)

* Initial plan

* Remove non-standard CMakeLists.txt from OPENSWATH directory

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>

* explicitly add timestamping to notarization process (#8527)

* Hide Eigen from OpenMS public API (Issue #8456) (#8511)

* Hide Eigen from OpenMS public API (Issue #8456)

This implements Option D from issue #8456: use Eigen::Map only without PIMPL.

Changes:
- Move Eigen3::Eigen from PUBLIC to PRIVATE linking in CMakeLists.txt
- Rewrite Matrix<T> to use std::vector<T> storage (column-major)
- Add internal MatrixEigen.h with eigenView() for zero-copy Eigen access
- Refactor TraceFitter/LevMarqFitter1D GenericFunctor to use raw double*
  instead of Eigen types in public interface
- Update all internal code to use eigenView() where Eigen operations needed
- Add missing includes (<cmath>, <Eigen/LU>, <Eigen/QR>) where needed
- Update tests to link against Eigen when using eigenView() directly

The Matrix class now provides:
- std::vector storage with data() pointer access
- getValue/setValue methods for element access
- eigenView() (internal) for full Eigen matrix operations

Downstream users no longer need Eigen headers when using OpenMS.

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

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

* Add pyOpenMS test for Matrix column-major ordering

Add testMatrixDoubleColumnMajorOrdering() to verify that the Matrix class
correctly preserves row/column ordering when passing data between numpy
and C++. This test catches potential column-major vs row-major issues that
could cause data transposition.

The test verifies:
- Shape preservation (3x4 matrix stays 3x4, not transposed to 4x3)
- Element-by-element verification via getValue matches numpy indexing
- Round-trip preservation (numpy -> C++ -> numpy)
- View indexing matches getValue for all elements
- Modifications through numpy view are reflected in C++ object
- Highly non-square matrices (2x5) work correctly

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

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

* Fix Doxygen for solveNNLS_ to document in-place matrix modification

Update the documentation for the non-const solveNNLS_ overload to correctly
indicate that correction_matrix is modified in-place by the NNLS solver.
Changed @param[in] to @param[in,out] and added a @note explaining that
this overload mutates the matrix for efficiency, with a reference to the
const-preserving overload for cases where the original must be preserved.

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

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

* Fix Doxygen for computeStats_ to correctly document parameters

- Change @param[out] x_naive to @param[in] (it's const reference input)
- Change @param[in] stats to @param[in,out] (it's modified by function)
- Clarify that x_naive is LU-decomposition solution, not "uncorrected"

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

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

* Fix Doxygen param annotations for NonNegativeLeastSquaresSolver

Add proper @param[in], @param[out], @param[in,out] annotations based on
actual implementation behavior:
- const Matrix& overload: A and b are [in] (copies made internally)
- raw pointer overload: A and b are [in,out] (modified by NNLS solver)
- Matrix& overload: A and b are [in,out] (passed to raw pointer version)

Also clarify in @brief that const overload preserves originals while
non-const overloads modify inputs in-place for efficiency.

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

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

* Fix misleading comments about Matrix template instantiations

Remove contradictory comment that said "No explicit template instantiations
needed" when explicit instantiations are present. Clarify that these are
explicit instantiations to compile template code into libOpenMS.so, not
"default instances for backwards compatibility".

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

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

* Remove Eigen dependency from NonNegativeLeastSquaresSolver_test

Remove include of internal MatrixEigen.h header and replace Eigen::Index
with Size. This aligns with the PR goal of hiding Eigen from the public API.

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

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

* Add unit tests for internal MatrixEigen utilities

Test coverage for the internal Eigen-based utilities in MatrixEigen.h:
- eigenView() for mutable and const Matrix
- eigenVectorView() for std::vector and raw pointers
- eigenMatrixView() for raw pointers
- Zero-copy verification (modifications through view affect original)
- Eigen operations work correctly on views
- Matrix/view consistency with column-major storage

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

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

* Add pointer-safety documentation for NNLS raw-pointer overload

Document memory requirements, ownership semantics, and lifetime constraints
for the double* A parameter:
- Must be non-null, pointing to A_rows * A_cols contiguous doubles
- Column-major storage order required
- Caller retains ownership and must ensure validity during call
- Contents modified in-place and undefined after call
- nullptr or undersized buffer is undefined behavior

Also add note recommending Matrix& overload for safety and mention
std::span as potential future improvement.

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

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

* Link MRMScoring_test to Eigen3::Eigen

MRMScoring_test.cpp includes MatrixEigen.h which requires Eigen headers.
Since Eigen is a PRIVATE dependency of OpenMS, tests that directly include
internal Eigen-dependent headers must explicitly link to Eigen3::Eigen.

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

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

* Remove Eigen dependency from ImageCreator

- Add maxValue() and minValue() methods to Matrix class using std::max_element/std::min_element
- Update ImageCreator.cpp to use Matrix::maxValue() instead of eigenView().maxCoeff()
- Remove MatrixEigen.h include from ImageCreator.cpp

This fixes the build error where ImageCreator failed to compile because
it included MatrixEigen.h but TOPP tools don't link against Eigen3::Eigen.

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

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

* Replace Eigen::Index with Size in test files

Part of hiding Eigen from the public API. Tests should not use
Eigen types directly since Eigen is an internal implementation detail.

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

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

* Add missing <atomic> include to MzMLHandler.cpp

Fix build failure caused by missing std::atomic include. This was
previously provided transitively through Eigen headers.

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

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

* Fix Doxygen documentation warnings in Matrix.h (#8529)

* Initial plan

* Fix Doxygen warnings in Matrix.h getValue/setValue documentation

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Copilot <[email protected]>

* Wrap Math::getPPM template functions for Python bindings (#8525)

* Initial plan

* Add Math.pxd wrapper and unit tests for Math::getPPM functions

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

* Update Math.pxd to properly handle template functions with concrete double type

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

* Remove unnecessary wrap-as directives from Math.pxd

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

* Improve documentation for Math class wrapper with usage examples

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

* Add wrap-doc documentation at function level for all Math functions

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

* Update Math class documentation to be more general and extensible

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Add precursor m/z range filter to PeakFileOptions (#8526)

* Initial plan

* Add precursor m/z range filter support to PeakFileOptions

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

* Implement precursor m/z range filtering in MzML, MzXML, and MzData handlers

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

* Fix MzXMLHandler to properly skip filtered spectra by removing from spectrum_data_

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Initial plan

* Changes before error encountered

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

* Remove MS level check from precursor m/z range filter

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

* [DOC] Add AGENTS.md guidance (#8537)

* [DOC] Add AGENTS.md guidance

* [DOC] Update TOPP tool documentation paths

* Implement to_df directly in Cython files (#8520)

* Move get_df() methods directly into Cython .pyx addon files

Instead of using Python wrapper classes in _dataframes.py to add DataFrame
export functionality, implement get_df() directly in the Cython addon files
alongside get_data_dict(). This simplifies the architecture by:

- Removing the "duck typing hack" of wrapper classes that override Cython classes
- Putting all DataFrame logic in one place (the Cython addon files)
- Making the code flow more straightforward

Changes:
- MSSpectrum.pyx: Added get_df()
- MSChromatogram.pyx: Added get_df()
- Mobilogram.pyx: Added get_df()
- MSExperiment.pyx: Added get_df_columns(), get_df(), get_ion_df(), get_massql_df()
- ConsensusMap.pyx: Added get_df_columns(), get_intensity_df(), get_metadata_df(), get_df()
- FeatureMap.pyx: Added get_df_columns(), get_df(), get_assigned_peptide_identifications()
- MRMTransitionGroupCP.pyx: New addon with get_chromatogram_df(), get_feature_df() methods
- _dataframes.py: Simplified to only export standalone functions
- README.md: Updated documentation to reflect new pattern

* Add get_df() to PeptideIdentificationList and comprehensive tests

- Add get_df() and update_scores_from_df() methods to PeptideIdentificationList.pyx
  following the same pattern as other data structures
- Update _dataframes.py to use backwards-compatible wrapper functions that call the
  new methods (peptide_identifications_to_df → peps.get_df(), update_scores_from_df → peps.update_scores_from_df())
- Simplify _dataframes.py by removing duplicate implementation code
- Add comprehensive tests for:
  - PeptideIdentificationList.get_df() with various parameters
  - PeptideIdentificationList.update_scores_from_df()
  - Mobilogram.get_df() column selection
  - Backwards-compatible wrapper functions

* Fix Cython compilation errors in get_df() addon methods

- Use lazy pandas imports inside methods to avoid module-level import issues
- Replace bool() calls with len() > 0 to avoid Cython type conflicts
- Replace {bool: ...} dict keys with {type(True): ...} for same reason
- Rename 'long' parameter to 'long_format' to avoid Cython keyword conflict

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

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

* Add to_arrow() methods for Apache Arrow Table export

Add to_arrow() methods to pyOpenMS classes following the Polars naming convention:
- MSSpectrum.to_arrow() - reuses get_data_dict() for efficient numpy-to-Arrow conversion
- MSChromatogram.to_arrow() - reuses get_data_dict()
- Mobilogram.to_arrow() - reuses get_data_dict()
- MSExperiment.to_arrow() - supports long_format parameter like get_df()
- ConsensusMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- FeatureMap.to_arrow() - wraps get_df() with pa.Table.from_pandas()
- MRMTransitionGroupCP.chromatograms_to_arrow(), features_to_arrow()
- PeptideIdentificationList.to_arrow()

All methods use lazy imports for pyarrow to keep it as an optional dependency.

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

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

* Fix UnboundLocalError in PeptideIdentificationList.get_df()

When a PeptideHit doesn't have a particular metavalue, the code would
reference an undefined 'val' variable. Fix by using the precomputed
dmv[idx] array which already contains the correct default missing value
for each metavalue's type.

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

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

* Fix bugs and add tests for DataFrame/Arrow export

Bug fixes:
- ConsensusMap.get_intensity_df(): Fix np.fromiter count truncation
  by computing actual row count (one row per file per feature)
- MSExperiment.get_massql_df(): Fix division by zero in intensity
  normalization for empty spectra or all-zero intensities
- _dataframes.py: Fix 'any' to 'Any' type hint import

Tests added:
- TestToArrowMethods: 7 tests for to_arrow() across all classes
- TestBugFixes: 3 tests for the bug fixes above

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

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

* Fix FeatureMap.get_df() missing spectrum_native_id check

Add existence check for 'spectrum_native_id' meta value before calling
getMetaValue() in extract_meta_data(). This follows the same pattern
used in get_assigned_peptide_identifications().

Without this check, calling get_df() on a FeatureMap where some features
lack the 'spectrum_native_id' meta value could fail unexpectedly.

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

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

* Fix test parameter name mismatch in MSExperiment.get_df() test (#8523)

* Initial plan

* Fix test parameter name: change long= to long_format= in MSExperiment test

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Potential fix for pull request finding 'Unused import'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggestions from code review

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

* Make pandas and pyarrow optional dependencies with Sphinx docstrings (#8535)

* Initial plan

* Remove pandas from required dependencies and fix docstrings

- Removed pandas from install_requires in setup.py (now optional)
- Added ImportError with helpful message when pandas is not installed
- Fixed all docstrings to use Sphinx reStructuredText format (:param, :type, :return, :rtype, :raises)
- Updated docstrings in 8 addon files (ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList)
- Also added ImportError handling for pyarrow imports (optional dependency)

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

* Fix remaining to_arrow() docstrings to use Sphinx format

- Updated all to_arrow() method docstrings to use Sphinx reStructuredText format
- Fixed docstrings in ConsensusMap, FeatureMap, MRMTransitionGroupCP, MSChromatogram, MSExperiment, MSSpectrum, Mobilogram, PeptideIdentificationList
- All DataFrame and Arrow export methods now have consistent Sphinx-style documentation

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Install pandas and pyarrow for CI test job (#8539)

* Initial plan

* Install pandas and pyarrow in test job for optional dependency tests

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* some review comments (#8540)

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Add security patterns to .gitignore to prevent credential leaks (#8545)

* Add security patterns to .gitignore to prevent credential leaks

Add comprehensive gitignore rules for common credential and secret files:
- Environment files (.env, .env.*)
- Private keys and certificates (.pem, .key, .p12, .pfx, .crt)
- Credential files (credentials.json, secrets.yaml, etc.)
- Cloud provider credentials (AWS, SSH keys)
- API tokens and keys (.npmrc, .pypirc, .netrc, *.token)
- Docker and Kubernetes secrets
- Database files that may contain credentials
- OAuth tokens and client secrets
- GPG keys
- Terraform and Ansible vault files
- IDE credential storage
- Shell history files
- Local config files that may contain secrets
- Jupyter notebook checkpoints
- GitHub and AI service tokens

* Remove database extensions from gitignore

OpenMS uses SQLite databases (via SQLiteCpp library, MzMLSqliteHandler,
SqliteConnector, etc.) so *.sqlite, *.sqlite3, and *.db should not be ignored.

---------

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

* MetaboliteSpectralMatcher fixes from playing with Nucleosides (#8163)

* Update src/openms/source/ANALYSIS/ID/MetaboliteSpectralMatching.cpp

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

* Update src/openms/source/ANALYSIS/ID/MetaboliteSpectralMatching.cpp

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

* Apply suggestions from code review

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

* Update MetaboliteSpectralMatching.cpp

* fix

* add test with GNPS MGF

---------

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

* propagate extern libs settings to package (#8556)

* fix macos pkg logo (#8554)

* Inital steps for moving to LightTransition (WIP) (#8544)

* inital commit

* Fix pyOpenMS build for C++20 and modern dependencies

IDFilter.h:
- Add IsNotIdentificationVector concept to disambiguate template overloads
- Add removeEmptyIdentifications(PeptideIdentificationList&) overload
- Fixes autowrap-generated binding compilation with C++20 concepts

setup.py:
- Use numpy.get_include() for numpy 2.x compatibility
- Update C++ standard from C++17 to C++20 (required for OpenMS concepts)
- Change Qt5 to Qt6 on Linux (matches OpenMS build)
- Change libomp to gomp (GNU OpenMP runtime for GCC builds)
- Fix libraries.extend() bug: was iterating string characters instead of append

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

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

* Fix issues from CodeRabbit PR review

- MRMDecoy.cpp: Fix shuffle check to use decoy_temp_peptide instead of temp_peptide
- LightTargetedExperiment.pxd: Add missing isPrecursorImSet() and getPrecursorIM() methods
- OpenSwathAssayGenerator.cpp: Fix if/else-if chain for output file type handling
- OpenSwathDecoyGenerator.cpp: Add division by zero protection and fix if/else-if chain

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

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

* Add tests for light and heavy decoy generation paths

Add test 6 (light path) and test 7 (heavy path) for OpenSwathDecoyGenerator
to verify both code paths produce correct output:
- Test 6: TSV -> TSV using LightTargetedExperiment (memory-efficient path)
- Test 7: TSV -> TraML using TargetedExperiment (full feature path)

Both tests use the same input (OpenSwathDecoyGenerator_input_4.tsv) and
parameters to verify that the light and heavy paths generate equivalent
decoy sequences.

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

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

* Add debug logging for transition sequence parsing failures

Add OPENMS_LOG_DEBUG statement when transitions are skipped due to
unparseable sequences, improving debuggability.

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

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

* Implement pure light-path decoy generation methods

Address PR review feedback from singjc regarding memory efficiency:
- Add reversePeptideLight() for light peptide sequence reversal
- Add shufflePeptideLight() for light peptide shuffling with mods
- Add pseudoreversePeptideLight_() for pseudo-reverse (keep C-term)
- Add switchKRLight() for terminal K/R switching
- Add hasCNterminalModsLight_() for terminal mod detection
- Update generateDecoysLight() to use pure light methods

These methods operate directly on std::string and LightModification
vectors, avoiding temporary TargetedExperiment::Peptide allocations
for improved memory efficiency with large spectral libraries.

Also includes:
- Documentation for detecting/quantifying transition defaults
- PQP output tests for light path
- TODO comment for future IPF light path support
- Comprehensive unit tests comparing light vs heavy methods

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

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

* Refactor MRMDecoy heavy methods to delegate to light implementations

Reduces code duplication by having heavy methods call their light
counterparts with conversion helpers:

- Add detail::toLightMods() to convert heavy Peptide::Modification to
  LightModification format
- Add detail::applyLocationUpdates() to apply location changes back
- shufflePeptide() now delegates to shufflePeptideLight()
- reversePeptide() now delegates to reversePeptideLight()
- switchKR() now delegates to switchKRLight()
- hasCNterminalMods_() now delegates to hasCNterminalModsLight_()

Also fixes identity comparison in shufflePeptideLight to compare against
the working copy (peptide_seq) rather than original sequence, matching
the original heavy method behavior where the peptide object gets updated
during mutation phases.

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

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

* Add FuzzyDiff -sort flag for order-independent file comparison

- Add -sort flag to FuzzyDiff that sorts data lines before comparison
  (preserves header as first line)
- Update PQP roundtrip test to use -sort flag since PQP reader returns
  transitions ordered by ID, not by original insertion order
- Update light-path roundtrip test to use -sort flag
- Add expected output files for roundtrip tests with correct TSV format
  (UniprotId is empty in PQP roundtrip since PQP format doesn't store it)

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

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

* Implement light-path IPF support for uisTransitionsLight()

Add memory-efficient light version of uisTransitions() to enable IPF
(Identification Peptide Fragment) workflows for large-scale spectral
libraries without loading full TargetedExperiment objects.

Key implementations:
- generateTargetInSilicoMapLight_(): Generate theoretical peptidoforms
- generateDecoyInSilicoMapLight_(): Generate decoy peptidoforms
- generateTargetAssaysLight_(): Create UIS transitions with peptidoforms
- generateDecoyAssaysLight_(): Create decoy UIS transitions (filtered)
- uisTransitionsLight(): Main orchestrator following 4-step pipeline

Critical bug fixes applied during review:
- Use target peptide's SWATH index for decoy generation (not decoy's)
- Use target compound id as DecoyPeptideMap key (matching heavy version)
- Remove incorrect DECOY_ prefix stripping in decoy assay generation

Update OpenSwathAssayGenerator to use light path with -enable_ipf when
input/output formats support it (PQP, TSV, MRM).

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

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

* Add IPF light path tests and fix sequence reconstruction bug

- Fix getAASequenceFromLightCompound() to handle both PQP input (full
  modified sequence) and TraML input (unmodified + modifications vector)
- Fix generateDecoyAssaysLight_() to use target_precursor_swath for
  DecoyIonMap lookup (matching heavy path behavior)
- Add UIS SWATH window generation and post-IPF restriction to light path
- Add command-line parameters for IPF decoy seed and disable flag
- Add class tests for uisTransitionsLight() with light/heavy equivalence
- Add TOPP test for PQP input with IPF enabled (test_4)
- Remove duplicate include in MRMDecoy_test.cpp

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

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

* Fix light-path TSV output to match heavy-path format

- Default empty GeneName and PeptideGroupLabel fields to "NA"
- Change CollisionEnergy format from "-1" to "-1.0" for consistency
- Update expected test output files

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

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

* Fix test mode to disable decoy transitions for reproducibility

The refactoring that added command-line flags for IPF decoy parameters
accidentally removed the automatic disabling of decoy transitions in
test mode. This caused TOPP_OpenSwathAssayGenerator tests to fail by
generating extra UISDECOY transitions not present in expected outputs.

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

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

* Fix light-path IPF UIS window generation to respect enable_swath_specifity

The light-path IPF code only checked swathes.empty(), causing divergence
from the heavy path which respects the enable_swath_specifity flag. Changed
the condition to (!enable_swath_specifity || swathes.empty()) to match the
heavy path behavior. Also fixed the loop calculation to use Math::round()
instead of truncation for consistent window count computation.

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

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

* Optimize LightTransition memory layout with compact types

Memory optimizations for LightTransition struct:
- Add FragmentIonType enum (1 byte vs 32+ bytes for std::string)
- Add TransitionFlags bitfield for packed bools (1 byte vs 4+ bytes)
- Change fragment_charge from int to int8_t (4 bytes → 1 byte)
- Change fragment_nr from int to int16_t (4 bytes → 2 bytes)

Estimated savings: ~39+ bytes per transition (~19 MB for 500K transitions)

Updated all consumers to use new getter/setter API:
- TransitionPQPFile.cpp, TransitionTSVFile.cpp (I/O)
- MRMAssay.cpp, MRMDecoy.cpp (assay/decoy generation)
- DataAccessHelper.cpp, OpenSwathHelper.cpp (utilities)
- MRMFeatureFinderScoring.cpp (feature finding)
- pyOpenMS bindings (LightTargetedExperiment.pxd)

All 2383 relevant tests pass.

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

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

* Eliminate annotation string field from LightTransition

Replace stored annotation string with getAnnotation() method that
reconstructs annotations from existing fields (fragment_type, fragment_nr,
fragment_charge). This saves ~32 bytes per transition.

Key changes:
- Add getAnnotation() method to LightTransition that builds annotation
  strings like "b4^1", "y10^2", "prec" from fragment metadata
- Update MRMAssay.cpp to extract charge from annotation strings when
  parsing (format: type + ordinal + "^" + charge)
- Update MRMDecoy.cpp similarly for decoy transition generation
- Update TransitionTSVFile.cpp and TransitionPQPFile.cpp to use
  getAnnotation() instead of direct field access
- Update pyOpenMS bindings to expose getAnnotation() method

The annotation format matches MRMIonSeries.cpp which generates
annotations as: type + ordinal + "^" + charge (e.g., "b4^1")

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

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

* Fix decoy compound ID bug in light-path IPF generation

The light-path decoy generation was incorrectly setting decoy_compound.id
to "DECOY_" + compound.id, causing decoy transitions to reference
non-existent compound IDs. This differed from the heavy-path behavior
where decoy peptide IDs are kept identical to target peptide IDs.

Fixed by removing the "DECOY_" prefix, matching the heavy-path approach
where decoy transitions reference target compounds (which exist) and are
distinguished by their decoy flag instead of a different compound ID.

Also updated test reference file to reflect correct annotation
reconstruction from structured fields (FragmentType + FragmentSeriesNumber
+ FragmentCharge).

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

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

* Fix heavy-path UIS swath window generation when swathes is empty

The heavy-path IPF code only checked !enable_swath_specifity to decide
whether to generate default UIS swath windows, while the light-path
correctly checks (!enable_swath_specifity || swathes.empty()).

This caused the heavy-path to use empty swathes when enable_swath_specifity
was true but no swathes were provided, resulting in no swath windows being
generated for UIS transitions.

Fixed by adding || swathes.empty() to match the light-path logic.

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

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

* Fix duplicate conditions in stringToFragmentIonType

Remove redundant duplicate OR operands in z-prime and z-dot ion checks.
The conditions (s == "z'" || s == "z'") and (s == "z." || s == "z.")
were copy-paste mistakes with identical strings on both sides.

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

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

* Fix ambiguous operator+ between String and std::string

Explicitly wrap tr.getFragmentType() in String() to avoid ambiguous
overload resolution between String::operator+ and std::string::operator+
on some compilers/platforms.

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

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

* Light-path TSV output: use NA for empty fields and fix pyOpenMS bindings

- Add NA handling for empty fields in light-path TSV output:
  label_type, compound_name, sum_formula, smiles, adducts,
  peptide_sequence, full_peptide_name, protein_names, uniprot_ids
- Fix pyOpenMS LightTargetedExperiment.pxd: use int instead of
  signed char/short for fragment_charge and fragment_nr to avoid
  Cython treating int8_t as bytes type
- Update test reference files to reflect new NA values

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

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

* Add light/heavy path equivalence tests for TransitionTSVFile

Add comprehensive unit tests verifying equivalence between light and
heavy paths for transition library I/O:

- Light path TSV roundtrip test
- Light vs Heavy path equivalence via PQP roundtrip
- Light path preserves transition flags (detecting/quantifying/identifying)
- Light path preserves fragment annotation

Tests use field normalization to handle expected empty/"NA" differences
between paths while catching real bugs.

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

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

* Add streaming TSV parser for ~5x memory reduction

Implement streamTSVToLightTargetedExperiment_() which reads TSV files
directly into LightTargetedExperiment without creating an intermediate
vector<TSVTransition>. This eliminates the memory duplication where
data was stored twice during parsing.

Memory improvement for 1M transitions:
- Old: ~630MB peak (500MB TSVTransition vector + 130MB LightExperiment)
- New: ~130MB peak (only LightTargetedExperiment + small tracking maps)

Key implementation details:
- Single TSVTransition buffer reused for each line
- Inline mixed sequence group detection during streaming
- Immediate conversion to LightTransition/LightCompound/LightProtein
- Progress tracking with line count pre-scan

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

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

* Add streaming PQP reader for ~5x memory reduction

Implement streamPQPToLightTargetedExperiment_() which reads PQP files
directly into LightTargetedExperiment without creating an intermediate
vector<TSVTransition>. This eliminates memory duplication during parsing.

Memory improvement for 1M transitions:
- Old: ~630MB peak (500MB TSVTransition vector + 130MB LightExperiment)
- New: ~130MB peak (only LightTargetedExperiment + small tracking maps)

Key implementation details:
- Direct SQL row to LightTransition conversion
- Compound/protein deduplication inline during streaming
- Same SQL queries as original for compatibility

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

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

* Light-path TSV: use empty fields for LabelType, CompoundName, SumFormula, SMILES

Remove NA handling for these 4 fields to match heavy-path output format.
Only Adducts remains as NA when not set.

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

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

* Cleanup: remove dead code and refactor PQP SQL query building

- Remove unused TSVToTargetedExperiment_ overload for LightTargetedExperiment
  (now handled by streaming parser)
- Extract duplicated SQL query building into buildPQPSelectQuery_() helper
- Add PQPSqlQueryInfo struct to hold query and column availability flags
- Net reduction of ~240 lines of code

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

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

* Use std::map for MRMIonSeries::IonSeries for ARM64 portability

Change IonSeries typedef from std::unordered_map to std::map to ensure
deterministic iteration order across all platforms. This fixes potential
ARM64 portability issues where hash table iteration order differs from
x86_64, causing different ion annotation results when tie-breaking in
annotateIon().

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

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

* Fix switchKRLight() to use portable deterministic hash

Replace static RNG with FNV-1a hash of peptide sequence for selecting
replacement amino acids. This ensures:
- Same peptide always gets the same replacement AA (reproducible)
- Results are independent of processing order (portable across platforms)
- Fixes ARM64 portability issue where hash table iteration order differs

Updated test expected outputs to reflect the new deterministic behavior.

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

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

* Remove dead srand() calls in MRMDecoy

The srand(time(nullptr)) calls seeded C's rand() function, but
portable_random_shuffle() uses boost::mt19937_64 which is independent.
These calls had no effect on program behavior.

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

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

* Light-path TSV: use empty fields for Adducts and UniprotId

For consistency with heavy-path output, leave Adducts and UniprotId
columns empty instead of "NA" when not set.

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

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

* Fix OpenSwathAssayGenerator test_4 for cross-platform portability

PQP files (SQLite binary format) have platform-dependent internal
layout, causing byte-by-byte comparison to fail on macOS ARM64.
Changed test to use TSV roundtrip comparison with -sort flag for
portable testing.

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

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

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>

* [DOC] Improve AGENTS.md based on best practices research (#8560)

Restructure AGENTS.md following the AGENTS.md standard best practices:
- Add Critical Constraints section upfront (what NOT to do)
- Add Quick Commands section with copy-paste ready commands
- Add code examples for naming conventions and file structure
- Add testing pattern examples with actual code
- Add verification commands section
- Create concise change impact checklist table
- Consolidate external links to essential resources only
- Improve overall structure for agent consumption

Based on research from GitHub's analysis of 2,500+ repositories
and the official AGENTS.md specification.

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

* Remove outdated template files and update test creation documentation (#8548)

* Initial plan

* Remove outdated templates and update documentation references

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* [DOC] Improve AGENTS.md based on best practices research (#8563)

* [DOC] Improve AGENTS.md based on best practices research

Enhance AGENTS.md following the AGENTS.md standard best practices while
preserving all original content:

Added:
- Critical Constraints section upfront (explicit "NEVER do" list)
- Quick Commands section with copy-paste ready bash commands
- Visual directory tree for repo layout
- Code examples for naming conventions, file structure, and tests
- Commit message example
- Debugging command examples

Preserved:
- All original build/install instructions
- All testing guidelines and details
- All coding conventions
- All pyOpenMS wrapping details
- All external documentation links
- All CI/packaging information

Based on research from GitHub's analysis of 2,500+ repositories
and the official AGENTS.md specification.

* [DOC] Add Doxygen style guide and OS-specific build gotchas to AGENTS.md

Expand AGENTS.md with detailed information researched from the codebase:

Doxygen Documentation Style:
- File header format with $Maintainer$ and $Authors$ markers
- Class documentation with @brief, @ingroup, @htmlinclude
- Method documentation with @param[in/out], @return, @throws
- Constructor/destructor grouping with @name and //@{
- Inline documentation with /// comments
- Common Doxygen tags reference table

Platform-Specific Build Gotchas:
- Windows: MSVC requirements, MinGW not supported, Release/Debug mixing
- macOS: AppleClang linker flag, Qt PrintSupport, code signing
- Linux: PIC flags, STL debug mode, headless GUI testing
- Qt6: version requirements, component dependencies, WebEngine
- Boost: Homebrew static linking issues and workarounds
- CMake: CMAKE_SIZEOF_VOID_P bug, Eigen3 version detection

Also added:
- Required and optional dependency lists
- CMake minimum version (3.21) and C++20 standard requirement

---------

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

* Cleanup TOPP tests, clean gitignore (#8555)

* Fix some race conditions in topp tests

* remove files that shouldn''t be tracked

* start moving temporary topp files into separate directory

* second batch of topp tests fixed.

* third batch

* fourth pass

* ixed the hardcoded CSV output path to use the input file's directory instead of the test execution directory, and corrected all 8 instances of "ambigious" → "ambiguous" spelling

* re-add idripper idxmls

* re-organize .gitignore

* more .gitignore cleanup

* create proper temp files for tests

* gitignore cleanup

* remove dupes from merge

* address coderabbit comments

* Fix temp file location

* use QDir for constructing paths in OpenNuXL

* Remove overbroad test file exclusions from gitignore

* Address code comments.

* Document ProteomicsLFQ automatic median normalization behavior (#8438)

* Initial plan

* Document ProteomicsLFQ normalization behavior

- Add detailed normalization documentation to Doxygen header
- Clarify automatic median normalization for feature intensity quantification
- Document when normalization is disabled (MSstats/Triqler output)
- Explain relationship between consensus feature normalization and ProteinQuantification:consensus:normalize
- Add inline code comments for better code clarity
- Update PeptideAndProteinQuant parameter description
- Provide workaround for using alternative normalization methods

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

* Fix hyphenation in documentation

Use proper compound adjective form "feature-intensity-based" instead of "feature intensity-based"

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

* Apply suggestions from code review

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>

* Enhance DataValue conversion error messages with type and value context (#8572)

* Initial plan

* Improve DataValue error messages to include type and value information

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

* Add tests to verify improved DataValue error messages

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>

* Document wrapping classes with deleted/private constructors in pyOpenMS (#8561)

* Initial plan

* Document how to wrap classes with deleted/private constructors in pyOpenMS

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

* Fix spacing in wrap-ignore comment for consistency

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

* Add namespace context to XMLHandler example for accuracy

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

* Add clarifying notes about singleton getInstance() overloads

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

* Improve documentation for wrap-manual-memory and fix Pattern 4 example

- Add wrap-manual-memory directive to "Hints to autowrap" section
- Document autowrap naming convention for wrap-ignore'd functions
- Fix misleading wrap-manual-dealloc reference (not a real directive)
- Update Pattern 4 example to match actual ConsensusIDAlgorithm.pxd
- Use PeptideIdentificationList instead of outdated libcpp_vector type

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

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

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>

* Add precursor m/z range filter option to PeakFileOptions

Adds setPrecursorMZRange(), hasPrecursorMZRange(), and getPrecursorMZRange()
methods to filter spectra based on their precursor m/z values. Updates
hasFilters() to include this new filter type.

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

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

---------

Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>
Co-authored-by: timosachsenberg <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix corrupted byte offsets in MzMLFile_4_indexed.mzML test file

The indexed mzML test file had incorrect byte offsets in the index section,
causing parse failures on ARM Linux and Mac platforms. Regenerated the file
with FileConverter to fix the spectrum offsets.

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

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

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: jpfeuffer <[email protected]>
Co-authored-by: Samuel Wein <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Justin Sing <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

5 participants