Skip to content

Conversation

matteopilz
Copy link
Contributor

@matteopilz matteopilz commented Sep 1, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated PeptideIdentificationList container in the Python API for handling peptide identifications.
    • Enhanced 2D peak data retrieval to accept an additional parameter in get2DPeakDataLong.
  • Documentation

    • Updated multiple user guides to use PeptideIdentificationList instead of Python lists, including counting via .size() and item insertion via push_back.
    • Clarified feature filtering by using explicit size checks.
    • Refreshed interactive plotting examples with updated options and calls.
  • Chores

    • Added jupyter_bokeh to requirements for improved notebook visualization support.

Copy link

coderabbitai bot commented Sep 1, 2025

Walkthrough

Documentation examples were updated to use oms.PeptideIdentificationList instead of Python lists, with corresponding size/count and push_back adjustments. One GNPS example now uses an explicit size check. Interactive plotting code adds a fifth argument to get2DPeakDataLong and simplifies opts usage. requirements.txt adds jupyter_bokeh.

Changes

Cohort / File(s) Summary
Adopt PeptideIdentificationList in docs
docs/source/user_guide/PSM_to_features.rst, docs/source/user_guide/export_pandas_dataframe.rst, docs/source/user_guide/identification_data.rst, docs/source/user_guide/other_ms_data_formats.rst, docs/source/user_guide/peptide_search.rst, docs/source/user_guide/quality_control.rst, docs/source/user_guide/untargeted_metabolomics_preprocessing.rst
Replace Python lists with oms.PeptideIdentificationList() in examples; update additions to push_back; adjust counting to .size() where shown; iteration and IdXML load/store use the new container.
GNPS export explicit check
docs/source/user_guide/export_files_GNPS.rst
Change truthiness check to feature.getPeptideIdentifications().size() > 0 before pushing to filtered_map.
Interactive plots example update
docs/source/user_guide/interactive_plots.rst
Add fifth argument (1) to exp.get2DPeakDataLong(...); simplify plotting by applying .opts(...) directly to the raster/dynspread pipeline and remove nested plot dict.
Dependency update
requirements.txt
Add jupyter_bokeh after bokeh.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • timosachsenberg

Poem

A nibble of docs, a hop through the code,
I swap my lists for containers bestowed.
With size I check, with push_back I cheer,
Plots gain a tweak, the picture is clear.
jupyter_bokeh joins the show—
Thump-thump! Onward the features grow. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Status, Documentation and Community

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

Copy link

@coderabbitai coderabbitai bot left a comment

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 (7)
requirements.txt (1)

9-9: Add version pin or constraints for jupyter_bokeh (optional).

Unpinned deps can drift and break the examples, especially with Bokeh/HoloViews stacks. Either pin jupyter_bokeh or add a constraints/lock file for the docs env to keep interactive plots stable.

docs/source/user_guide/interactive_plots.rst (1)

80-85: Nit: prefer standard axis label “m/z”.

Minor terminology polish for consistency with MS literature.

Apply this diff:

-hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts(
-    width=800,
-    height=800,
-    xlabel="Retention time (s)",
-    ylabel="mass/charge (Da)",
-)
+hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts(
+    width=800,
+    height=800,
+    xlabel="Retention time (s)",
+    ylabel="m/z",
+)
docs/source/user_guide/other_ms_data_formats.rst (2)

20-22: Align prose with new container type.

Since examples now use oms.PeptideIdentificationList, consider clarifying in the surrounding text that it’s a list-like container of PeptideIdentification.


51-53: Repeat the container note for pepXML.

Same suggestion as above to avoid reader confusion about accepted types.

docs/source/user_guide/export_pandas_dataframe.rst (1)

113-117: Update parameter doc to accept Iterable[PeptideIdentification].

peptide_identifications_to_df currently documents “list”; since the example passes PeptideIdentificationList, note that any iterable/list-like container is supported (if true). Otherwise, convert to list before calling.

docs/source/user_guide/peptide_search.rst (1)

146-149: Use of size() is consistent with the new container.

Good update from len(peptide_ids) to peptide_ids.size(). Ensure other docs follow the same convention.

docs/source/user_guide/quality_control.rst (1)

45-49: Update the inline comment to match the new container.

The code now uses a container, not a Python list.

-    pep_ids = oms.PeptideIdentificationList()  # list of PeptideIdentification()
+    pep_ids = oms.PeptideIdentificationList()  # PeptideIdentificationList container
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

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

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2332706 and 132f3f7.

📒 Files selected for processing (10)
  • docs/source/user_guide/PSM_to_features.rst (1 hunks)
  • docs/source/user_guide/export_files_GNPS.rst (1 hunks)
  • docs/source/user_guide/export_pandas_dataframe.rst (1 hunks)
  • docs/source/user_guide/identification_data.rst (2 hunks)
  • docs/source/user_guide/interactive_plots.rst (2 hunks)
  • docs/source/user_guide/other_ms_data_formats.rst (3 hunks)
  • docs/source/user_guide/peptide_search.rst (4 hunks)
  • docs/source/user_guide/quality_control.rst (1 hunks)
  • docs/source/user_guide/untargeted_metabolomics_preprocessing.rst (2 hunks)
  • requirements.txt (1 hunks)
⏰ 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-test
  • GitHub Check: build-test
🔇 Additional comments (9)
docs/source/user_guide/export_files_GNPS.rst (1)

50-51: Good: explicit size() check improves clarity with the new container.

This avoids relying on truthiness and reads well with PeptideIdentificationList semantics.

docs/source/user_guide/interactive_plots.rst (1)

38-39: Document the 5th argument to get2DPeakDataLong.

Please add a short note explaining what the “1” controls (e.g., MS level, binning, or threads) so readers know how to adjust it.

docs/source/user_guide/other_ms_data_formats.rst (1)

34-36: Consistency check: container works with load/store.

Assuming IdXML/mzIdentML bindings accept PeptideIdentificationList seamlessly. If there are versions that still expect Python lists, add a brief note on the minimum pyOpenMS version here.

docs/source/user_guide/peptide_search.rst (1)

34-37: Switch to PeptideIdentificationList looks correct.

Using oms.PeptideIdentificationList for SimpleSearchEngineAlgorithm.search is appropriate and iteration below remains compatible.

docs/source/user_guide/PSM_to_features.rst (1)

48-51: Loading into PeptideIdentificationList is correct.

IdXMLFile.load accepts the new container; downstream IDMapper.annotate call matches this type.

docs/source/user_guide/untargeted_metabolomics_preprocessing.rst (2)

144-153: Correct container usage in IDMapper.annotate.

Initializing peptide_ids as PeptideIdentificationList aligns with annotate’s expectations.


164-169: push_back usage is appropriate.

Replacing append with push_back matches the new container API and Feature.setPeptideIdentifications accepts it.

docs/source/user_guide/identification_data.rst (2)

164-166: Good migration to PeptideIdentificationList.

Creating the container and adding via push_back is correct and keeps iteration semantics unchanged.


197-199: Loading into PeptideIdentificationList is correct.

IdXMLFile.load with pep_ids as the container is consistent with the earlier store example.

@matteopilz matteopilz linked an issue Sep 1, 2025 that may be closed by this pull request
@timosachsenberg
Copy link
Contributor

AttributeError Traceback (most recent call last)
Cell In[5], line 12
8 for i, feature_map in enumerate(feature_maps):
9 if feature_map.getMetaValue("spectra_data")[
10 0
11 ].decode() == exp.getMetaValue("mzML_path"):
---> 12 peptide_ids = oms.PeptideIdentificationList()
13 protein_ids = []
14 mapper.annotate(
15 feature_map,
16 peptide_ids,
(...)
20 exp,
21 )

@jpfeuffer
Copy link
Contributor

If you are hoping for 3.4.1: You never released it. https://pypi.org/project/pyopenms/#history
If you are hoping for nightly. We have still not adapted a branching workflow here, so we only support docs for latest stable.

@timosachsenberg
Copy link
Contributor

ah damn... forgot that we don't have a branching workflow. thanks for pointing this out

@timosachsenberg timosachsenberg modified the milestones: 3.4, 3.5 Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update doc to use new PeptideIdentificationList
3 participants