diff --git a/mzLib/MassSpectrometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs b/mzLib/MassSpectrometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs index 7d123d41..6871fee0 100644 --- a/mzLib/MassSpectrometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs +++ b/mzLib/MassSpectrometry/Deconvolution/Algorithms/IsoDecAlgorithm.cs @@ -2,18 +2,12 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Numerics; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using MassSpectrometry.MzSpectra; using MzLibUtil; -using MathNet.Numerics.Statistics; -using System.Reflection.Metadata.Ecma335; namespace MassSpectrometry { - public class IsoDecAlgorithm(IsoDecDeconvolutionParameters deconParameters) + public class IsoDecAlgorithm(DeconvolutionParameters deconParameters) : DeconvolutionAlgorithm(deconParameters) { private static string _phaseModelPath; @@ -96,7 +90,7 @@ public override IEnumerable Deconvolute(MzSpectrum spectrum, M .ToArray(); IntPtr matchedPeaksPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MatchedPeak)) * intensities.Length); - IsoSettings settings = DeconParametersToIsoSettings(deconParameters); + IsoSettings settings = DeconParametersToIsoSettings(DeconvolutionParameters as IsoDecDeconvolutionParameters); int result = process_spectrum(mzs, intensities, intensities.Length, _phaseModelPath , matchedPeaksPtr, settings); if(result > 0) { @@ -105,7 +99,7 @@ public override IEnumerable Deconvolute(MzSpectrum spectrum, M { matchedpeaks[i] = Marshal.PtrToStructure(matchedPeaksPtr + i * Marshal.SizeOf(typeof(MatchedPeak))); } - return ConvertToIsotopicEnvelopes(deconParameters, matchedpeaks, spectrum); + return ConvertToIsotopicEnvelopes(DeconvolutionParameters as IsoDecDeconvolutionParameters, matchedpeaks, spectrum); } else return new List(); diff --git a/mzLib/MassSpectrometry/Deconvolution/Parameters/IsoDecDeconvolutionParameters.cs b/mzLib/MassSpectrometry/Deconvolution/Parameters/IsoDecDeconvolutionParameters.cs index e1870b05..b2ff2dd7 100644 --- a/mzLib/MassSpectrometry/Deconvolution/Parameters/IsoDecDeconvolutionParameters.cs +++ b/mzLib/MassSpectrometry/Deconvolution/Parameters/IsoDecDeconvolutionParameters.cs @@ -9,50 +9,134 @@ namespace MassSpectrometry public class IsoDecDeconvolutionParameters : DeconvolutionParameters { public override DeconvolutionType DeconvolutionType { get; protected set; } = DeconvolutionType.IsoDecDeconvolution; + + /// + /// Precision of encoding matrix + /// public int PhaseRes { get; protected set; } = 8; + + /// + /// Verbose output + /// public int Verbose { get; protected set; } = 0; + + /// + /// Peak Detection Window + /// public int PeakWindow { get; protected set; } = 80; + + /// + /// Peak Detection Threshold + /// public float PeakThreshold { get; protected set; } = (float)0.0001; + + /// + /// Minimum Peaks for an allowed peak + /// public int MinPeaks { get; protected set; } = 3; - public float Css_Threshold { get; set; } = (float)0.7; + + /// + /// Minimum cosine similarity score for isotope distribution + /// + public float CssThreshold { get; set; } = (float)0.7; + + /// + /// Match Tolerance for peak detection in ppm + /// public float MatchTolerance { get; set; } = (float)5; + + /// + /// Maximum shift allowed for isotope distribution + /// public int MaxShift { get; protected set; } = 3; + + /// + /// MZ Window for isotope distribution + /// public float[] MzWindow { get; set; } = new float[] { (float)-1.05, (float)2.05 }; + + /// + /// Plus One Intensity range. Will be used for charge state 1 + /// public float[] PlusOneIntWindow { get; protected set; } = new float[] { (float)0.1, (float)0.6 }; + + /// + /// Number of knockdown rounds + /// public int KnockdownRounds { get; set; } = 5; + + /// + /// Minimum score difference for isotope distribution to allow missed monoisotopic peaks + /// public float MinScoreDiff { get; set; } = (float)0.1; + + /// + /// Minimum area covered by isotope distribution. Use in or with css_thresh + /// public float MinAreaCovered { get; set; } = (float)0.15; + + /// + /// Isotope Distribution Length + /// public int IsoLength { get; protected set; } = 64; + + /// + /// Mass difference between isotopes + /// public double MassDiffC { get; protected set; } = 1.0033; + + /// + /// Adduct Mass + /// public float AdductMass { get; set; } = (float)1.00727276467; + + /// + /// Use set the -1 isotope as 0 to help force better alignments + /// public int MinusOneAreasZero { get; set; } = 1; + + /// + /// Threshold for isotope distribution. Will remove relative intensities below this. + /// public float IsotopeThreshold { get; set; } = (float)0.01; + + /// + /// Threshold for data. Will remove relative intensities below this relative to max intensity in each cluster + /// public float DataThreshold { get; set; } = (float)0.05; + + /// + /// Ratio above which a secondary charge state prediction will be returned. + /// public float ZScoreThreshold { get; protected set; } = (float)0.95; + + /// + /// Report multiple monoisotopic peaks + /// public bool ReportMulitpleMonoisos { get; set; } = true; public IsoDecDeconvolutionParameters( - int phaseres = 8, - bool reportmultiplemonoisos = true, - float css_threshold = (float)0.7, - float match_tolerance = (float)5, - int maxshift = 3, - float[] mzwindow = null, - int knockdown_rounds = 5, - float min_area_covered = (float)0.20, + int phaseRes = 8, + bool reportMultipleMonoisos = true, + float cssThreshold = (float)0.7, + float matchTolerance = (float)5, + int maxShift = 3, + float[] mzWindow = null, + int knockdownRounds = 5, + float minAreaCovered = (float)0.20, float relativedatathreshold = (float)0.05) - : base(1,50,Polarity.Positive) + : base(1, 50, Polarity.Positive) { - this.PhaseRes = phaseres; - this.ReportMulitpleMonoisos = reportmultiplemonoisos; - this.Css_Threshold = css_threshold; - this.MatchTolerance = match_tolerance; - this.MaxShift = maxshift; - if (mzwindow != null) - this.MzWindow = mzwindow; + this.PhaseRes = phaseRes; + this.ReportMulitpleMonoisos = reportMultipleMonoisos; + this.CssThreshold = cssThreshold; + this.MatchTolerance = matchTolerance; + this.MaxShift = maxShift; + if (mzWindow != null) + this.MzWindow = mzWindow; else this.MzWindow = new float[] { (float)-1.05, (float)2.05 }; - this.KnockdownRounds = knockdown_rounds; - this.MinAreaCovered = min_area_covered; + this.KnockdownRounds = knockdownRounds; + this.MinAreaCovered = minAreaCovered; } } }