private void ProcessBinSRM( List <ChromatogramLoadingStatus.TransitionData.Peak> bin, ref bool peaksAdded, ref float maxTime, ref float maxIntensity) { float retentionTime = bin[0].BinIndex * ChromatogramLoadingStatus.TIME_RESOLUTION; maxTime = Math.Max(maxTime, retentionTime); peaksAdded = true; foreach (var peak in bin) { // New peptide curve. if (_lastCurve == null || !ReferenceEquals(peak.ModifiedSequence, _lastCurve.ModifiedSequence)) { _lastCurve = new CurveInfo(peak.ModifiedSequence, peak.Color, retentionTime, peak.Intensity); _graphPane.CurveList.Add(_lastCurve.Curve); maxIntensity = Math.Max(maxIntensity, peak.Intensity); continue; } // Add intensity to existing peptide curve. for (int i = _lastCurve.Curve.NPts - 1; i >= 0; i--) { int binIndex = ChromatogramLoadingStatus.GetBinIndex((float)_lastCurve.Curve.Points[i].X); if (binIndex > peak.BinIndex) { if (i == 0) { _lastCurve.InsertAt(0, retentionTime, peak.Intensity); _lastCurve.CheckZeroes(0); maxIntensity = Math.Max(maxIntensity, peak.Intensity); } } else if (binIndex == peak.BinIndex) { _lastCurve.Curve.Points[i].Y += peak.Intensity; _lastCurve.CheckZeroes(i); maxIntensity = Math.Max(maxIntensity, (float)_lastCurve.Curve.Points[i].Y); break; } else { _lastCurve.InsertAt(i + 1, retentionTime, peak.Intensity); _lastCurve.CheckZeroes(i + 1); maxIntensity = Math.Max(maxIntensity, peak.Intensity); break; } } } }
private void ProcessBinSRM( List <ChromatogramLoadingStatus.TransitionData.Peak> bin, GraphInfo info) { float retentionTime = bin[0].BinIndex * ChromatogramLoadingStatus.TIME_RESOLUTION; info.MaxX = Math.Max(info.MaxX, retentionTime + ChromatogramLoadingStatus.TIME_RESOLUTION); _renderMin = Math.Min(_renderMin, retentionTime - ChromatogramLoadingStatus.TIME_RESOLUTION); _renderMax = Math.Max(_renderMax, retentionTime + ChromatogramLoadingStatus.TIME_RESOLUTION); foreach (var peak in bin) { float intensity = peak.Intensity; info.MaxY = Math.Max(info.MaxY, intensity); // New peptide curve. if (info.LastCurve == null || !ReferenceEquals(peak.ModifiedSequence, info.LastCurve.ModifiedSequence)) { info.LastCurve = new CurveInfo(peak.ModifiedSequence, peak.Color, retentionTime, intensity); info.GraphPane.CurveList.Add(info.LastCurve.Curve); continue; } // Add intensity to existing peptide curve. for (int i = info.LastCurve.Curve.NPts - 1; i >= 0; i--) { int binIndex = ChromatogramLoadingStatus.GetBinIndex((float)info.LastCurve.Curve.Points[i].X); if (binIndex > peak.BinIndex) { if (i == 0) { info.LastCurve.InsertAt(0, retentionTime, intensity); info.LastCurve.CheckZeroes(0); } } else if (binIndex == peak.BinIndex) { info.LastCurve.Curve.Points[i].Y += intensity; info.MaxY = Math.Max(info.MaxY, (float)info.LastCurve.Curve.Points[i].Y); info.LastCurve.CheckZeroes(i); break; } else { info.LastCurve.InsertAt(i + 1, retentionTime, intensity); info.LastCurve.CheckZeroes(i + 1); break; } } } }