Exemple #1
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");
            }

            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 override void Update(object sender, UpdateQuantificationItemEventArgs e)
        {
            IExtendQuantificationSummaryOption option = e.Option as IExtendQuantificationSummaryOption;
            string xTitle = string.Format("Log({0})", option.Func.ReferenceKey);
            string yTitle = string.Format("Log({0})", option.Func.SampleKey);

            panel.InitGraphPane(title, xTitle, yTitle, true, 0.0);

            IIdentifiedProteinGroup group = e.Item as IIdentifiedProteinGroup;

            try
            {
                Dictionary <string, List <PointPairList> > pplMap = new Dictionary <string, List <PointPairList> >();

                var pplNormal   = new PointPairList();
                var pplSelected = new PointPairList();
                var pplOutlier  = new PointPairList();

                var spectra = group.GetPeptides();

                foreach (var pep in spectra)
                {
                    if (pep.IsEnabled(true) && option.IsPeptideRatioValid(pep))
                    {
                        var key = option.GetPeptideClassification(pep);

                        if (!pplMap.ContainsKey(key))
                        {
                            var lst = new List <PointPairList>();
                            pplMap[key] = lst;
                            lst.Add(new PointPairList()); //selected
                            lst.Add(new PointPairList()); //outlier
                            lst.Add(new PointPairList()); //normal
                        }

                        var ppls = pplMap[key];

                        PointPairList ppl;
                        if (pep.Selected)
                        {
                            ppl = ppls[0];
                        }
                        else if (option.IsPeptideOutlier(pep))
                        {
                            ppl = ppls[1];
                        }
                        else
                        {
                            ppl = ppls[2];
                        }

                        double refIntensity    = option.Func.GetReferenceIntensity(pep);
                        double sampleIntensity = option.Func.GetSampleIntensity(pep);
                        ppl.Add(refIntensity, sampleIntensity);
                        ppl[ppl.Count - 1].Tag = pep;

                        Debug.Assert(ppl[ppl.Count - 1].Tag == pep);
                    }
                }

                this.panel.ClearData();

                foreach (var key in pplMap.Keys)
                {
                    var ppls = pplMap[key];
                    this.panel.AddPoints(ppls[0], SelectedColor);

                    this.panel.AddPoints(ppls[1], NormalColor);

                    this.panel.AddPoints(ppls[2], OutlierColor);

                    var pplTotal = new PointPairList();
                    pplTotal.AddRange(ppls[0]);
                    pplTotal.AddRange(ppls[1]);
                    pplTotal.AddRange(ppls[2]);

                    if (pplTotal.Count > 0)
                    {
                        PointPairList line = ZedGraphicExtension.GetRegressionLine(pplTotal, option.GetProteinRatio(group[0], key));

                        var lineItem = this.panel.AddCurve(option.GetProteinRatioDescription(group[0], key), line, RegressionLineColor, SymbolType.None);
                        lineItem.Label.FontSpec = new FontSpec()
                        {
                            Size = 15, Border = new Border()
                            {
                                IsVisible = false
                            }
                        };
                    }
                }
            }
            finally
            {
                ZedGraphicExtension.UpdateGraph(this.zgcGraph);
            }
        }