예제 #1
0
            private IEnumerable <GraphDataProperties> GetPropertyVariants(AreaCVGraphSettings graphSettings)
            {
                SrmDocument document;

                lock (_cacheInfo)
                {
                    document = _cacheInfo.Document;
                }

                var annotationsArray = AnnotationHelper.GetPossibleAnnotations(document, graphSettings.Group);

                // Add an entry for All
                var annotations = annotationsArray.Concat(new string[] { null }).ToList();

                var normalizationMethods = new List <NormalizeOption>(NormalizeOption.AvailableNormalizeOptions(document).Prepend(NormalizeOption.NONE));

                // First cache the histograms for the current annotation
                if (annotations.Remove(graphSettings.Annotation))
                {
                    annotations.Insert(0, graphSettings.Annotation);
                }

                foreach (var n in normalizationMethods)
                {
                    if (n.IsRatioToLabel && !document.Settings.PeptideSettings.Modifications.HasHeavyModifications)
                    {
                        continue;
                    }

                    foreach (var a in annotations)
                    {
                        var minDetections = GetMinDetectionsForAnnotation(document, graphSettings, a);

                        for (var i = 2; i <= minDetections; ++i)
                        {
                            yield return(new GraphDataProperties(graphSettings.Group, n, a, i));
                        }
                    }
                }
            }
예제 #2
0
        public override void UpdateUI()
        {
            var document = _graphSummary.DocumentUIContainer.DocumentUI;

            if (!document.Settings.HasResults)
            {
                return;
            }

            var groupsVisible = AreaGraphController.GroupByGroup != null;

            toolStripLabel1.Visible = toolStripComboGroup.Visible = groupsVisible;

            var detectionsVisiblePrev = toolStripLabel2.Visible && toolStripNumericDetections.Visible && toolStripLabel3.Visible;
            var detectionsVisible     = AreaGraphController.ShouldUseQValues(document);

            toolStripLabel2.Visible = toolStripNumericDetections.Visible = toolStripLabel3.Visible = detectionsVisible;

            if (detectionsVisible)
            {
                toolStripNumericDetections.NumericUpDownControl.Minimum = 2;

                if (AreaGraphController.GroupByGroup == null || AreaGraphController.GroupByAnnotation == null)
                {
                    toolStripNumericDetections.NumericUpDownControl.Maximum = document.MeasuredResults.Chromatograms.Count;
                }
                else
                {
                    toolStripNumericDetections.NumericUpDownControl.Maximum = AnnotationHelper.GetReplicateIndices(document, ReplicateValue.FromPersistedString(document.Settings, AreaGraphController.GroupByGroup), AreaGraphController.GroupByAnnotation).Length;
                }

                if (!detectionsVisiblePrev)
                {
                    toolStripNumericDetections.NumericUpDownControl.Value = 2;
                }
            }

            if (groupsVisible)
            {
                var annotations = new[] { Resources.GraphSummary_UpdateToolbar_All }.Concat(
                    AnnotationHelper.GetPossibleAnnotations(document,
                                                            ReplicateValue.FromPersistedString(document.Settings, AreaGraphController.GroupByGroup))
                    .Except(new object[] { null })).ToArray();

                toolStripComboGroup.Items.Clear();
                // ReSharper disable once CoVariantArrayConversion
                toolStripComboGroup.Items.AddRange(annotations);

                if (AreaGraphController.GroupByAnnotation != null)
                {
                    toolStripComboGroup.SelectedItem = AreaGraphController.GroupByAnnotation;
                }
                else
                {
                    toolStripComboGroup.SelectedIndex = 0;
                }
                ComboHelper.AutoSizeDropDown(toolStripComboGroup);
            }

            toolStripComboNormalizedTo.Items.Clear();
            _normalizationMethods.Clear();
            _normalizationMethods.Add(NormalizeOption.DEFAULT);
            _normalizationMethods.AddRange(NormalizeOption.AvailableNormalizeOptions(_graphSummary.DocumentUIContainer.DocumentUI));
            _normalizationMethods.Add(NormalizeOption.NONE);
            toolStripComboNormalizedTo.Items.AddRange(_normalizationMethods.Select(item => item.Caption).ToArray());
            toolStripComboNormalizedTo.SelectedIndex = _normalizationMethods.IndexOf(AreaGraphController.AreaCVNormalizeOption);
            ComboHelper.AutoSizeDropDown(toolStripComboNormalizedTo);
        }
예제 #3
0
        public RefineDlg(IDocumentUIContainer documentContainer)
        {
            _document         = documentContainer.DocumentUI;
            _settings         = documentContainer.DocumentUI.Settings;
            DocumentContainer = documentContainer;

            InitializeComponent();

            Icon = Resources.Skyline;

            // Save text for later use
            _removeLabelText = labelLabelType.Text;
            _removeTipText   = helpTip.GetToolTip(comboRefineLabelType);

            // Fill label type comb_o box
            comboRefineLabelType.Items.Add(string.Empty);
            comboRefineLabelType.Items.Add(IsotopeLabelType.LIGHT_NAME);
            foreach (var typedMods in _settings.PeptideSettings.Modifications.GetHeavyModifications())
            {
                comboRefineLabelType.Items.Add(typedMods.LabelType.Name);
            }
            comboRefineLabelType.SelectedIndex = 0;
            comboReplicateUse.SelectedIndex    = 0;

            if (!_settings.HasResults)
            {
                FormUtil.RemoveTabPage(tabResults, helpTip);
            }

            if (!_settings.HasResults || _settings.MeasuredResults.Chromatograms.Count < 2)
            {
                FormUtil.RemoveTabPage(tabConsistency, helpTip);
            }
            else
            {
                // Consistency tab
                textQVal.Enabled = _settings.PeptideSettings.Integration.PeakScoringModel.IsTrained;
                numericUpDownDetections.Enabled = textQVal.Enabled;
                if (numericUpDownDetections.Enabled)
                {
                    numericUpDownDetections.Minimum = 1;
                    numericUpDownDetections.Maximum = _document.MeasuredResults.Chromatograms.Count;
                    numericUpDownDetections.Value   = 1;
                }

                _normalizationMethods.Clear();
                _normalizationMethods.Add(NormalizeOption.DEFAULT);
                _normalizationMethods.AddRange(NormalizeOption.AvailableNormalizeOptions(_document));
                _normalizationMethods.Add(NormalizeOption.NONE);
                comboNormalizeTo.Items.Clear();
                comboNormalizeTo.Items.AddRange(_normalizationMethods.Select(option => option.Caption).ToArray());
                comboNormalizeTo.SelectedIndex = comboNormalizeTo.Items.Count - 1;

                comboTransitions.Items.Add(Resources.RefineDlg_RefineDlg_all);
                comboTransitions.Items.Add(Resources.RefineDlg_RefineDlg_best);
                comboTransitions.SelectedIndex = 0;

                var maxTrans = _document.MoleculeTransitionGroups.Select(g => g.TransitionCount).DefaultIfEmpty().Max();
                for (int i = 1; i <= maxTrans; i++)
                {
                    comboTransitions.Items.Add(i);
                }

                if (_document.MoleculeTransitions.Any(t => t.IsMs1))
                {
                    comboTransType.Items.Add(Resources.RefineDlg_RefineDlg_Precursors);
                    comboTransType.SelectedIndex = comboTransType.Items.Count - 1;
                }

                if (_document.MoleculeTransitions.Any(t => !t.IsMs1))
                {
                    comboTransType.Items.Add(Resources.RefineDlg_RefineDlg_Products);
                    comboTransType.SelectedIndex = comboTransType.Items.Count - 1;
                }

                if (comboTransType.Items.Count == 1)
                {
                    comboTransType.Enabled = false;
                }
            }

            if (_settings.PeptideSettings.Libraries.HasLibraries)
            {
                labelMinDotProduct.Enabled = textMinDotProduct.Enabled = groupLibCorr.Enabled = true;
            }
            if (_settings.TransitionSettings.FullScan.IsHighResPrecursor)
            {
                labelMinIdotProduct.Enabled = textMinIdotProduct.Enabled = groupLibCorr.Enabled = true;
            }

            // Group Comparisons
            _groupComparisonsListBoxDriver = new SettingsListBoxDriver <GroupComparisonDef>(
                checkedListBoxGroupComparisons, Settings.Default.GroupComparisonDefList);
            _groupComparisonsListBoxDriver.LoadList(
                _document.Settings.DataSettings.GroupComparisonDefs);

            if (_document.PeptideTransitions.Any(t => t.IsMs1))
            {
                comboMSGroupComparisons.Items.Add(Resources.RefineDlg_MSLevel_1);
                comboMSGroupComparisons.SelectedIndex = comboMSGroupComparisons.Items.Count - 1;
            }

            if (_document.PeptideTransitions.Any(t => !t.IsMs1))
            {
                comboMSGroupComparisons.Items.Add(Resources.RefineDlg_MSLevel_2);
                comboMSGroupComparisons.SelectedIndex = comboMSGroupComparisons.Items.Count - 1;
            }

            if (comboMSGroupComparisons.Items.Count == 1)
            {
                comboMSGroupComparisons.Enabled = false;
            }
        }