private void AddCurve(SrmTransition trans, double maxIntensity, string title, Color color) { if (trans == null || trans.Intensities == null || trans.Intensities.Count == 0) { return; } var item = trans.Intensities; var ppl = new PointPairList(); item.ForEach(m => ppl.Add(m.RetentionTime, m.Intensity * 100 / maxIntensity)); panel.AddCurve(MyConvert.Format("{0}, {1:0.00}-{2:0.00}", title, item[0].PrecursorMz, item[0].ProductMz), ppl, color, SymbolType.None); var pplCurve = new PointPairList(); bool bChecked = false; item.ForEach(envelope => { if (envelope.Enabled != bChecked) { if (pplCurve.Count > 0) { if (bChecked) { panel.AddPoly("", pplCurve, color, new[] { SilacQuantificationConstants.PLOY_COLOR }); } } pplCurve = new PointPairList(); bChecked = envelope.Enabled; } pplCurve.Add(envelope.RetentionTime, envelope.Intensity * 100 / maxIntensity); }); if (pplCurve.Count > 0) { if (bChecked) { panel.AddPoly("", pplCurve, color, new[] { SilacQuantificationConstants.PLOY_COLOR }); } } }
private void UpdateCurve() { foreach (GraphPane pane in zgcCurve.MasterPane.PaneList) { pane.ClearData(); } try { if (lvPrecursor.SelectedItems.Count == 0) { return; } GraphPane graphScans = zgcCurve.MasterPane.PaneList[0]; GraphPane graphPPM = zgcCurve.MasterPane.PaneList[1]; var pplScan = new PointPairList(); var pplPPM = new PointPairList(); var pplScanCurve = new PointPairList(); bool bChecked = false; double precursorMz = MyConvert.ToDouble(lvPrecursor.SelectedItems[0].Text); var identified = new PointPairList(); foreach (ListViewItem item in this.lvScans.Items) { if (item == null) { return; } if (item.Checked != bChecked) { if (pplScanCurve.Count > 0 && bChecked) { graphScans.AddPoly("", pplScanCurve, Color.Blue, new[] { PLOY_COLOR }); } pplScanCurve = new PointPairList(); bChecked = item.Checked; } LabelFreeItem c = (LabelFreeItem)item.Tag; pplScan.Add(new PointPair(c.Scan, c.AdjustIntensity)); pplScanCurve.Add(new PointPair(c.Scan, c.AdjustIntensity)); pplPPM.Add(new PointPair(c.Scan, c.DeltaMzPPM)); if (c.Identified) { identified.Add(new PointPair(c.Scan, c.AdjustIntensity)); } } if (pplScanCurve.Count > 0 && bChecked) { graphScans.AddPoly("", pplScanCurve, Color.Blue, new[] { PLOY_COLOR }); } graphScans.AddCurve(precursorMz.ToString(), pplScan, Color.Blue, SymbolType.None); graphPPM.AddCurve(precursorMz.ToString(), pplPPM, Color.Blue, SymbolType.None); graphScans.AddIndividualLine("Identified", identified, Color.Red); } finally { ZedGraphicExtension.UpdateGraph(this.zgcCurve); } }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { var summary = e.Item as SilacQuantificationSummaryItem; if (summary == null) { throw new ArgumentNullException("UpdateQuantificationItemEventArgs.Item cannot be null"); } double sampleMz; double referenceMz; if (summary.SampleIsLight) { sampleMz = summary.ObservedEnvelopes[0].Light[0].Mz; referenceMz = summary.ObservedEnvelopes[0].Heavy[0].Mz; } else { sampleMz = summary.ObservedEnvelopes[0].Heavy[0].Mz; referenceMz = summary.ObservedEnvelopes[0].Light[0].Mz; } panel.ClearData(); var pplSample = new PointPairList(); var pplReference = new PointPairList(); var pplSampleCurve = new PointPairList(); var pplReferenceCurve = new PointPairList(); bool bChecked = false; for (int i = 0; i < summary.ObservedEnvelopes.Count; i++) { var envelope = summary.ObservedEnvelopes[i]; if (envelope.Enabled != bChecked) { if (pplSampleCurve.Count > 0) { if (bChecked) { panel.AddPoly("", pplSampleCurve, SilacQuantificationConstants.SAMPLE_COLOR, new[] { SilacQuantificationConstants.PLOY_COLOR }); panel.AddPoly("", pplReferenceCurve, SilacQuantificationConstants.REFERENCE_COLOR, new[] { SilacQuantificationConstants.PLOY_COLOR }); } } pplSampleCurve = new PointPairList(); pplReferenceCurve = new PointPairList(); bChecked = envelope.Enabled; } if (summary.SampleIsLight) { pplSampleCurve.Add(envelope.Scan, envelope.LightIntensity); pplReferenceCurve.Add(envelope.Scan, envelope.HeavyIntensity); pplSample.Add(envelope.Scan, envelope.LightIntensity); pplReference.Add(envelope.Scan, envelope.HeavyIntensity); } else { pplSampleCurve.Add(envelope.Scan, envelope.LightIntensity); pplReferenceCurve.Add(envelope.Scan, envelope.HeavyIntensity); pplSample.Add(envelope.Scan, envelope.HeavyIntensity); pplReference.Add(envelope.Scan, envelope.LightIntensity); } } if (pplSampleCurve.Count > 0) { if (bChecked) { panel.AddPoly("", pplSampleCurve, SilacQuantificationConstants.SAMPLE_COLOR, new[] { SilacQuantificationConstants.PLOY_COLOR }); panel.AddPoly("", pplReferenceCurve, SilacQuantificationConstants.REFERENCE_COLOR, new[] { SilacQuantificationConstants.PLOY_COLOR }); } } panel.AddCurve("Sample", pplSample, SilacQuantificationConstants.SAMPLE_COLOR, SymbolType.None); panel.AddCurve("Reference", pplReference, SilacQuantificationConstants.REFERENCE_COLOR, SymbolType.None); var identified = new PointPairList(); summary.ObservedEnvelopes.FindAll(m => m.IsIdentified).ForEach(m => { identified.Add(new PointPair(m.Scan, m.LightIntensity)); identified.Add(new PointPair(m.Scan, m.HeavyIntensity)); }); panel.AddIndividualLine("Identified", identified, SilacQuantificationConstants.IDENTIFIED_COLOR); var currentScan = new PointPairList(); summary.ObservedEnvelopes.FindAll(m => m.IsSelected).ForEach(m => { currentScan.Add(new PointPair(m.Scan, Math.Max(m.LightIntensity, m.HeavyIntensity))); }); if (currentScan.Count > 0) { panel.AddIndividualLine("CurrentScan", currentScan, Color.Black); } ZedGraphicExtension.UpdateGraph(zgcGraph); }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { var summary = e.Item as O18QuantificationSummaryItem; if (summary == null) { throw new ArgumentNullException("UpdateQuantificationItemEventArgs.Item cannot be null"); } panel.ClearData(); var pplO16 = new PointPairList(); var pplO18_1 = new PointPairList(); var pplO18_2 = new PointPairList(); var pplO16Curve = new PointPairList(); var pplO18_1Curve = new PointPairList(); var pplO18_2Curve = new PointPairList(); var identified = new PointPairList(); var currentScan = new PointPairList(); bool bChecked = false; for (int i = 0; i < summary.ObservedEnvelopes.Count; i++) { var envelope = summary.ObservedEnvelopes[i]; if (envelope.Enabled != bChecked) { if (pplO16Curve.Count > 0) { if (bChecked) { panel.AddPoly("", pplO16Curve, O18QuantificationConstants.COLOR_O16, new[] { O18QuantificationConstants.COLOR_PLOY }); panel.AddPoly("", pplO18_1Curve, O18QuantificationConstants.COLOR_O18_1, new[] { O18QuantificationConstants.COLOR_PLOY }); panel.AddPoly("", pplO18_2Curve, O18QuantificationConstants.COLOR_O18_2, new[] { O18QuantificationConstants.COLOR_PLOY }); } } pplO16Curve = new PointPairList(); pplO18_1Curve = new PointPairList(); pplO18_2Curve = new PointPairList(); bChecked = envelope.Enabled; } pplO16.Add(envelope.Scan, envelope[0].Intensity); pplO18_1.Add(envelope.Scan, envelope[2].Intensity); pplO18_2.Add(envelope.Scan, envelope[4].Intensity); pplO16Curve.Add(envelope.Scan, envelope[0].Intensity); pplO18_1Curve.Add(envelope.Scan, envelope[2].Intensity); pplO18_2Curve.Add(envelope.Scan, envelope[4].Intensity); if (envelope.IsIdentified) { identified.Add(envelope.Scan, new double[] { envelope[0].Intensity, envelope[2].Intensity, envelope[4].Intensity }.Max()); } if (envelope.IsSelected) { currentScan.Add(envelope.Scan, new double[] { envelope[0].Intensity, envelope[2].Intensity, envelope[4].Intensity }.Max()); } } if (pplO16Curve.Count > 0) { if (bChecked) { panel.AddPoly("", pplO16Curve, O18QuantificationConstants.COLOR_O16, new[] { O18QuantificationConstants.COLOR_PLOY }); panel.AddPoly("", pplO18_1Curve, O18QuantificationConstants.COLOR_O18_1, new[] { O18QuantificationConstants.COLOR_PLOY }); panel.AddPoly("", pplO18_2Curve, O18QuantificationConstants.COLOR_O18_2, new[] { O18QuantificationConstants.COLOR_PLOY }); } } panel.AddCurve("O16", pplO16, O18QuantificationConstants.COLOR_O16, SymbolType.None); panel.AddCurve("O18(1)", pplO18_1, O18QuantificationConstants.COLOR_O18_1, SymbolType.None); panel.AddCurve("O18(2)", pplO18_2, O18QuantificationConstants.COLOR_O18_2, SymbolType.None); panel.AddIndividualLine("Identified", identified, O18QuantificationConstants.COLOR_IDENTIFIED); panel.AddIndividualLine("CurrentScan", currentScan, Color.Black); ZedGraphicExtension.UpdateGraph(zgcGraph); }