Skip to content

Fix msp file parcer#553

Merged
YukiMatsuzawa merged 3 commits intomasterfrom
fix_mspFileParcer
May 2, 2025
Merged

Fix msp file parcer#553
YukiMatsuzawa merged 3 commits intomasterfrom
fix_mspFileParcer

Conversation

@Bujee415
Copy link
Copy Markdown
Collaborator

@Bujee415 Bujee415 commented May 2, 2025

No description provided.

@Bujee415 Bujee415 requested a review from Copilot May 2, 2025 07:13
Copy link
Copy Markdown
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 fixes the MSP file parser by updating the query collections to use a HashSet for deduplication and refining the query checking logic.

  • Replace list-based queries with a HashSet in the LbmFileReader and ReadSerializedLbmLibrary methods
  • Change the queryCheck method parameter type to IReadOnlyCollection and update its switch-case logic conditions
Comments suppressed due to low confidence (2)

src/Common/CommonStandard/Parser/MspFileParcer.cs:221

  • The parameter name 'collosionType' appears to be misspelled; consider renaming it to 'collisionType' for clarity.
private static bool queryCheck(MoleculeMsReference mspRecord, IReadOnlyCollection<string> queries, IonMode ionMode, SolventType solventType, CollisionType collosionType)

src/Common/CommonStandard/Parser/MspFileParcer.cs:230

  • The logic in the switch-case for IonMode.Negative has been inverted compared to the original expression; please verify that the new conditions correctly capture the intended behavior.
case SolventType.CH3COONH4 when mspRecord.AdductType.IsFA || mspRecord.AdductType.IsHco3:

@Bujee415 Bujee415 requested a review from YukiMatsuzawa May 2, 2025 08:16
@YukiMatsuzawa YukiMatsuzawa requested a review from Copilot May 2, 2025 09:12
Copy link
Copy Markdown
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 aims to fix the MSP file parser functionality by updating the queryCheck logic and improving the efficiency of query handling in the MSP file reader functions.

  • Introduces new test methods in MspFileParserTests.cs to validate adduct type filtering per solvent type.
  • Updates the MspFileParcer.cs to use a HashSet for query strings and revises the switch condition in queryCheck to correct logical errors.

Reviewed Changes

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

File Description
tests/Common/CommonStandardTests/Parser/MspFileParserTests.cs Added tests for validating queryCheck behavior with different adduct types.
src/Common/CommonStandard/Parser/MspFileParcer.cs Modified queryCheck to improve performance (using HashSet) and corrected solvent type condition logic.
Comments suppressed due to low confidence (1)

src/Common/CommonStandard/Parser/MspFileParcer.cs:1

  • [nitpick] The file name 'MspFileParcer.cs' appears to be a misspelling of 'MspFileParser.cs'; if unintentional, please consider renaming to improve clarity.
File name is 'MspFileParcer.cs'

Comment on lines 229 to +231
{
case SolventType.CH3COONH4 when !mspRecord.AdductType.IsHac:
case SolventType.HCOONH4 when !mspRecord.AdductType.IsFA:
case SolventType.NH4HCO3 when !mspRecord.AdductType.IsHco3:
case SolventType.CH3COONH4 when mspRecord.AdductType.IsFA || mspRecord.AdductType.IsHco3:
case SolventType.HCOONH4 when mspRecord.AdductType.IsHac || mspRecord.AdductType.IsHco3:
Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding inline comments to clarify the intended behavior behind the updated solvent type conditions in the queryCheck method, ensuring future maintainers can follow the logic changes.

Copilot uses AI. Check for mistakes.
@YukiMatsuzawa YukiMatsuzawa merged commit 76a89b9 into master May 2, 2025
9 checks passed
@YukiMatsuzawa YukiMatsuzawa deleted the fix_mspFileParcer branch May 2, 2025 09:49
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.

3 participants