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);
        }
        private void AddIonSeries(GraphPane peakPane, GraphPane ppmPane, PeakList <MatchedPeak> mgf, double mzTolerance, double minIntensity, IPeptideFragmentationBuilder <MatchedPeak> builder, string sequence, Color tagColor)
        {
            MatchedPeakUtils.Match(mgf, builder.Build(sequence), mzTolerance, minIntensity);

            var ionType     = builder.SeriesType.ToString();
            var matchedIons = (from m in mgf
                               where m.Matched && m.PeakType == builder.SeriesType
                               select m).ToList();

            var ppl = new PointPairList();

            foreach (var m in matchedIons)
            {
                ppl.Add(new PointPair(m.Mz, m.Intensity, m.Information));
            }

            peakPane.AddIndividualLine("", ppl, Color.Black, tagColor);

            if (ppmPane != null)
            {
                var diff = new PointPairList();
                foreach (var m in matchedIons)
                {
                    if (isPPM)
                    {
                        diff.Add(new PointPair(m.Mz, PrecursorUtils.mz2ppm(m.Mz, m.Mz - m.MatchedMZ)));
                    }
                    else
                    {
                        diff.Add(new PointPair(m.Mz, m.Mz - m.MatchedMZ));
                    }
                }
                ppmPane.AddPoints(diff, tagColor);
            }
        }
        private void AddUnmatchedIons(GraphPane peakPane, PeakList <MatchedPeak> mgf)
        {
            var matchedIons = (from m in mgf
                               where !m.Matched
                               select m).ToList();

            var ppl = new PointPairList();

            foreach (var m in matchedIons)
            {
                ppl.Add(new PointPair(m.Mz, m.Intensity));
            }

            peakPane.AddIndividualLine("", ppl, Color.Black);
        }
        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, 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);
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        public void Update(object sender, UpdateQuantificationItemEventArgs e)
        {
            var summary = e.Item as SilacQuantificationSummaryItem;

            if (summary == null)
            {
                throw new ArgumentNullException("UpdateQuantificationItemEventArgs.Item cannot be null");
            }

            panel.ClearData();
            try
            {
                int firstScan = summary.ObservedEnvelopes.First().Scan;
                int lastScan  = summary.ObservedEnvelopes.Last().Scan;

                var samplePPMList = summary.GetSamplePPMList();
                var refPPMList    = summary.GetReferencePPMList();

                var samplePPMs    = GetPoints(firstScan, lastScan, samplePPMList);
                var referencePPMs = GetPoints(firstScan, lastScan, refPPMList);

                panel.AddCurve("Sample", samplePPMs, SilacQuantificationConstants.SAMPLE_COLOR, SymbolType.None);
                panel.AddCurve("Reference", referencePPMs, SilacQuantificationConstants.REFERENCE_COLOR, SymbolType.None);

                var identified = new PointPairList();
                summary.ObservedEnvelopes.FindAll(m => m.IsIdentified).ForEach(m =>
                {
                    if (samplePPMList.ContainsKey(m))
                    {
                        identified.Add(new PointPair(m.Scan, samplePPMList[m]));
                    }
                    if (refPPMList.ContainsKey(m))
                    {
                        identified.Add(new PointPair(m.Scan, refPPMList[m]));
                    }
                });
                panel.AddIndividualLine("Identified", identified, SilacQuantificationConstants.IDENTIFIED_COLOR);

                var selected = new PointPairList();
                summary.ObservedEnvelopes.FindAll(m => m.IsSelected).ForEach(m =>
                {
                    if (samplePPMList.ContainsKey(m))
                    {
                        selected.Add(new PointPair(m.Scan, samplePPMList[m]));
                    }
                    if (refPPMList.ContainsKey(m))
                    {
                        selected.Add(new PointPair(m.Scan, refPPMList[m]));
                    }
                });

                if (selected.Count > 0)
                {
                    panel.AddIndividualLine("CurrentScan", selected, Color.Black);
                }

                panel.YAxis.Scale.Min = -10;
                panel.YAxis.Scale.Max = 10;
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }
Esempio n. 8
0
        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);
        }