コード例 #1
0
        private void dataSourceFilesRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            panelFilesProps.Visible = dataSourceFilesRadioButton.Checked;

            var useFiles = dataSourceFilesRadioButton.Checked;

            ceCombo.Visible = !useFiles;
            ceLabel.Visible = !useFiles;


            if (useFiles)
            {
                iRTPeptidesLabel.Location = _iRTLabelPos;
                comboStandards.Location   = _iRTComboPos;
            }
            else
            {
                iRTPeptidesLabel.Location = _actionLabelPos;
                comboStandards.Location   = _actionComboPos;

                PrositUIHelpers.CheckPrositSettings(this, _skylineWindow);
            }

            btnNext.Text = dataSourceFilesRadioButton.Checked ? Resources.BuildLibraryDlg_btnPrevious_Click__Next__ : Resources.BuildLibraryDlg_OkWizardPage_Finish;
        }
コード例 #2
0
        private void dataSourceFilesRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            panelFilesProps.Visible = dataSourceFilesRadioButton.Checked;

            var useFiles = dataSourceFilesRadioButton.Checked;

            ceCombo.Visible = !useFiles;
            ceLabel.Visible = !useFiles;


            if (useFiles)
            {
                iRTPeptidesLabel.Location = _iRTLabelPos;
                comboStandards.Location   = _iRTComboPos;
                if (!Settings.Default.IrtStandardList.Contains(IrtStandard.AUTO))
                {
                    Settings.Default.IrtStandardList.Insert(1, IrtStandard.AUTO);
                }
            }
            else
            {
                iRTPeptidesLabel.Location = _actionLabelPos;
                comboStandards.Location   = _actionComboPos;
                Settings.Default.IrtStandardList.Remove(IrtStandard.AUTO);

                PrositUIHelpers.CheckPrositSettings(this, _skylineWindow);
            }
            _driverStandards.LoadList(IrtStandard.EMPTY.GetKey());

            btnNext.Text = dataSourceFilesRadioButton.Checked ? Resources.BuildLibraryDlg_btnPrevious_Click__Next__ : Resources.BuildLibraryDlg_OkWizardPage_Finish;
        }
コード例 #3
0
        private bool ValidateBuilder(bool validateInputFiles)
        {
            string name;

            if (!_helper.ValidateNameTextBox(textName, out name))
            {
                return(false);
            }

            string outputPath = textPath.Text;

            if (string.IsNullOrEmpty(outputPath))
            {
                _helper.ShowTextBoxError(textPath, Resources.BuildLibraryDlg_ValidateBuilder_You_must_specify_an_output_file_path, outputPath);
                return(false);
            }
            if (Directory.Exists(outputPath))
            {
                _helper.ShowTextBoxError(textPath, Resources.BuildLibraryDlg_ValidateBuilder_The_output_path__0__is_a_directory_You_must_specify_a_file_path, outputPath);
                return(false);
            }
            string outputDir = Path.GetDirectoryName(outputPath);

            if (string.IsNullOrEmpty(outputDir) || !Directory.Exists(outputDir))
            {
                _helper.ShowTextBoxError(textPath, Resources.BuildLibraryDlg_ValidateBuilder_The_directory__0__does_not_exist, outputDir);
                return(false);
            }
            if (!outputPath.EndsWith(BiblioSpecLiteSpec.EXT))
            {
                outputPath += BiblioSpecLiteSpec.EXT;
            }
            try
            {
                using (var sfLib = new FileSaver(outputPath))
                {
                    if (!sfLib.CanSave(this))
                    {
                        textPath.Focus();
                        textPath.SelectAll();
                        return(false);
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                _helper.ShowTextBoxError(textPath, TextUtil.LineSeparate(Resources.BuildLibraryDlg_ValidateBuilder_Access_violation_attempting_to_write_to__0__,
                                                                         Resources.BuildLibraryDlg_ValidateBuilder_Please_check_that_you_have_write_access_to_this_folder_), outputDir);
                return(false);
            }
            catch (IOException)
            {
                _helper.ShowTextBoxError(textPath, TextUtil.LineSeparate(Resources.BuildLibraryDlg_ValidateBuilder_Failure_attempting_to_create_a_file_in__0__,
                                                                         Resources.BuildLibraryDlg_ValidateBuilder_Please_check_that_you_have_write_access_to_this_folder_), outputDir);
                return(false);
            }

            double cutOffScore;

            if (!_helper.ValidateDecimalTextBox(textCutoff, 0, 1.0, out cutOffScore))
            {
                return(false);
            }
            Settings.Default.LibraryResultCutOff = cutOffScore;

            var libraryBuildAction = LibraryBuildAction;

            if (validateInputFiles)
            {
                var inputFilesChosen = new List <string>();
                foreach (int i in listInputFiles.CheckedIndices)
                {
                    inputFilesChosen.Add(_inputFileNames[i]);
                }

                List <Target> targetPeptidesChosen = null;
                if (cbFilter.Checked)
                {
                    targetPeptidesChosen = new List <Target>();
                    var doc = _documentUiContainer.Document;
                    foreach (PeptideDocNode nodePep in doc.Peptides)
                    {
                        // Add light modified sequences
                        targetPeptidesChosen.Add(nodePep.ModifiedTarget);
                        // Add heavy modified sequences
                        foreach (var nodeGroup in nodePep.TransitionGroups)
                        {
                            if (nodeGroup.TransitionGroup.LabelType.IsLight)
                            {
                                continue;
                            }
                            targetPeptidesChosen.Add(doc.Settings.GetModifiedSequence(nodePep.Peptide.Target,
                                                                                      nodeGroup.TransitionGroup.LabelType,
                                                                                      nodePep.ExplicitMods));
                        }
                    }
                }

                if (prositDataSourceRadioButton.Checked)
                {
                    // TODO: Need to figure out a better way to do this, use PrositPeptidePrecursorPair?
                    var doc                  = _documentUiContainer.DocumentUI;
                    var peptides             = doc.Peptides.ToArray();
                    var precursorCount       = doc.PeptideTransitionGroupCount;
                    var peptidesPerPrecursor = new PeptideDocNode[precursorCount];
                    var precursors           = new TransitionGroupDocNode[precursorCount];
                    int index                = 0;

                    for (var i = 0; i < peptides.Length; ++i)
                    {
                        var groups = peptides[i].TransitionGroups.ToArray();
                        Array.Copy(Enumerable.Repeat(peptides[i], groups.Length).ToArray(), 0, peptidesPerPrecursor, index,
                                   groups.Length);
                        Array.Copy(groups, 0, precursors, index, groups.Length);
                        index += groups.Length;
                    }

                    try
                    {
                        PrositUIHelpers.CheckPrositSettings(this, _skylineWindow);
                        // Still construct the library builder, otherwise a user might configure Prosit
                        // incorrectly, causing the build to silently fail
                        Builder = new PrositLibraryBuilder(doc, name, outputPath, () => true, IrtStandard,
                                                           peptidesPerPrecursor, precursors, NCE);
                    }
                    catch (Exception ex)
                    {
                        _helper.ShowTextBoxError(this, ex.Message);
                        return(false);
                    }
                }
                else
                {
                    Builder = new BiblioSpecLiteBuilder(name, outputPath, inputFilesChosen, targetPeptidesChosen)
                    {
                        Action = libraryBuildAction,
                        IncludeAmbiguousMatches = cbIncludeAmbiguousMatches.Checked,
                        KeepRedundant           = LibraryKeepRedundant,
                        CutOffScore             = cutOffScore,
                        Id                    = Helpers.MakeId(textName.Text),
                        IrtStandard           = _driverStandards.SelectedItem,
                        PreferEmbeddedSpectra = PreferEmbeddedSpectra
                    };
                }
            }
            return(true);
        }