Exemplo n.º 1
0
        public void FindPeaks(double[] retentionTimes, TimeIntervals timeIntervals, ExplicitRetentionTimeInfo explicitRT)
        {
            Finder = Crawdads.NewCrawdadPeakFinder();
            Finder.SetChromatogram(Times, Intensities);
            if (timeIntervals == null)
            {
                RawPeaks = Finder.CalcPeaks(MAX_PEAKS, TimesToIndices(retentionTimes));
            }
            else
            {
                var identifiedIndices = TimesToIndices(retentionTimes);
                var allPeaks          = timeIntervals.Intervals.SelectMany(interval =>
                                                                           FindIntervalPeaks(interval.Key, interval.Value, identifiedIndices));
                RawPeaks = allPeaks.OrderByDescending(peak => Tuple.Create(peak.Identified, peak.Area))
                           .Take(MAX_PEAKS).ToArray();
            }
            // Calculate smoothing for later use in extending the Crawdad peaks
            IntensitiesSmooth = ChromatogramInfo.SavitzkyGolaySmooth(Intensities.ToArray());

            // Accept only peaks within the user-provided RT window, if any
            if (explicitRT != null)
            {
                var winLow  = (float)(explicitRT.RetentionTime - 0.5 * (explicitRT.RetentionTimeWindow ?? 0));
                var winHigh = winLow + (float)(explicitRT.RetentionTimeWindow ?? 0);
                RawPeaks = RawPeaks.Where(rp =>
                {
                    var t = Times[rp.TimeIndex];
                    return(winLow <= t && t <= winHigh);
                });
            }
        }
Exemplo n.º 2
0
 public void FindPeaks(double[] retentionTimes)
 {
     Finder = Crawdads.NewCrawdadPeakFinder();
     Finder.SetChromatogram(Times, Intensities);
     RawPeaks = Finder.CalcPeaks(MAX_PEAKS, TimesToIndices(retentionTimes));
     // Calculate smoothing for later use in extending the Crawdad peaks
     IntensitiesSmooth = ChromatogramInfo.SavitzkyGolaySmooth(Intensities.ToArray());
 }
Exemplo n.º 3
0
 public void FindPeaks(double[] retentionTimes, bool requireDocNode)
 {
     Finder = Crawdads.NewCrawdadPeakFinder();
     Finder.SetChromatogram(Times, Intensities);
     if (requireDocNode && DocNode == null)
     {
         RawPeaks = new IFoundPeak[0];
     }
     else
     {
         RawPeaks = Finder.CalcPeaks(MAX_PEAKS, TimesToIndices(retentionTimes));
         // Calculate smoothing for later use in extending the Crawdad peaks
         IntensitiesSmooth = ChromatogramInfo.SavitzkyGolaySmooth(Intensities.ToArray());
     }
 }