Skip to content

Conversation

@trishorts
Copy link
Contributor

@trishorts trishorts commented Aug 27, 2025

This pull request introduces a fully instrumented integration layer for the external FLASHDeconv executable, adding: (1) a minimalist algorithm wrapper (FlashDeconv) that resolves the binary and executes it with robust diagnostic error handling; (2) a discovery + preflight utility (FlashDeconvLocator) to locate the executable via override path, environment variable, or conventional bundled location and optionally validate dependency loading; (3) a higher‑level FlashDeconvRunner with optional preflight, timeout and async execution support; (4) a strongly typed FlashDeconvOptions model (with nested groups) that mirrors the complete CLI surface and safely serializes to argument tokens; and (5) rich XML-style and rationale-focused inline documentation throughout clarifying both what each component does and why specific design choices were made (fail‑fast validation, separation of concerns, explicit argument emission, deferred parsing). Together these changes centralize process orchestration, improve configurability and debuggability, and establish a foundation for future result parsing without coupling core deconvolution abstractions to evolving output formats.

This code was generated by creating a local build of https://github.com/OpenMS/OpenMS version 3.4.1

A reference for this work can be found here:
Pfeuffer, J., Bielow, C., Wein, S. et al. OpenMS 3 enables reproducible analysis of large-scale mass spectrometry data, Nat Methods 21, 365–367 (2024). https://doi.org/10.1038/s41592-024-02197-7

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 integrates FLASHDeconv deconvolution functionality into mzLib by adding executable runtime support, streamlining existing deconvolution tests, and implementing comprehensive integration testing for the FLASHDeconv tool from executable usage.

Key Changes:

  • Adds FLASHDeconv executable runtime wrapper with robust options handling and error management
  • Significantly refactors and simplifies existing deconvolution tests for better maintainability
  • Adds comprehensive test coverage for FLASHDeconv integration with baseline comparison testing

Reviewed Changes

Copilot reviewed 12 out of 244 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TestDeconvolution.cs Refactored deconvolution tests with simplified variable naming and consolidated test logic
Test.csproj Added new test data files and simplified project configuration with consolidated file entries
FlashDeconvOptionsTests.cs New comprehensive test class for FLASHDeconv integration with tolerance-based comparison
FlashDeconvRunner.cs New runtime wrapper for FLASHDeconv executable with preflight validation and timeout handling
FlashDeconvOptions.cs New strongly-typed options class for FLASHDeconv command-line arguments
MassSpectrometry.csproj Added OpenMS/FLASHDeconv external runtime dependencies

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

var dp = new IsoDecDeconvolutionParameters();
var alg = new IsoDecAlgorithm(dp);
var allMasses = alg.Deconvolute(scan.MassSpectrum,
new MzRange((double)scan.MassSpectrum.FirstX!, (double)scan.MassSpectrum.LastX!)).ToList();
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The null-forgiving operators (!) are being used without null checks. Consider adding defensive null checks or documenting why these properties are guaranteed to be non-null in this context.

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +171
bool any1 = mono1.Any(m => m >= 14037.926829 - ppmwidth && m <= 14037.926829 + ppmwidth);
bool any2 = mono2.Any(m => m >= 14037.926829 - ppmwidth && m <= 14037.926829 + ppmwidth);
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The magic number 14037.926829 is repeated multiple times. Consider extracting this as a named constant like EXPECTED_MONOISOTOPIC_MASS to improve maintainability and reduce the risk of typos.

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +64
_exe = FlashDeconvLocator.FindExecutable(overridePath)
?? throw new FileNotFoundException("FLASHDeconv executable not found (env FLASHDECONV_PATH or vendored runtime).");
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The FlashDeconvLocator.FindExecutable method is referenced but not defined in the provided diff. This creates a dependency that may not be satisfied. Consider ensuring this dependency is properly implemented or document its expected interface.

Copilot uses AI. Check for mistakes.
Comment on lines +474 to +475
string input = GetValueAfter(list, "-in") ?? throw new InvalidOperationException("Missing -in in serialized args.");
string output = GetValueAfter(list, "-out") ?? throw new InvalidOperationException("Missing -out in serialized args.");
Copy link

Copilot AI Aug 28, 2025

Choose a reason for hiding this comment

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

The error messages could be more helpful by including context about what caused the serialization to fail. Consider adding information about the validation state or expected format.

Suggested change
string input = GetValueAfter(list, "-in") ?? throw new InvalidOperationException("Missing -in in serialized args.");
string output = GetValueAfter(list, "-out") ?? throw new InvalidOperationException("Missing -out in serialized args.");
string input = GetValueAfter(list, "-in") ?? throw new InvalidOperationException(
$"Missing -in in serialized args. " +
$"InputMzMlPath: '{opts.InputMzMlPath ?? "null"}'. " +
$"Argument list: [{string.Join(", ", list)}]. " +
"Expected format: -in <input file>."
);
string output = GetValueAfter(list, "-out") ?? throw new InvalidOperationException(
$"Missing -out in serialized args. " +
$"OutputMzMlPath: '{opts.OutputMzMlPath ?? "null"}'. " +
$"Argument list: [{string.Join(", ", list)}]. " +
"Expected format: -out <output file>."
);

Copilot uses AI. Check for mistakes.
@trishorts trishorts changed the title Flash deconv from executable FLASHDeconv including a complete build of OpenMS 3.4.1 Aug 28, 2025
@codecov
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 0% with 476 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.80%. Comparing base (e1b1869) to head (ac72268).

Files with missing lines Patch % Lines
...MassSpectrometry/FlashDeconv/FlashDeconvOptions.cs 0.00% 187 Missing ⚠️
.../MassSpectrometry/FlashDeconv/FlashDeconvRunner.cs 0.00% 112 Missing ⚠️
...ectrometry/Deconvolution/Algorithms/FlashDeconv.cs 0.00% 93 Missing ⚠️
...MassSpectrometry/FlashDeconv/FlashDeconvLocator.cs 0.00% 46 Missing ⚠️
mzLib/MassSpectrometry/FlashDeconv.cs 0.00% 38 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #947      +/-   ##
==========================================
- Coverage   80.94%   79.80%   -1.14%     
==========================================
  Files         265      270       +5     
  Lines       38331    38807     +476     
  Branches     4138     4208      +70     
==========================================
- Hits        31026    30969      -57     
- Misses       6607     7137     +530     
- Partials      698      701       +3     
Files with missing lines Coverage Δ
mzLib/MassSpectrometry/FlashDeconv.cs 0.00% <0.00%> (ø)
...MassSpectrometry/FlashDeconv/FlashDeconvLocator.cs 0.00% <0.00%> (ø)
...ectrometry/Deconvolution/Algorithms/FlashDeconv.cs 0.00% <0.00%> (ø)
.../MassSpectrometry/FlashDeconv/FlashDeconvRunner.cs 0.00% <0.00%> (ø)
...MassSpectrometry/FlashDeconv/FlashDeconvOptions.cs 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant