Skip to content

Fix a exporter for gnps format#645

Merged
Bujee415 merged 5 commits intomasterfrom
bugfix/gnps-exporter
Oct 20, 2025
Merged

Fix a exporter for gnps format#645
Bujee415 merged 5 commits intomasterfrom
bugfix/gnps-exporter

Conversation

@YukiMatsuzawa
Copy link
Copy Markdown
Contributor

PR Classification

Refactor and enhancement of file metadata handling in the export process.

PR Summary

This pull request introduces a new metadata access structure for GNPS file exports, replacing existing classes and interfaces to improve code organization and functionality. Key changes include:

  • AlignmentCSVExporter: Updated to use IFileClassMetaAccessor instead of MulticlassFileMetaAccessor.
  • AlignmentGnpsExporter: Replaced MulticlassFileMetaAccessor with GnpsFileClassMetaAccessor and added logic for GNPS format export.
  • New class GnpsFileClassMetaAccessor: Implemented to provide metadata access for GNPS file classes.
  • IFileClassMetaAccessor: Defined to standardize methods for retrieving headers and content for analysis files.
  • AlignmentMgfExporter: Updated to implement the Export method directly, enhancing its functionality.

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 refactors the GNPS export functionality by introducing a new interface-based metadata access system. The changes improve code organization by replacing the concrete MulticlassFileMetaAccessor with an interface approach.

  • Removes the fileMeta parameter from AlignmentGnpsExportModel constructors across all method models
  • Introduces IFileClassMetaAccessor interface and GnpsFileClassMetaAccessor implementation for GNPS-specific metadata handling
  • Updates export methods to use the new interface-based approach and adds dedicated MGF export functionality

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Multiple MethodModel files Remove fileMeta parameter from AlignmentGnpsExportModel constructor calls
AlignmentGnpsExportModel.cs Remove AccessFileMeta property and use GnpsFileClassMetaAccessor directly
IFileClassMetaAccessor.cs New interface defining metadata access methods
GnpsFileClassMetaAccessor.cs New GNPS-specific implementation of the metadata accessor interface
MulticlassFileMetaAccessor.cs Update to implement the new interface
AlignmentGnpsExporter.cs Refactor export logic with new accessor and separate MGF export method
AlignmentCSVExporter.cs Update to use interface instead of concrete class
SpectraExport.cs Add new MGF export method for individual spot properties
AlignmentMgfExporter.cs Remove unnecessary namespace braces

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

metaAccessor,
quantAccessor,
stats);
[]);
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

Passing an empty array literal [] for stats parameter suggests this parameter may no longer be needed. Consider removing the stats parameter from the method signature if it's not being used.

Copilot uses AI. Check for mistakes.
IReadOnlyList<MSDecResult> msdecResults,
IReadOnlyList<AnalysisFileBean> files,
MulticlassFileMetaAccessor fileMetaAccessor,
GnpsFileClassMetaAccessor fileMetaAccessor,
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The method parameter should use the interface type IFileClassMetaAccessor instead of the concrete implementation GnpsFileClassMetaAccessor to maintain consistency with the interface-based design pattern used elsewhere in the codebase.

Suggested change
GnpsFileClassMetaAccessor fileMetaAccessor,
IFileClassMetaAccessor fileMetaAccessor,

Copilot uses AI. Check for mistakes.
}

private void ExportGnpsTable(Stream stream, IReadOnlyList<AnalysisFileBean> files, MulticlassFileMetaAccessor fileMetaAccessor, IMetadataAccessor metaAccessor, IQuantValueAccessor quantAccessor, IReadOnlyList<StatsValue> stats, List<AlignmentSpotProperty> flattenedSpots, IReadOnlyList<MSDecResult> alignedMsdecResults) {
private void ExportGnpsTable(Stream stream, IReadOnlyList<AnalysisFileBean> files, GnpsFileClassMetaAccessor fileMetaAccessor, IMetadataAccessor metaAccessor, IQuantValueAccessor quantAccessor, List<AlignmentSpotProperty> flattenedSpots, IReadOnlyList<MSDecResult> alignedMsdecResults) {
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The fileMetaAccessor parameter should use the interface type IFileClassMetaAccessor instead of the concrete implementation GnpsFileClassMetaAccessor for consistency with the interface-based design.

Copilot uses AI. Check for mistakes.
@Bujee415 Bujee415 merged commit ce58de2 into master Oct 20, 2025
5 checks passed
@Bujee415 Bujee415 deleted the bugfix/gnps-exporter branch October 20, 2025 03:20
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