Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsoDec Deconvolution Algorithm #791

Open
wants to merge 45 commits into
base: master
Choose a base branch
from

Conversation

nbollis
Copy link
Member

@nbollis nbollis commented Aug 2, 2024

Added Isodec to mzlib and incorporated into existing deconvolution structure. Isodec has the capability to return up to IsoDecDeconvolutionParameters.MaxShift missed monoisotopic results that pass the envelope quality thresholds if the IsoDecDeconvolutionParameters.ReportMultipleMonoisos is set to true.

Isodec Deconvolution Algorithm:

  • Introduced IsoDecAlgorithm class in mzLib/MassSpectrometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs to support a new deconvolution method

  • Added four new dlls to support isodec. They must be located in the main MassSpectrometery directory or else we run into a nightmare of nuget packing issues and dll reference mismatches when using mzlib as a nuget package

    • isodeclib.dll, isogenmass.dll, libmmd.dll, svml_dispmd.dll

Code cleanup:

  • Removed unused using directives in DeconvolutionAlgorithm.cs.
  • Removed the DeconvolutionType enum from Deconvoluter.cs and moved it to DeconvolutionType.cs
  • Ensured Deconvoluter.Deconvoluter() had a clean IEnumerable return by breaking out private method for neutral mass case and returning the IEnumerable instead of using yield return directly.

Development test case developments:

  • Updated StandardDeconvolutionTest in mzLib/Development/DeconvolutionDevelopment/StandardDeconvolutionTest.cs to include test cases for the new IsoDec deconvolution parameters and refactored the test setup to iterate over multiple deconvolution parameters.
  • Added DeconvolutionParameters property initialization in the SinglePeakDeconvolutionTestCase constructor in SinglePeakDeconvolutionTestCase.cs.
  • Renamed and updated paths in StandardDeconvolutionTest.cs and Development.csproj to reflect the new directory structure (DeconvolutionDevelopment). [1] [2]

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 97.17514% with 5 lines in your changes missing coverage. Please review.

Project coverage is 77.36%. Comparing base (dc44773) to head (b3ed84d).

Files with missing lines Patch % Lines
...ometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs 92.75% 2 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
+ Coverage   77.26%   77.36%   +0.09%     
==========================================
  Files         218      220       +2     
  Lines       33027    33187     +160     
  Branches     3426     3441      +15     
==========================================
+ Hits        25519    25674     +155     
- Misses       6938     6940       +2     
- Partials      570      573       +3     
Files with missing lines Coverage Δ
...Deconvolution/Algorithms/DeconvolutionAlgorithm.cs 100.00% <ø> (ø)
...Lib/MassSpectrometry/Deconvolution/Deconvoluter.cs 100.00% <100.00%> (ø)
...lution/Parameters/IsoDecDeconvolutionParameters.cs 100.00% <100.00%> (ø)
...Lib/MassSpectrometry/MzSpectra/IsotopicEnvelope.cs 93.18% <100.00%> (+2.00%) ⬆️
mzLib/MassSpectrometry/MzSpectra/MzSpectrum.cs 91.38% <100.00%> (+0.18%) ⬆️
...ometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs 92.75% <92.75%> (ø)

@trishorts
Copy link
Contributor

maybe we can add something for each new decon method about which of the two camps it falls into.

#694

@trishorts
Copy link
Contributor

What mass range and resolution will this method apply to?

@trishorts
Copy link
Contributor

Patch coverage will need to be >= 90%

nbollis and others added 6 commits October 11, 2024 00:16
Changed `ClassicDeconvolutionAlgorithm`, `DeconvolutionAlgorithm`, and `ExampleNewDeconvolutionAlgorithmTemplate` classes and their members from `public` to `internal` to restrict visibility within the assembly. Added summary comment to `DeconvolutionAlgorithm` class. Refactored `Deconvoluter` class to remove unnecessary `using` directives and simplify the `Deconvolute` method by removing switch-case logic. Updated `IsotopicEnvelope` class by removing `MassIndex` and `StDev` properties, and modified constructor and `ScoreIsotopeEnvelope` method accordingly. Updated `MzSpectrum` class to use `StandardDeviation` extension method from `Easy.Common.Extensions`. Removed various unnecessary `using` directives from multiple files.
- Added `InternalsVisibleTo` entries for "Development" and "Test" in `MassSpectrometry.csproj`.
- Changed `MostAbundantObservedIsotopicMass` to `internal` in `IsotopicEnvelope.cs`.
- Added a new constructor to `IsotopicEnvelope` with monoisotopic mass, intensity, and charge.
- Added XML documentation and changed `GeneratePeak` to `protected virtual` in `MzSpectrum.cs`.
- Removed unused `using` directives in `MzSpectrum.cs` and `NeutralMzSpectrum.cs`.
- Modified `NeutralMzSpectrum` constructor to validate array lengths.
- Added `Charges` property to `NeutralMzSpectrum` and initialized it in the constructor.
- Overrode `GeneratePeak` in `NeutralMzSpectrum` to convert to a charged spectrum using `Charges`.
Added necessary using directives in Deconvoluter.cs.
Modified Deconvoluter class for short-circuit deconvolution.
Removed redundant lines in Deconvoluter.cs.
Renamed NeutralMzSpectrum to NeutralMassSpectrum.
Updated constructor and references accordingly.
@nbollis nbollis changed the title Johnny Deconv 1st Step IsoDec Oct 17, 2024
@nbollis nbollis changed the title IsoDec IsoDec Deconvolution Algorithm Oct 17, 2024
jgpavek and others added 21 commits October 28, 2024 13:10
Updated IsoDecAlgorithm to use generic DeconvolutionParameters.
Enhanced IsoDecDeconvolutionParameters with new properties.
Refactored constructor to use camelCase parameter names.
Removed unused using directives from IsoDecAlgorithm.cs.
Ensured correct casting in IsoDecAlgorithm.
Renamed Css_Threshold to CssThreshold for consistency.
Updated the `MassSpectrometry` namespace in `IsoDecAlgorithm.cs` and `IsoDecDeconvolutionParameters.cs`. In `IsoDecAlgorithm.cs`, added a type check for `DeconvolutionParameters` and replaced redundant type casting with `deconParams`. In `IsoDecDeconvolutionParameters.cs`, removed unnecessary `using` directives, moved the class under the `MassSpectrometry` namespace, added user-accessible and hard-coded parameters with comments, updated the constructor to initialize new parameters, and removed the nested class declaration.
- Change `_phaseModelPath` to readonly static string to prevent modification after initial set.
- Remove `process_spectrum` method declaration from the class.
- Add `try-finally` block in `Deconvolute` to ensure `matchedPeaksPtr` memory is freed even if an exception occurs.
- Move allocation of `matchedPeaksPtr` inside `try` block to allocate only if needed.
- Invert check for `process_spectrum` result to return empty enumerable if result is <= 0.
- Reformat loop processing matched peaks for better readability.
- Ensure `Marshal.FreeHGlobal` is called in `finally` block to free `matchedPeaksPtr` if not zero.
Removed unused using directives from IsoDecAlgorithm.cs and Deconvoluter.cs.
Updated IsoSettings namespace in IsoDecAlgorithm.cs.
Simplified NUnit assertions in TestDeconvolution.cs.
Updated MassSpectrometry.csproj with HintPath and PackagePath for DLLs.
Replaced phase_model.bin with isogenmass.dll.
Incremented version number in mzLib.nuspec to 5.2.35.
Added isogenmass.dll to mzLib.nuspec for net8.0 and net8.0-windows7.0 targets.
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.

2 participants