WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@acquayefrank
Copy link
Contributor

Describe your changes

Removed seemingly redundant function that splits comments in .msp files by semicolon.
This function causes an error in other files but is actually redundant in most cases.

Checklist before requesting a review

  • I have performed a self-review of my code

@acquayefrank acquayefrank requested a review from Copilot September 3, 2025 08:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes a redundant function get_peak_tuples that was splitting peak lines by semicolon in MSP file processing. The change simplifies the peak parsing logic by directly reading peak lines instead of unnecessarily splitting them.

  • Removed the get_peak_tuples function that was causing errors in other files
  • Simplified the peak reading loop to directly process individual peak lines
  • Cleaned up unused import and formatting

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/misc/use_theoretical_mz_annotations.py Removed redundant get_peak_tuples function and simplified peak processing logic
tools/misc/test-data/output_plus_no_annotated.msp Removed trailing empty line
tools/misc/test-data/output_only_annotated.msp Removed trailing empty line
tools/misc/test-data/input.msp Removed trailing empty line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +45 to +47
peak = file.readline()

mz, intensity, comment = get_peak_values(peak)
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

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

The removal of the for loop over peak_pairs creates a logic error. The original code processed multiple peaks per line (split by semicolon), but now only the first peak from file.readline() is processed once per iteration. This will skip peaks if multiple peaks exist on a single line, or process incomplete data if peaks span multiple lines differently than expected.

Copilot uses AI. Check for mistakes.
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