Example #1
0
        public void UseCurrentData()
        {
            DPRegressionData regressionData = GetRegressionData();

            if (regressionData == null)
            {
                return;
            }

            var regressionLine = regressionData.RegressionLine;

            if (regressionLine == null)
            {
                MessageDlg.Show(this, Resources.EditDPDlg_UseCurrentData_Insufficient_data_found_to_calculate_a_new_regression);
                return;
            }

            textSlope.Text     = string.Format(@"{0:F04}", regressionLine.Slope);
            textIntercept.Text = string.Format(@"{0:F04}", regressionLine.Intercept);
        }
Example #2
0
        private DPRegressionData GetRegressionData()
        {
            var document = Program.ActiveDocumentUI;

            if (!document.Settings.HasResults)
            {
                return(null);
            }
            if (!document.Settings.MeasuredResults.IsLoaded)
            {
                MessageBox.Show(this, Resources.EditDPDlg_GetRegressionData_Measured_results_must_be_completely_loaded_before_they_can_be_used_to_create_a_declustering_potential_regression,
                                Program.Name);
                return(null);
            }

            var regressionCurrent = _regression ??
                                    document.Settings.TransitionSettings.Prediction.DeclusteringPotential;
            var regressionData = new DPRegressionData(regressionCurrent != null ?
                                                      regressionCurrent.RegressionLine : null);
            var chromatograms = document.Settings.MeasuredResults.Chromatograms;

            for (int i = 0; i < chromatograms.Count; i++)
            {
                var chromSet   = chromatograms[i];
                var regression = chromSet.OptimizationFunction as DeclusteringPotentialRegression;
                if (regression == null)
                {
                    continue;
                }

                foreach (var nodeGroup in document.MoleculeTransitionGroups)
                {
                    regressionData.Add(regression, nodeGroup, i);
                }
            }
            return(regressionData);
        }
Example #3
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);
            }
        }