Ejemplo n.º 1
0
        public void ShowGraph()
        {
            CheckDisposed();
            CERegressionData[] arrayData = GetRegressionDatas();
            if (arrayData == null)
            {
                return;
            }

            var listGraphData = new List <RegressionGraphData>();

            for (int charge = 0; charge < arrayData.Length; charge++)
            {
                var regressionData = arrayData[charge];
                if (regressionData == null)
                {
                    continue;
                }
                listGraphData.Add(new RegressionGraphData
                {
                    Title                 = string.Format(Resources.EditCEDlg_ShowGraph_Collision_Energy_Regression_Charge__0__, charge),
                    LabelX                = Resources.EditCEDlg_ShowGraph_Precursor_m_z,
                    LabelY                = Resources.EditCEDlg_ShowGraph_Collision_Energy,
                    XValues               = regressionData.PrecursorMzValues,
                    YValues               = regressionData.BestValues,
                    RegressionLine        = regressionData.RegressionLine,
                    RegressionLineCurrent = regressionData.RegressionLineSetting
                });
            }

            using (var dlg = new GraphRegression(listGraphData))
            {
                dlg.ShowDialog(this);
            }
        }
Ejemplo n.º 2
0
        private void ShowGraph(string title, double[] xValues, double[] yValues, Dictionary <int, string> tooltips, RegressionLine line, bool xIrt)
        {
            var data = new RegressionGraphData
            {
                Title          = title,
                LabelX         = !xIrt ? Resources.CalibrateIrtDlg_ShowGraph_Measured : Resources.CalibrateIrtDlg_ShowGraph_Old_iRT,
                LabelY         = !xIrt ? Resources.CalibrateIrtDlg_ShowGraph_iRT : Resources.CalibrateIrtDlg_ShowGraph_New_iRT,
                XValues        = xValues,
                YValues        = yValues,
                Tooltips       = tooltips,
                RegressionLine = line,
            };

            using (var graph = new GraphRegression(new[] { data })
            {
                Width = 800, Height = 600
            })
            {
                graph.ShowDialog(this);
            }
        }
Ejemplo n.º 3
0
        public void ShowRegression(int rowIndex)
        {
            var row = GetRow(rowIndex);

            if (row == null)
            {
                return;
            }
            RegressionGraphData[] data;
            if (!_regressionGraphData.TryGetValue(row, out data))
            {
                return;
            }

            using (var graph = new GraphRegression(data)
            {
                Width = 800, Height = 600
            })
            {
                graph.ShowDialog(this);
            }
        }
Ejemplo n.º 4
0
        public void ShowGraph()
        {
            DPRegressionData regressionData = GetRegressionData();

            if (regressionData == null)
            {
                return;
            }
            var graphData = new RegressionGraphData
            {
                Title                 = Resources.EditDPDlg_ShowGraph_Declustering_Potential_Regression,
                LabelX                = Resources.EditDPDlg_ShowGraph_Precursor_m_z,
                LabelY                = Resources.EditDPDlg_ShowGraph_Declustering_Potential,
                XValues               = regressionData.PrecursorMzValues,
                YValues               = regressionData.BestValues,
                RegressionLine        = regressionData.RegressionLine,
                RegressionLineCurrent = regressionData.RegressionLineSetting
            };

            using (var dlg = new GraphRegression(new[] { graphData }))
            {
                dlg.ShowDialog(this);
            }
        }
Ejemplo n.º 5
0
        public void ShowGraph()
        {
            var calc = _driverCalculators.SelectedItem;

            if (calc == null)
            {
                return;
            }

            if (!calc.IsUsable)
            {
                using (var longWait = new LongWaitDlg
                {
                    Text = Resources.EditRTDlg_ShowGraph_Initializing,
                    Message = string.Format(Resources.EditRTDlg_ShowGraph_Initializing__0__calculator, calc.Name)
                })
                {
                    try
                    {
                        var status = longWait.PerformWork(this, 800, monitor =>
                        {
                            calc = Settings.Default.RTScoreCalculatorList.Initialize(monitor, calc);
                        });
                        if (status.IsError)
                        {
                            MessageBox.Show(this, status.ErrorException.Message, Program.Name);
                            return;
                        }
                    }
                    catch (Exception x)
                    {
                        var message = TextUtil.LineSeparate(string.Format(Resources.EditRTDlg_ShowGraph_An_error_occurred_attempting_to_initialize_the_calculator__0__,
                                                                          calc.Name),
                                                            x.Message);
                        MessageDlg.ShowWithException(this, message, x);
                        return;
                    }
                }
            }

            var helper = new MessageBoxHelper(this);

            double slope;

            if (!helper.ValidateDecimalTextBox(textSlope, out slope))
            {
                return;
            }

            double intercept;

            if (!helper.ValidateDecimalTextBox(textIntercept, out intercept))
            {
                return;
            }

            var scores = new List <double>();
            var times  = new List <double>();

            foreach (var measuredPeptide in Peptides)
            {
                times.Add(measuredPeptide.RetentionTime);
                double?score = calc.ScoreSequence(measuredPeptide.Target);
                scores.Add(score ?? calc.UnknownScore);
            }

            var    statScores       = new Statistics(scores);
            var    statTimes        = new Statistics(times);
            double slopeRegress     = statTimes.Slope(statScores);
            double interceptRegress = statTimes.Intercept(statScores);

            var regressionGraphData = new RegressionGraphData
            {
                Title                 = Resources.EditRTDlg_ShowGraph_Retention_Times_by_Score,
                LabelX                = calc.Name,
                LabelY                = Resources.EditRTDlg_ShowGraph_Measured_Time,
                XValues               = scores.ToArray(),
                YValues               = times.ToArray(),
                RegressionLine        = new RegressionLine(slopeRegress, interceptRegress),
                RegressionLineCurrent = new RegressionLine(slope, intercept)
            };

            using (var dlg = new GraphRegression(new[] { regressionGraphData }))
            {
                dlg.ShowDialog(this);
            }
        }