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 39 commits into
base: master
Choose a base branch
from

Conversation

nbollis
Copy link
Member

@nbollis nbollis commented Aug 2, 2024

IsoDec is an isotopic deconvolution algorithm that will work for isotopically resolved data under ~60kDa.

It can output multiple plausible missed monoisitopic's for the same precursor. This will need to be handled in MetaMorpheus PostSearchAnalysisTask

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

Attention: Patch coverage is 9.43396% with 48 lines in your changes missing coverage. Please review.

Project coverage is 75.34%. Comparing base (a78eea2) to head (7c5132e).

Files Patch % Lines
...ometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs 0.00% 41 Missing ⚠️
...lution/Parameters/IsoDecDeconvolutionParameters.cs 0.00% 5 Missing ⚠️
...Lib/MassSpectrometry/Deconvolution/Deconvoluter.cs 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
- Coverage   75.46%   75.34%   -0.12%     
==========================================
  Files         201      203       +2     
  Lines       30814    30859      +45     
  Branches     3106     3111       +5     
==========================================
- Hits        23254    23251       -3     
- Misses       7035     7082      +47     
- Partials      525      526       +1     
Files Coverage Δ
...lution/Algorithms/ClassicDeconvolutionAlgorithm.cs 96.89% <100.00%> (-0.04%) ⬇️
...Lib/MassSpectrometry/Deconvolution/Deconvoluter.cs 90.47% <66.66%> (-9.53%) ⬇️
...lution/Parameters/IsoDecDeconvolutionParameters.cs 0.00% <0.00%> (ø)
...ometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs 0.00% <0.00%> (ø)

@trishorts
Copy link
Contributor

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

#694

[StructLayout(LayoutKind.Sequential, Pack =1)]
public struct MatchedPeak
{
public float mz;
Copy link
Contributor

Choose a reason for hiding this comment

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

would be good to use our standard variable names for these features.

foreach(MatchedPeak peak in matchedpeaks)
{
List<(double,double)> peaks = new List<(double,double)> ();
List<double> listofratios = new List<double>();
Copy link
Contributor

Choose a reason for hiding this comment

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

better variable name

@trishorts
Copy link
Contributor

What mass range and resolution will this method apply to?

@@ -14,7 +14,7 @@ namespace Development.Deconvolution
/// </remarks>
/// </summary>
[TestFixture]
[Ignore("Only needed when developing deconvolution methods")]
//[Ignore("Only needed when developing deconvolution methods")]
[ExcludeFromCodeCoverage]
Copy link
Member Author

Choose a reason for hiding this comment

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

You will need to uncoment this line in order to pass checks.

@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.
Refactored Deconvoluter.cs to use a foreach loop for yielding IsotopicEnvelopes. Reformatted multiple test methods in TestDeconvolution.cs for better readability. Added new test methods to validate Deconvolute with NeutralMassSpectrum, ensuring correct processing of spectra with various charge states and ranges.
- Changed FirstX and LastX properties in MzSpectrum to virtual.
- Included MzLibUtil namespace in NeutralMassSpectrum class.
- Updated NeutralMassSpectrum constructor to set FirstX and LastX.
- Overrode FirstX and LastX in NeutralMassSpectrum class.
- Added test NeutralMassSpectrum_MzRange to validate m/z range.
@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 15 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