public PeptideFileAnalysisData SetChromatogramSet(ChromatogramSetData value) { return(new PeptideFileAnalysisData(this) { ChromatogramSet = value }); }
public PeptideFileAnalysisData SetChromatogramSet(ChromatogramSetData value) { return new PeptideFileAnalysisData(this){ChromatogramSet = value}; }
public TracerChromatograms(PeptideFileAnalysis peptideFileAnalysis, ChromatogramSetData chromatogramSet, bool smoothed) { Smoothed = smoothed; ChromatogramSet = chromatogramSet; PeptideFileAnalysis = peptideFileAnalysis; var pointDict = new Dictionary<TracerFormula, IList<double>>(); var chromatogramsDict = new Dictionary<MzKey, IList<double>>(); var turnoverCalculator = PeptideAnalysis.GetTurnoverCalculator(); double massAccuracy = PeptideAnalysis.GetMassAccuracy(); foreach (var chromatogramEntry in ChromatogramSet.Chromatograms) { if (PeptideAnalysis.ExcludedMasses.Contains(chromatogramEntry.Key.MassIndex)) { continue; } var chromatogram = chromatogramEntry.Value; var mzRange = turnoverCalculator.GetMzs(chromatogramEntry.Key.Charge)[chromatogramEntry.Key.MassIndex]; var intensities = chromatogram.ChromatogramPoints.Select(point=>point.GetIntensity(mzRange, massAccuracy)).ToArray(); if (smoothed) { intensities = SavitzkyGolaySmooth(intensities); } chromatogramsDict.Add(chromatogramEntry.Key, intensities); } int massCount = PeptideFileAnalysis.PeptideAnalysis.GetMassCount(); var times = chromatogramSet.Times.ToArray(); var scores = new List<double>(); var tracerFormulas = turnoverCalculator.ListTracerFormulas(); var theoreticalIntensities = turnoverCalculator.GetTheoreticalIntensities(tracerFormulas); for (int i = 0; i < times.Length; i++) { var intensities = new List<double>(); for (int iMass = 0; iMass < massCount; iMass++) { double intensity = 0; for (int charge = PeptideAnalysis.MinCharge; charge <= PeptideAnalysis.MaxCharge; charge++) { IList<double> chromatogram; if (chromatogramsDict.TryGetValue(new MzKey(charge, iMass), out chromatogram)) { intensity += chromatogram[i]; } else { intensity = double.NaN; } } intensities.Add(intensity); } double score; IDictionary<TracerFormula, IList<double>> predictedIntensities; PeptideAnalysis.GetTurnoverCalculator().GetTracerAmounts(intensities, out score, out predictedIntensities, tracerFormulas, theoreticalIntensities); foreach (var entry in predictedIntensities) { IList<double> list; if (!pointDict.TryGetValue(entry.Key, out list)) { list = new List<double>(); pointDict.Add(entry.Key, list); } list.Add(entry.Value.Sum()); } scores.Add(score); } var points = new SortedDictionary<TracerFormula, IList<double>>(); var peaks = new Dictionary<TracerFormula, IList<CrawdadPeak>>(); foreach (var entry in pointDict) { points.Add(entry.Key, entry.Value); CrawPeakFinderWrapper peakFinder = new CrawPeakFinderWrapper(); peakFinder.SetChromatogram(times, entry.Value); peaks.Add(entry.Key, peakFinder.CalcPeaks(MaxPeaks)); } Points = points; Scores = scores; Times = chromatogramSet.Times; RawPeaks = peaks; }