From 2a3eaaf325a410cd40553ff5ad3eba2434cdde44 Mon Sep 17 00:00:00 2001 From: RayMSMS <150720362+RayMSMS@users.noreply.github.com> Date: Wed, 7 May 2025 12:55:48 -0500 Subject: [PATCH] Add the peak filter --- mzLib/FlashLFQ/FlashLfqEngine.cs | 4 +++- mzLib/FlashLFQ/FlashLfqParameters.cs | 2 ++ mzLib/FlashLFQ/IsoTracker/XICGroups.cs | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mzLib/FlashLFQ/FlashLfqEngine.cs b/mzLib/FlashLFQ/FlashLfqEngine.cs index ebbe66abc..1546db04c 100644 --- a/mzLib/FlashLFQ/FlashLfqEngine.cs +++ b/mzLib/FlashLFQ/FlashLfqEngine.cs @@ -125,6 +125,7 @@ public FlashLfqEngine( // IsoTracker settings bool isoTracker = false, + double acceptablePeakWidth = 0.4, // MBR settings bool matchBetweenRuns = false, @@ -157,6 +158,7 @@ public FlashLfqEngine( MaxThreads = maxThreads, Normalize = normalize, IsoTracker = isoTracker, + AcceptablePeakWidth = acceptablePeakWidth, MatchBetweenRuns = matchBetweenRuns, MaxMbrRtWindow = maxMbrWindow, MbrPpmTolerance = matchBetweenRunsPpmTolerance, @@ -1892,7 +1894,7 @@ private void QuantifyIsobaricPeaks() foreach (var peak in xICGroups.SharedPeaks) { double peakWindow = peak.Width; - if (peakWindow > 0.001) //make sure we have enough length of the window (0.001 min) for peak searching + if (peakWindow > FlashParams.AcceptablePeakWidth) //make sure we have enough length of the window (default is 0.4 min) for peak searching { List chromPeaksInSharedPeak = new List(); CollectChromPeakInRuns(peak, chromPeaksInSharedPeak, xICGroups); diff --git a/mzLib/FlashLFQ/FlashLfqParameters.cs b/mzLib/FlashLFQ/FlashLfqParameters.cs index 4a79fb9ec..bbc17d53c 100644 --- a/mzLib/FlashLFQ/FlashLfqParameters.cs +++ b/mzLib/FlashLFQ/FlashLfqParameters.cs @@ -23,6 +23,7 @@ public FlashLfqParameters() // IsoTracker settings IsoTracker = false; + AcceptablePeakWidth = 0.4; // The acceptable peak width for the isobaric peaks. This is used to determine the peak width of the isobaric peaks // MBR settings MatchBetweenRuns = false; @@ -56,6 +57,7 @@ public FlashLfqParameters() //IsoTracker settings public bool IsoTracker { get; set; } //Searching parameter for the FlashLFQ engine + public double AcceptablePeakWidth { get; set; } // MBR settings public bool MatchBetweenRuns { get; set; } diff --git a/mzLib/FlashLFQ/IsoTracker/XICGroups.cs b/mzLib/FlashLFQ/IsoTracker/XICGroups.cs index f74a14520..de3c55da0 100644 --- a/mzLib/FlashLFQ/IsoTracker/XICGroups.cs +++ b/mzLib/FlashLFQ/IsoTracker/XICGroups.cs @@ -91,7 +91,7 @@ public void FindSharedExtrema(double count_threshold, double tolerance, double c SharedExtrema = group_min.Concat(group_max).ToList(); SharedExtrema.Sort((p1, p2) => p1.RetentionTime.CompareTo(p2.RetentionTime)); // sort the shared extrema by the retention time - SharePeakTrimming(); + ExtremaTrimming(); // Just rename the function to be more readable } @@ -145,8 +145,8 @@ private List SortExtrema(List extremaList, double tolerance, /// /// Trim the shared extremas in the close time range. Ex. if the two minimums are close and the intensity is going up, remove the first one /// - /// The time range for trimming - private void SharePeakTrimming(double cutOff = 0.3) + /// The acceptable time for differentiate two extrema range for trimming + private void ExtremaTrimming(double cutOff = 0.3) { int removeIndex = 0; int count = SharedExtrema.Count(); @@ -244,6 +244,7 @@ public List BuildSharedPeaks(double windowLimit = 0.3) } // remove the peaks with the time window less than the window limit + // We already have a limit peak width for the peak region. sharedPeaks.RemoveAll(p => p.Width < windowLimit); return sharedPeaks; }