Пример #1
0
        public virtual IsotopicProfile IterativelyFindMSFeature(XYData massSpecXyData, IsotopicProfile theorIso, out List <Peak> peakList)
        {
            if (massSpecXyData == null)
            {
                peakList = new List <Peak>();
                return(null);
            }


            IsotopicProfile iso = null;

            this.MSPeakDetector.MinX = theorIso.MonoPeakMZ - 10;
            this.MSPeakDetector.MaxX = theorIso.MonoPeakMZ + 20;


            //start with high PeakBR and rachet it down, so as to detect more peaks with each pass.  Stop when you find the isotopic profile.
            peakList = new List <Peak>();

            for (var d = PeakDetectorPeakBR; d >= PeakBRMin; d = d - PeakBRStep)
            {
                this.MSPeakDetector.PeakToBackgroundRatio = d;

                peakList = MSPeakDetector.FindPeaks(massSpecXyData.Xvalues, massSpecXyData.Yvalues);
                iso      = FindMSFeature(peakList, theorIso);

                bool isoIsGoodEnough;

                if (iso == null)
                {
                    isoIsGoodEnough = false;
                }
                else if (iso.Peaklist.Count < 2)
                {
                    isoIsGoodEnough = false;
                }
                else
                {
                    double maxIntensity     = iso.getMostIntensePeak().Height;
                    double minIntensityPeak = iso.Peaklist.Min(p => p.Height);

                    if (minIntensityPeak / maxIntensity < MinRelIntensityForPeakInclusion)
                    {
                        isoIsGoodEnough = true;
                    }
                    else
                    {
                        isoIsGoodEnough = false;
                    }
                }

                if (isoIsGoodEnough)
                {
                    break;
                }
            }

            return(iso);
        }
        // Sipper's key method. Sipper will try to pull out low level C13-related peaks. So
        // it will not stop as early as the BasicTFF, but will iterate more times to pull
        // out the smaller intensity C13-related peaks
        public override IsotopicProfile IterativelyFindMSFeature(XYData massSpecXyData, IsotopicProfile theorIso, out List <Peak> peakList)
        {
            IsotopicProfile foundIso = null;

            //start with high PeakBR and rachet it down, so as to detect more peaks with each pass.  Stop when you find the isotopic profile.

            peakList = new List <Peak>();
            for (var d = PeakDetectorPeakBR; d >= PeakBRMin; d = d - PeakBRStep)
            {
                MSPeakDetector.PeakToBackgroundRatio = d;

                peakList = MSPeakDetector.FindPeaks(massSpecXyData.Xvalues, massSpecXyData.Yvalues);
                var iso = FindMSFeature(peakList, theorIso);

                if (foundIso == null)
                {
                    foundIso = iso;
                }

                if (foundIso != null)
                {
                    double toleranceInPPM = 20;
                    combineIsotopicProfiles(foundIso, iso, toleranceInPPM);
                }

                //TODO: decide that iso is good enough when a peak is found that is less than a certain relative intensity

                var isoIsGoodEnough = (foundIso != null && foundIso.Peaklist.Count >= MaxPeaksToInclude);

                if (isoIsGoodEnough)
                {
                    break;
                }
            }


            if (foundIso != null)
            {
                AddZeroIntensityPeaks(foundIso, theorIso, 0.02d);
            }


            return(foundIso);
        }