public override void Update(object sender, UpdateQuantificationItemEventArgs e) { IQuantificationSummaryOption option = e.Option as IQuantificationSummaryOption; IIdentifiedResult mr = e.Item as IIdentifiedResult; string xTitle = MyConvert.Format("(Log({0}) + Log({1})) / 2", option.Func.ReferenceKey, option.Func.SampleKey); string yTitle = MyConvert.Format("Log(Ratio)"); panel.InitGraphPane(title, xTitle, yTitle, true, 0.0); try { HashSet <IIdentifiedSpectrum> spectra = new HashSet <IIdentifiedSpectrum>(); var groups = from g in mr where g[0].IsEnabled(true) && option.IsProteinRatioValid(g[0]) select g; foreach (var mpg in groups) { var peptides = from p in mpg.GetPeptides() where p.IsEnabled(true) && option.IsPeptideRatioValid(p) select p; spectra.UnionWith(peptides); } List <LSPADItem> items = new List <LSPADItem>(); foreach (var pep in spectra) { double refIntensity = Math.Log(option.Func.GetReferenceIntensity(pep)); double sampleIntensity = Math.Log(option.Func.GetSampleIntensity(pep)); double A = (refIntensity + sampleIntensity) / 2; double ratio = Math.Log(option.GetPeptideRatio(pep)); items.Add(new LSPADItem() { LogRatio = ratio, Intensity = A, Tag = pep }); } LSPADItem.CalculatePValue(items); //this.panel.DrawProbabilityRange(maxX, ratios); //this.panel.AddPoints(pplSelected, SelectedColor, "Current Peptide"); //this.panel.AddPoints(pplGroup, GroupColor, "Current Protein"); //this.panel.AddPoints(pplOutlier, OutlierColor, "Outlier"); //this.panel.AddPoints(pplNormal, NormalColor, "Other"); } finally { ZedGraphicExtension.UpdateGraph(this.zgcGraph); } }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { panel.ClearData(); var summary = e.Item as IsobaricItem; if (null != summary) { if (summary.PeakInIsolationWindow.Count > 0) { var pplWinPrecursor = new PointPairList(); foreach (var peak in summary.PeakInIsolationWindow) { if (peak.Tag > 0) { pplWinPrecursor.Add(new PointPair(peak.Mz, peak.Intensity, string.Format("{0:0.00000}", peak.Mz))); } else { pplWinPrecursor.Add(new PointPair(peak.Mz, peak.Intensity)); } } panel.AddIndividualLine("", pplWinPrecursor, Color.Black, Color.Blue); panel.Title.Text = string.Format("Isolation Window (Specifity = {0:0.00}%)", summary.PrecursorPercentage * 100); } } ZedGraphicExtension.UpdateGraph(zgcGraph); }
public ZedGraphO18Experimental_ScanPPM(ZedGraphControl zgcGraph, Graphics g) { MasterPane myMaster = ZedGraphicExtension.InitMasterPanel(zgcGraph, g, 2, "Experimental Envelopes"); updates.Updates.Add(new ZedGraphO18ExperimentalScan(zgcGraph, myMaster.PaneList[0], "")); updates.Updates.Add(new ZedGraphO18ExperimentalPPM(zgcGraph, myMaster.PaneList[1], "")); }
public ZedGraphExperimentalCorrelation(ZedGraphControl zgcGraph, GraphPane panel, string title) { this.zgcGraph = zgcGraph; this.panel = panel; panel.InitGraphPane(title, "Scan", "Cosine similarity", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public ZedGraphMRMProductIonScans(ZedGraphControl zgcGraph, GraphPane panel) { this.zgcGraph = zgcGraph; this.panel = panel; panel.InitGraphPane(null, "Retention Time", "Ion Count", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
private void zgcProtein_MouseDoubleClick(object sender, MouseEventArgs e) { var mph = ZedGraphicExtension.GetObject(sender as ZedGraphControl, e) as IIdentifiedSpectrum; if (null != mph) { ShowPeptideInfo(mph); } }
public ZedGraphMRMRegression(ZedGraphControl zgcGraph, GraphPane panel) { this.zgcGraph = zgcGraph; this.panel = panel; panel.InitGraphPane(null, "Heavy intensity", "Light intensity", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public ZedGraphScanIsolationWindow(ZedGraphControl zgcGraph, GraphPane panel) { this.zgcGraph = zgcGraph; this.panel = panel; panel.InitGraphPane("Isolation Window", "m/z", "Intensity", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public ZedGraphScanITraq(ZedGraphControl zgcGraph, GraphPane panel, bool updateGraph) { this.zgcGraph = zgcGraph; this.panel = panel; this.updateGraph = updateGraph; panel.InitGraphPane("Isobaric Tag Channels", "m/z", "Intensity", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public ZedGraphSmallMoleculeFilePeak(ZedGraphControl zgcGraph, GraphPane panel, string title, Color color) { this.zgcGraph = zgcGraph; this.panel = panel; this.color = color; panel.InitGraphPane(title, "Scan", "Intensity", true, 0.0); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { var summary = e.Item as SilacQuantificationSummaryItem; if (summary == null) { throw new ArgumentNullException("UpdateQuantificationItemEventArgs.Item cannot be null"); } var pplRed = new PointPairList(); var pplGreen = new PointPairList(); var enabled = summary.ObservedEnvelopes.FindAll(m => m.Enabled); enabled.ForEach(m => { PointPairList ppl = m.IsSelected ? pplGreen : pplRed; if (summary.SampleIsLight) { ppl.Add(new PointPair(m.HeavyIntensity, m.LightIntensity, 0.0, m)); } else { ppl.Add(new PointPair(m.LightIntensity, m.HeavyIntensity, 0.0, m)); } }); ZedGraphicExtension.ClearData(this.zgcGraph, false); AddCurve(pplGreen, SilacQuantificationConstants.REFERENCE_COLOR); AddCurve(pplRed, SilacQuantificationConstants.SAMPLE_COLOR); var pplTotal = new PointPairList(); pplTotal.AddRange(pplRed); pplTotal.AddRange(pplGreen); if (pplTotal.Count > 0) { PointPairList line = ZedGraphicExtension.GetRegressionLine(pplTotal, summary.Ratio); ZedGraphicExtension.AddDataToLine(this.zgcGraph, MyConvert.Format("Ratio = {0:0.0000}, Correlation = {1:0.0000}", summary.Ratio, summary.RegressionCorrelation), line, SilacQuantificationConstants.IDENTIFIED_COLOR, false); } ZedGraphicExtension.UpdateGraph(this.zgcGraph); }
public void Update(object sender, UpdateMRMPairedProductIonEventArgs e) { var summary = e.Item; if (summary == null) { throw new ArgumentNullException("UpdateMRMItemEventArgs.Item cannot be null"); } panel.Tag = e.Item; panel.ClearData(); try { if (summary.Heavy != null) { var pplRed = new PointPairList(); var noise = summary.DeductBaseLine ? summary.Light.Noise : 0.0; for (int i = 0; i < summary.Light.Intensities.Count; i++) { if (summary.Light.Intensities[i].Enabled) { pplRed.Add(new PointPair(summary.Heavy.Intensities[i].Intensity - noise, summary.Light.Intensities[i].Intensity - noise, 0.0, i)); } } ; if (pplRed.Count > 0) { panel.AddPoints(pplRed, Color.Red); PointPairList line = ZedGraphicExtension.GetRegressionLine(pplRed, summary.Ratio, summary.Distance); panel.AddCurve(null, line, Color.Green, SymbolType.None); panel.Title.Text = summary.GetFormula(); panel.Title.IsVisible = true; } else { panel.Title.IsVisible = false; } } } finally { ZedGraphicExtension.UpdateGraph(this.zgcGraph); } }
public void Update(object sender, UpdateMRMPairedPeptideItemEventArgs e) { MasterPane myMaster = zgcGraph.MasterPane; myMaster.Border.IsVisible = false; myMaster.PaneList.Clear(); try { myMaster.Margin.All = 1; myMaster.InnerPaneGap = 1; myMaster.Title.IsVisible = false; myMaster.Legend.IsVisible = false; var summary = e.Item; if (summary == null) { return; } for (int i = 0; i < summary.ProductIonPairs.Count; i++) { if (summary.ProductIonPairs[i] == null) { continue; } if (string.IsNullOrEmpty(FileName) || FileName.Equals(summary.ProductIonPairs[i].FileName)) { GraphPane panel = new GraphPane(); myMaster.Add(panel); ZedGraphMRMProductIonScans scan = new ZedGraphMRMProductIonScans(zgcGraph, panel); scan.Update(null, new UpdateMRMPairedProductIonEventArgs(summary.ProductIonPairs[i], e.ViewOption)); } } myMaster.SetLayout(g, PaneLayout.SquareColPreferred); zgcGraph.AxisChange(); } finally { ZedGraphicExtension.UpdateGraph(this.zgcGraph); } }
public void Update(object sender, UpdateSmallMoleculeFilePeakEventArgs e) { var peak = e.Peak; panel.ClearData(); var pplReal = new PointPairList(); var pplSmoothed = new PointPairList(); var map = data[peak]; foreach (var scan in map) { pplReal.Add(scan.Scan, scan.Intensity); pplSmoothed.Add(scan.Scan, scan.SmoothedIntensity); } if (map.Last().Scan != LastScan) { pplReal.Add(LastScan, 0.0); } panel.YAxis.Scale.MaxAuto = true; bool bSmoothed = false; foreach (var m in map) { if (m.Intensity != m.SmoothedIntensity) { bSmoothed = true; break; } } if (bSmoothed) { var line = panel.AddCurve("", pplSmoothed, Color.Blue, SymbolType.None); } panel.AddCurve("", pplReal, this.color, SymbolType.None); ZedGraphicExtension.UpdateGraph(zgcGraph); }
public void Update(object sender, UpdateMRMPairedPeptideItemEventArgs e) { MasterPane myMaster = zgcGraph.MasterPane; myMaster.Border.IsVisible = false; myMaster.PaneList.Clear(); bool updated = false; try { myMaster.Margin.All = 1; myMaster.InnerPaneGap = 1; myMaster.Title.IsVisible = false; myMaster.Legend.IsVisible = false; var summary = e.Item; if (summary == null) { return; } var ion = summary.ProductIonPairs.FirstOrDefault(m => m != null && m.FileName.Equals(FileName)); if (ion == null) { return; } ZedGraphMRMProductIonScansAndRegression scan = new ZedGraphMRMProductIonScansAndRegression(zgcGraph, g); scan.Update(null, new UpdateMRMPairedProductIonEventArgs(ion, e.ViewOption)); updated = true; } finally { if (!updated) { ZedGraphicExtension.UpdateGraph(this.zgcGraph); } } }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { var spectra = e.Item as IEnumerable <IIdentifiedSpectrum>; if (spectra == null) { throw new ArgumentException("e.Item should be IEnumerable<IIdentifiedSpectrum>"); } var validItems = (from spectrum in spectra let item = spectrum.FindIsobaricItem() where null != item select item).ToList(); zgcGraph.InitMasterPanel(g, validItems.Count, title, this.pl); for (int i = 0; i < validItems.Count; i++) { new ZedGraphScanITraq(zgcGraph, zgcGraph.MasterPane[i], false).Update(sender, new UpdateQuantificationItemEventArgs(null, validItems[i])); } ZedGraphicExtension.UpdateGraph(zgcGraph); }
public void Update(object sender, UpdateQuantificationItemEventArgs e) { panel.ClearData(); var summary = e.Item as IsobaricItem; if (null != summary) { var pplData = new PointPairList(); if (summary.RawPeaks.Count > 0) { foreach (var peak in summary.RawPeaks) { pplData.Add(new PointPair(peak.Mz, peak.Intensity)); } } else { var definitions = summary.Definition.Items; foreach (var def in definitions) { pplData.Add(new PointPair(def.Index, summary[def.Index])); } } panel.AddIndividualLine("", pplData, Color.Black); panel.XAxis.Scale.Min = summary.Definition.MinIndex - 1; panel.XAxis.Scale.Max = summary.Definition.MaxIndex + 1; panel.Title.Text = string.Format("{0},{1}", summary.Experimental, summary.Scan); } if (updateGraph) { ZedGraphicExtension.UpdateGraph(zgcGraph); } }
public void Update(object sender, UpdateMRMPairedProductIonEventArgs e) { var summary = e.Item; if (summary == null) { throw new ArgumentNullException("UpdateMRMPairedProductIonEventArgs.Item cannot be null"); } MasterPane myMaster = zgcGraph.MasterPane; myMaster.Border.IsVisible = false; myMaster.PaneList.Clear(); try { myMaster.Margin.All = 10; myMaster.InnerPaneGap = 10; // Set the master pane title myMaster.Title.Text = MyConvert.Format("{0:0.0000} - {1:0.0000}", summary.Light == null ? 0.0 : summary.Light.PrecursorMZ, summary.Heavy == null ? 0.0 : summary.Heavy.PrecursorMZ); myMaster.Title.IsVisible = true; myMaster.Legend.IsVisible = false; myMaster.Add(new GraphPane()); myMaster.Add(new GraphPane()); new ZedGraphMRMProductIonScans(zgcGraph, myMaster.PaneList[0]).Update(null, e); new ZedGraphMRMRegression(zgcGraph, myMaster.PaneList[1]).Update(null, e); myMaster.SetLayout(g, PaneLayout.SingleRow); zgcGraph.AxisChange(); } finally { ZedGraphicExtension.UpdateGraph(this.zgcGraph); } }