Skip to content

Conversation

Copy link

Copilot AI commented Sep 25, 2025

This PR adds a new --allow_rt_na parameter to the ms_target_screening tool that enables matching based on m/z only when marker retention time (RT) is NaN. This feature is useful for suspect screening of peaks without RT information.

Problem

Previously, the tool required both m/z AND RT matches for all markers. When markers had NaN RT values, they were completely excluded from matching, preventing suspect screening scenarios where RT information might be missing or unavailable.

Solution

Added a new boolean parameter --allow_rt_na that:

  • Default behavior (False): Maintains existing functionality - markers with NaN RT values are excluded from matching
  • New behavior (True): Allows markers with NaN RT to match peaks based solely on m/z tolerance

Key Features

  • Backward compatible: Default behavior unchanged, all existing tests pass
  • Proper handling: RT differences are set to NaN in results for markers that were matched without RT
  • Clear indication: Users can easily identify which matches were based on m/z only
  • Galaxy integration: Full XML wrapper support with appropriate parameter documentation

Example Usage

# Default behavior - excludes markers with NaN RT
python3 target_screen.py --peaks peaks.parquet parquet --markers markers.tsv tsv --output results.tsv

# New behavior - allows m/z-only matching for NaN RT markers  
python3 target_screen.py --peaks peaks.parquet parquet --markers markers.tsv tsv --output results.tsv --allow_rt_na

Test Results

With test data containing 5 markers with NaN RT values:

  • Default behavior: 13 matches (excludes NaN RT markers)
  • With --allow_rt_na: 24 matches (includes NaN RT markers based on m/z only)
  • RT diff column shows NaN for matches without RT information

This implementation provides the flexibility needed for suspect screening while maintaining the conservative default behavior for routine targeted analysis.

Original prompt

This section details on the original issue you should resolve

<issue_title>ms_target_screening: only match based on mz if RT is NA</issue_title>
<issue_description>This mode would allow suspect screening of peaks without RT information and could be useful - ideally, I think that such a feature should be implemented via a boolean which can turn this on or off, normally I would prefer to have the tool fail or throw an exception if there is no RT information present. Only in specific scenarios you would want to allow using no rt information.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #661

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] ms_target_screening: only match based on mz if RT is NA Add RT NaN matching option to ms_target_screening tool Sep 25, 2025
Copilot AI requested a review from hechth September 25, 2025 12:38
Copilot finished work on behalf of hechth September 25, 2025 12:38
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.

ms_target_screening: only match based on mz if RT is NA

2 participants