Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Improved readability and maintainability of `AlignmentGnpsExporter.cs` by: - Removing redundant property initializations. - Simplifying null/empty checks for `spots` with pattern matching. - Modularizing export logic into separate methods for GNPS tables, MGF files, and edge files. - Replacing legacy edge export code with new methods for peak shape, ion correlation, in-source, and adduct edges. - Adding static methods for building and exporting edges to reduce code duplication. - Standardizing `using` statements for better resource management.
Updated the `AlignmentGnpsExporter` class to use file streams for exporting edges instead of direct file paths. This change improves resource management by ensuring streams are properly disposed of. The export methods for peak shape edges, ion correlation edges, in-source edges, and adduct edges now accept a `Stream` parameter, enhancing flexibility in file handling.
Updated the AlignmentGnpsExporter class to utilize a new GnpsEdges class for managing edges. Refactored edge export methods to be instance methods of GnpsEdges, improving encapsulation and data management. Modified BuildGnpsEdges to return GnpsEdges instead of a list of GnpsEdge objects, enhancing code structure and readability.
- Introduced `IsSelected` property with backing field. - Updated `CountExportFiles` to return 0 if not selected. - Modified `Export` method to return early if not selected.
Introduces the `AlignmentGnpsExportViewModel` class to manage GNPS export functionality, implementing the `IAlignmentResultExportViewModel` interface. This class includes properties for export state management and utilizes reactive programming features. Also updates the `AlignmentResultExportViewModel` to handle `AlignmentGnpsExportModel`, integrating the new view model into the existing export workflow.
Introduced a new DataTemplate for AlignmentGnpsExportViewModel, featuring an Expander that contains a CheckBox for GNPS selection. The CheckBox is bound to the IsSelected.Value property with two-way binding for user interaction.
- Introduced a new `quantTypes` array for export types, improving code readability. - Updated `peakGroup` initialization to use the `quantTypes` array. - Added `AlignmentGnpsExportModel` to `exportGroups` for GNPS export support. - Simplified `spectraGroup` initialization syntax for `ExportspectraType.deconvoluted`. - Enhanced modularity and maintainability of the code.
Removed GnpsEdgeFilePath and associated edge export functionality from AlignmentGnpsExporter. Edge export logic has been moved to AlignmentGnpsExportModel, ensuring better organization. Standardized date formatting for output file names using a DateTime variable.
# Conflicts: # src/MSDIAL5/MsdialGuiApp/Model/Lcms/LcmsMethodModel.cs # src/MSDIAL5/MsdialGuiApp/View/Export/AlignmentResultExportWin.xaml # src/MSDIAL5/MsdialGuiApp/ViewModel/Export/AlignmentResultExportViewModel.cs
There was a problem hiding this comment.
Pull Request Overview
This PR adds GNPS (Global Natural Products Social) molecular networking export functionality to MSDIAL5 and updates the target framework from .NET 6.0 to .NET 8.0 across multiple projects.
- Implements GNPS export functionality with table and MGF spectrum export capabilities
- Updates target framework from .NET 6.0 to .NET 8.0 across test projects and core libraries
- Integrates GNPS exporter into all method models (LC-MS, LC-IM-MS, IMMS, GC-MS, DIMS)
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AlignmentGnpsExporter.cs | New GNPS exporter implementation with table/MGF export and edge building functionality |
| AlignmentGnpsExportModel.cs | New model class for GNPS export configuration and execution |
| AlignmentGnpsExportViewModel.cs | New view model for GNPS export UI binding |
| AlignmentResultExportWin.xaml | Added GNPS export UI template |
| Method model files | Integrated GNPS exporter into all analytical method configurations |
| SpectraExport.cs | Enhanced MGF export with GNPS-specific metadata fields |
| Project files | Updated target framework from net6.0 to net8.0 |
| GitHub workflow | Added .NET 8.0 setup for CI/CD pipeline |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| public string Type { get; set; } | ||
| public string Score { get; set; } | ||
| public string Annotation { get; set; } | ||
| public string EdgeID { get; set; } | ||
| public string EdgeIdShort { get; set; } |
There was a problem hiding this comment.
Properties should have null-safety annotations. Consider adding nullable reference type annotations or initializing with default values to prevent potential null reference issues.
| public string Type { get; set; } | |
| public string Score { get; set; } | |
| public string Annotation { get; set; } | |
| public string EdgeID { get; set; } | |
| public string EdgeIdShort { get; set; } | |
| public string EdgeIdShort { get; set; } = string.Empty; |
|
|
||
| public sealed class GnpsEdges | ||
| { | ||
| public List<GnpsEdge> Edges { get; set; } |
There was a problem hiding this comment.
Property should have null-safety annotation. Consider using List<GnpsEdge>? or initializing with an empty list to prevent potential null reference issues.
| public List<GnpsEdge> Edges { get; set; } | |
| public List<GnpsEdge> Edges { get; set; } = new List<GnpsEdge>(); |
| //if (edges.Count > 0) { | ||
| // edges = edges.GroupBy(n => n.EdgeID).Select(g => g.First()).ToList(); | ||
| //} |
There was a problem hiding this comment.
Remove commented-out code or add a comment explaining why this code is preserved for future reference.
| //if (edges.Count > 0) { | |
| // edges = edges.GroupBy(n => n.EdgeID).Select(g => g.First()).ToList(); | |
| //} |
No description provided.