Exemplo n.º 1
0
        private void AddOrdinalPoints(List <PointPairList> pplList, GraphPane panel, Color color, string pplName)
        {
            //去除所有类中最大数据数。
            var maxCount = pplList.Max(m => m.Count);

            //将其他类用missing补满。
            pplList.ForEach(m =>
            {
                while (m.Count < maxCount)
                {
                    m.Add(new PointPair()
                    {
                        Y = PointPair.Missing
                    });
                }
                ;
            });

            //分批添加数据。
            for (int i = 0; i < maxCount; i++)
            {
                PointPairList ppl = new PointPairList();
                pplList.ForEach(m => ppl.Add(m[i]));
                if (i == 0)
                {
                    panel.AddPoints(ppl, color, pplName);
                }
                else
                {
                    panel.AddPoints(ppl, color);
                }
            }
        }
        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);
            }
        }
        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);
            }
        }