Skip to content

Fix retention time filtering for missing metadata#44

Open
janusson wants to merge 2 commits into
mainfrom
fix-rt-filtering-17231161644105973632
Open

Fix retention time filtering for missing metadata#44
janusson wants to merge 2 commits into
mainfrom
fix-rt-filtering-17231161644105973632

Conversation

@janusson

Copy link
Copy Markdown
Owner

Fixes an issue where SimilarityEngine would crash with ValueError when encountering non-numeric retention time metadata (like "None" or "NaN") during the rt_tolerance check. The retention time values are now safely parsed using a try...except block for ValueError and TypeError, and missing metadata is properly ignored without crashing the engine.


PR created automatically by Jules for task 17231161644105973632 started by @janusson

Updates `SimilarityEngine.search` to use a `try...except` block
when calculating the difference between retention times. This prevents
crashes when the query or reference spectrum has non-numeric RT metadata
(e.g., `'NaN'` or `'None'`). Missing values are now safely ignored,
bypassing the retention time tolerance check as intended.

Co-authored-by: janusson <34246713+janusson@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@janusson

Copy link
Copy Markdown
Owner Author

@jules I have made significant changes to the codebase since this PR was opened. Please re-evaluate your implementation based on the current state of the main branch and update the code to ensure it still fits the current architecture.

@google-labs-jules

Copy link
Copy Markdown
Contributor

@jules I have made significant changes to the codebase since this PR was opened. Please re-evaluate your implementation based on the current state of the main branch and update the code to ensure it still fits the current architecture.

I have successfully rebased the branch to the current state of the main branch and confirmed that the tests pass. The codebase update to main already includes rt_tolerance in SimilarityConfig, so only the logic for handling missing and invalid retention time values in similarity.py and its corresponding test in tests/test_v1_1_features.py were required.

Updates `SimilarityEngine.search` to use a `try...except` block
when calculating the difference between retention times. This prevents
crashes when the query or reference spectrum has non-numeric RT metadata
(e.g., `'NaN'` or `'None'`). Missing values are now safely ignored,
bypassing the retention time tolerance check as intended.

Co-authored-by: janusson <34246713+janusson@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.

1 participant