public RTPeak(MZPeak peak, double RT) { this._Intensity = peak.Intensity; this._MZ = peak.MZ; this._RT = RT; this._peak = peak; }
public void CombineLikeMZPeaks(List <MZPeak> peaks, double value) { if (peaks.Count > 0) { double currentMZ = peaks[0].MZ; double totalIntensity = peaks[0].Intensity; List <MZPeak> combinedPeaks = new List <MZPeak>(); for (int i = 1; i < peaks.Count; i++) { MZPeak currentPeak = peaks[i]; if (Math.Round(currentPeak.MZ) == Math.Round(currentMZ)) { totalIntensity += currentPeak.Intensity; } else { MZPeak newPeak = new MZPeak(Math.Round(currentMZ), totalIntensity); combinedPeaks.Add(newPeak); currentMZ = Math.Round(currentPeak.MZ); totalIntensity = currentPeak.Intensity; } } MZPeak peak = new MZPeak(currentMZ, totalIntensity); combinedPeaks.Add(peak); peaks.Clear(); peaks.AddRange(combinedPeaks); NormalizePeaksOnlyIntensities(peaks, value); } }
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); }
public Feature(MZPeak firstPeak, double RT, double HCDEnergy = 0) { this.allRTPeaks = new List <RTPeak>(); this.smoothRTPeaks = new List <RTPeak>(); this.minRT = RT; this.maxRT = RT; RTPeak newRTPeak = new RTPeak(firstPeak, RT); this.allRTPeaks.Add(newRTPeak); this.maxPeak = newRTPeak; this.totalMZTimesIntensity += (firstPeak.Intensity * firstPeak.MZ); this.totalIntensity += (firstPeak.Intensity); this.averageMZ = firstPeak.MZ; newRTPeak.HCDEnergy = HCDEnergy; }
public void AddPeak(MZPeak peak, double RT, double HCDEnergy = 0) { RTPeak newRTPeak = new RTPeak(peak, RT); this.allRTPeaks.Add(newRTPeak); if (peak.Intensity > maxPeak.Intensity) { apexTime = RT; maxPeak = newRTPeak; } this.maxRT = RT; this.totalMZTimesIntensity += (peak.Intensity * peak.MZ); this.totalIntensity += (peak.Intensity); this.averageMZ = (this.totalMZTimesIntensity / this.totalIntensity); newRTPeak.HCDEnergy = HCDEnergy; }
public static List <MZPeak> ConvertPeakListString(string peakList) { List <MZPeak> returnList = new List <MZPeak>(); string[] parts = peakList.Split(';'); foreach (var part in parts) { if (!string.IsNullOrEmpty(part)) { string[] subparts = part.Split(','); double mz = double.Parse(subparts[0]); double intensity = double.Parse(subparts[1]); var newPeak = new MZPeak(mz, intensity); returnList.Add(newPeak); } } return(returnList); }