Пример #1
0
        public ChromPeak CalcChromPeak(CrawdadPeak peakMax, ChromPeak.FlagValues flags, out CrawdadPeak peak)
        {
            // Reintegrate all peaks to the max peak, even the max peak itself, since its boundaries may
            // have been extended from the Crawdad originals.
            if (peakMax == null)
            {
                peak = null;
                return(ChromPeak.EMPTY);
            }

            peak = CalcPeak(peakMax.StartIndex, peakMax.EndIndex);
            return(new ChromPeak(Finder, peak, flags, Times, Intensities, MassErrors10X));
        }
Пример #2
0
        public ChromPeak CalcChromPeak(IFoundPeak peakMax, ChromPeak.FlagValues flags, out IFoundPeak peak)
        {
            // Reintegrate all peaks to the max peak, even the max peak itself, since its boundaries may
            // have been extended from the Crawdad originals.
            if (peakMax == null)
            {
                peak = null;
                return(ChromPeak.EMPTY);
            }

            peak = CalcPeak(peakMax.StartIndex, peakMax.EndIndex);
            // If a forced peak is found to be sufficiently coeluting with the max peak, then clear the forced flag
            if ((flags & ChromPeak.FlagValues.forced_integration) != 0 && AreCoeluting(peakMax, peak))
            {
                flags &= ~ChromPeak.FlagValues.forced_integration;
            }
            return(new ChromPeak(Finder, peak, flags, TimeIntensities, RawTimes));
        }
Пример #3
0
        /// <summary>
        /// Returns a ChromPeak and IFoundPeak that match the start and end times a particular other IFoundPeak
        /// that was found by Crawdad.
        /// </summary>
        public Tuple <ChromPeak, IFoundPeak> IntegrateFoundPeak(IFoundPeak peakMax, ChromPeak.FlagValues flags)
        {
            Assume.IsNotNull(PeakFinder);
            var interpolatedPeak = PeakFinder.GetPeak(peakMax.StartIndex, peakMax.EndIndex);

            if ((flags & ChromPeak.FlagValues.forced_integration) != 0 && ChromData.AreCoeluting(peakMax, interpolatedPeak))
            {
                flags &= ~ChromPeak.FlagValues.forced_integration;
            }

            var chromPeak = new ChromPeak(PeakFinder, interpolatedPeak, flags, InterpolatedTimeIntensities, RawTimeIntensities?.Times);

            if (TimeIntervals != null)
            {
                chromPeak = IntegratePeakWithoutBackground(InterpolatedTimeIntensities.Times[peakMax.StartIndex], InterpolatedTimeIntensities.Times[peakMax.EndIndex], flags);
            }

            return(Tuple.Create(chromPeak, interpolatedPeak));
        }
Пример #4
0
        public ChromPeak CalcChromPeak(IFoundPeak peakMax, ChromPeak.FlagValues flags, TimeIntervals timeIntervals, out IFoundPeak peak)
        {
            // Reintegrate all peaks to the max peak, even the max peak itself, since its boundaries may
            // have been extended from the Crawdad originals.
            if (peakMax == null)
            {
                peak = null;
                return(ChromPeak.EMPTY);
            }

            var peakIntegrator = new PeakIntegrator(TimeIntensities, Finder)
            {
                RawTimeIntensities = RawTimeIntensities,
                TimeIntervals      = timeIntervals
            };
            var tuple = peakIntegrator.IntegrateFoundPeak(peakMax, flags);

            peak = tuple.Item2;
            return(tuple.Item1);
        }
Пример #5
0
        /// <summary>
        /// Return the ChromPeak with the specified start and end times chosen by a user.
        /// </summary>
        public ChromPeak IntegratePeak(float startTime, float endTime, ChromPeak.FlagValues flags)
        {
            if (TimeIntervals != null)
            {
                // For a triggered acquisition, we just use the start and end time supplied by the
                // user and Crawdad is not involved with the peak integration.
                return(IntegratePeakWithoutBackground(startTime, endTime, flags));
            }
            if (PeakFinder == null)
            {
                PeakFinder = CreatePeakFinder(InterpolatedTimeIntensities);
            }

            int startIndex = InterpolatedTimeIntensities.IndexOfNearestTime(startTime);
            int endIndex   = InterpolatedTimeIntensities.IndexOfNearestTime(endTime);

            if (startIndex == endIndex)
            {
                return(ChromPeak.EMPTY);
            }
            var foundPeak = PeakFinder.GetPeak(startIndex, endIndex);

            return(new ChromPeak(PeakFinder, foundPeak, flags, InterpolatedTimeIntensities, RawTimeIntensities?.Times));
        }
Пример #6
0
 public ChromPeak CalcChromPeak(CrawdadPeak peakMax, ChromPeak.FlagValues flags)
 {
     _chromPeak = Data.CalcChromPeak(peakMax, flags, out _crawPeak);
     return(_chromPeak);
 }
Пример #7
0
 /// <summary>
 /// Returns a ChromPeak with the specified start and end times and no background subtraction.
 /// </summary>
 private ChromPeak IntegratePeakWithoutBackground(float startTime, float endTime, ChromPeak.FlagValues flags)
 {
     if (TimeIntervals != null)
     {
         var intervalIndex = TimeIntervals.IndexOfIntervalEndingAfter(startTime);
         if (intervalIndex >= 0 && intervalIndex < TimeIntervals.Count)
         {
             startTime = Math.Max(startTime, TimeIntervals.Starts[intervalIndex]);
             endTime   = Math.Min(endTime, TimeIntervals.Ends[intervalIndex]);
         }
     }
     return(new ChromPeak(RawTimeIntensities ?? InterpolatedTimeIntensities, startTime, endTime, flags));
 }
Пример #8
0
 public ChromPeak CalcChromPeak(IFoundPeak peakMax, ChromPeak.FlagValues flags, TimeIntervals timeIntervals)
 {
     _chromPeak = Data.CalcChromPeak(peakMax, flags, timeIntervals, out _crawPeak);
     return(_chromPeak);
 }