Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Adds native support for chromatograms (XIC, TIC, etc.) with a Pythonic interface matching the existing spectrum functionality.

Changes

  • New Py_MSChromatogram wrapper (openms_python/py_chromatogram.py)

    • Properties: mz, name, rt, intensity, rt_range, total_ion_current
    • DataFrame conversion: from_dataframe(), to_dataframe()
    • Filtering: filter_by_rt(), filter_by_intensity()
    • Normalization: normalize_intensity(), normalize_to_tic()
    • Dictionary-style metadata access via MetaInfoMappingMixin
  • MSExperiment integration (openms_python/py_msexperiment.py)

    • Added chromatogram_count property
    • Added get_chromatogram(index) and chromatograms() iterator
    • Added add_chromatogram() method
    • Updated __repr__() to include chromatogram count
  • Documentation (README.md)

    • Added "Working with Chromatograms" section
    • Updated API reference and comparison table

Example Usage

from openms_python import Py_MSExperiment, Py_MSChromatogram
import pandas as pd

# Load experiment with chromatograms
exp = Py_MSExperiment.from_file('data.mzML')
print(f"Chromatograms: {exp.chromatogram_count}")

# Iterate over chromatograms
for chrom in exp.chromatograms():
    print(f"MZ: {chrom.mz:.4f}, Points: {len(chrom)}")

# Create from DataFrame
df = pd.DataFrame({'rt': [10.0, 20.0, 30.0], 'intensity': [1000.0, 5000.0, 3000.0]})
chrom = Py_MSChromatogram.from_dataframe(df, mz=445.12, name="XIC m/z 445.12")

# Filter and normalize
filtered = chrom.filter_by_rt(15.0, 25.0)
normalized = filtered.normalize_to_tic()

# Add to experiment
exp.add_chromatogram(chrom)

Testing

  • 22 new tests added (15 for Py_MSChromatogram, 7 for MSExperiment integration)
  • All 99 tests pass with 86% overall coverage
  • No security vulnerabilities (CodeQL)
Original prompt

Add chromatogram support


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copilot AI and others added 3 commits November 19, 2025 11:51
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Add chromatogram support Add chromatogram support Nov 19, 2025
@timosachsenberg timosachsenberg marked this pull request as ready for review November 19, 2025 13:07
@timosachsenberg timosachsenberg merged commit 6548c14 into master Nov 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants