示例#1
0
        public double GetPrecusorMz(int spectrumNumber, double searchMZ, int msnOrder = 2)
        {
            int    parentScanNumber = GetParentSpectrumNumber(spectrumNumber);
            var    ms1Scan          = GetSpectrum(parentScanNumber);
            MZPeak peak             = ms1Scan.GetClosestPeak(MassRange.FromDa(searchMZ, 50));

            if (peak != null)
            {
                return(peak.MZ);
            }
            return(double.NaN);
        }
示例#2
0
        public List <MZPeak> GetPeaksFromNearestSpectrum(FeatureGroup group, ThermoRawFile rawFile)
        {
            int              scanNum     = rawFile.GetSpectrumNumber(group.ApexTime);
            List <MZPeak>    returnPeaks = new List <MZPeak>();
            ThermoSpectrum   spectrum    = rawFile.GetLabeledSpectrum(scanNum);
            HashSet <double> peakMZs     = new HashSet <double>();

            foreach (Feature feature in group.allFeatures)
            {
                MZPeak outPeak = spectrum.GetClosestPeak(MassRange.FromPPM(feature.AverageMZ, 10));
                if (outPeak != null)
                {
                    if (!peakMZs.Contains(outPeak.Intensity))
                    {
                        returnPeaks.Add(new MZPeak(feature.AverageMZ, outPeak.Intensity));
                        peakMZs.Add(outPeak.Intensity);
                    }
                }
            }
            returnPeaks = returnPeaks.OrderBy(x => x.MZ).ToList();
            return(returnPeaks);
        }