Example #1
0
        public void SettingsChangeTranGroups()
        {
            SrmDocument docFasta = CreateMixedDoc();
            SrmSettings settings = docFasta.Settings;

            // Add heavy mod
            SrmDocument docFasta2 = docFasta.ChangeSettings(settings.ChangePeptideModifications(
                                                                m => m.ChangeModifications(IsotopeLabelType.heavy, new[] { new StaticMod("N-Terminal K", "K", ModTerminus.C, "H7", LabelAtoms.None, null, null) })));

            CheckNTerminalKGroups(docFasta2);
            Assert.AreEqual(docFasta.PeptideCount, docFasta2.PeptideCount);

            // Add multiple charges with heavy mod
            var newCharges = Adduct.ProtonatedFromCharges(2, 3, 4);

            settings = docFasta2.Settings;
            SrmDocument docFasta3 = docFasta2.ChangeSettings(settings.ChangeTransitionFilter(
                                                                 f => f.ChangePeptidePrecursorCharges(newCharges)));

            CheckNTerminalKGroups(docFasta3);
            Assert.AreEqual(docFasta.PeptideCount, docFasta3.PeptideCount);

            // Use charge that will cause filtering on instrument maximum m/z
            docFasta2 = docFasta.ChangeSettings(settings.ChangeTransitionFilter(
                                                    f => f.ChangePeptidePrecursorCharges(Adduct.ProtonatedFromCharges(1))));
            Assert.IsTrue(docFasta.PeptideTransitionGroupCount < docFasta2.PeptideTransitionGroupCount);
            Assert.AreEqual(docFasta.PeptideCount, docFasta2.PeptideCount);
        }
Example #2
0
        private static SrmDocument InitWiffDocument(TestFilesDir testFilesDir)
        {
            const LabelAtoms labelAtoms = LabelAtoms.C13 | LabelAtoms.N15;
            List <StaticMod> heavyMods  = new List <StaticMod>
            {
                new StaticMod("Heavy K", "K", ModTerminus.C, null, labelAtoms, null, null),
                new StaticMod("Heavy R", "R", ModTerminus.C, null, labelAtoms, null, null),
            };
            SrmSettings settings = SrmSettingsList.GetDefault();

            settings = settings.ChangePeptideModifications(mods => mods.ChangeHeavyModifications(heavyMods));
            SrmDocument doc = new SrmDocument(settings);

            IdentityPath selectPath;
            string       path = testFilesDir.GetTestPath("051309_transition list.csv");
            // Product m/z out of range
            var docError = doc;
            List <MeasuredRetentionTime>     irtPeptides;
            List <SpectrumMzInfo>            librarySpectra;
            List <TransitionImportErrorInfo> errorList;
            var inputs = new MassListInputs(path)
            {
                FormatProvider = CultureInfo.InvariantCulture,
                Separator      = TextUtil.SEPARATOR_CSV
            };

            docError.ImportMassList(inputs, null, out selectPath, out irtPeptides, out librarySpectra, out errorList);
            Assert.AreEqual(errorList.Count, 1);
            AssertEx.AreComparableStrings(TextUtil.SpaceSeparate(Resources.MassListRowReader_CalcTransitionExplanations_The_product_m_z__0__is_out_of_range_for_the_instrument_settings__in_the_peptide_sequence__1_,
                                                                 Resources.MassListRowReader_CalcPrecursorExplanations_Check_the_Instrument_tab_in_the_Transition_Settings),
                                          errorList[0].ErrorMessage,
                                          2);
            Assert.AreEqual(errorList[0].Column, 1);
            Assert.AreEqual(errorList[0].Row, 19);

            doc    = doc.ChangeSettings(settings.ChangeTransitionInstrument(inst => inst.ChangeMaxMz(1800)));
            inputs = new MassListInputs(path)
            {
                FormatProvider = CultureInfo.InvariantCulture,
                Separator      = TextUtil.SEPARATOR_CSV
            };
            doc = doc.ImportMassList(inputs, null, out selectPath);

            AssertEx.IsDocumentState(doc, 2, 9, 9, 18, 54);
            return(doc);
        }
        public PeptideDocNode GetModifiedNode(LibKey key, string seqUnmod, SrmSettings settings, SrmSettingsDiff diff)
        {
            if (string.IsNullOrEmpty(seqUnmod))
            {
                return(null);
            }

            var peptide = new Peptide(null, seqUnmod, null, null,
                                      settings.PeptideSettings.Enzyme.CountCleavagePoints(seqUnmod));

            // First try and create the match from the settings created to match the library explorer.
            Settings = HasMatches
                ? settings.ChangePeptideModifications(mods => MatcherPepMods)
                : settings;
            TransitionGroupDocNode nodeGroup;
            var nodePep = CreateDocNodeFromSettings(key.Sequence, peptide, diff, out nodeGroup);

            if (nodePep != null)
            {
                if (diff == null)
                {
                    nodePep = (PeptideDocNode)nodePep.ChangeAutoManageChildren(false);
                }
                else
                {
                    // Keep only the matching transition group, so that modifications
                    // will be highlighted differently for light and heavy forms.
                    // Only performed when getting peptides for display in the explorer.
                    nodePep = (PeptideDocNode)nodePep.ChangeChildrenChecked(
                        new DocNode[] { nodeGroup });
                }
                return(nodePep);
            }
            else if (Matches == null)
            {
                return(null);
            }
            bool hasHeavy;

            // Create explicit mods from the found matches.
            nodePep = CreateDocNodeFromMatches(new PeptideDocNode(peptide),
                                               EnumerateSequenceInfos(key.Key, true), false, out hasHeavy);

            if (nodePep == null)
            {
                return(null);
            }

            // Call change settings with the matched modification settings to enumerate the children.
            nodePep = nodePep.ChangeSettings(settings.ChangePeptideModifications(mods =>
                                                                                 !HasMatches ? settings.PeptideSettings.Modifications : MatcherPepMods), diff ?? SrmSettingsDiff.ALL);
            if (nodePep.Children.Count == 0)
            {
                return(null);
            }
            // Select the correct child, only for use with the library explorer.
            if (diff != null && nodePep.Children.Count > 1)
            {
                nodePep =
                    (PeptideDocNode)
                    nodePep.ChangeChildrenChecked(new List <DocNode> {
                    nodePep.Children[hasHeavy ? 1 : 0]
                });
            }
            if (diff == null)
            {
                nodePep = (PeptideDocNode)nodePep.ChangeAutoManageChildren(false);
            }
            return(nodePep);
        }
Example #4
0
        public ToolOptionsUI(SrmSettings settings)
        {
            InitializeComponent();
            checkBoxShowWizard.Checked = Settings.Default.ShowStartupForm;
            powerOfTenCheckBox.Checked = Settings.Default.UsePowerOfTen;
            Icon = Resources.Skyline;

            _driverServers = new SettingsListBoxDriver <Server>(listboxServers, Settings.Default.ServerList);
            _driverServers.LoadList();
            _driverRemoteAccounts = new SettingsListBoxDriver <RemoteAccount>(listBoxRemoteAccounts, Settings.Default.RemoteAccountList);
            _driverRemoteAccounts.LoadList();
            _driverColorSchemes = new SettingsListComboDriver <ColorScheme>(comboColorScheme, Settings.Default.ColorSchemes, true);
            _driverColorSchemes.LoadList(Settings.Default.CurrentColorScheme);

            var pingPep   = new Peptide(@"PING");
            var peptide   = new PeptideDocNode(pingPep);
            var precursor = new TransitionGroupDocNode(new TransitionGroup(pingPep, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light),
                                                       new TransitionDocNode[0]);

            _pingInput     = new PrositIntensityModel.PeptidePrecursorNCE(peptide, precursor, IsotopeLabelType.light, 32);
            _settingsNoMod = settings.ChangePeptideModifications(
                pm => new PeptideModifications(new StaticMod[0], new TypedModifications[0]));

            // Hide ability to turn off live reports
            //tabControl.TabPages.Remove(tabMisc);

            // Populate the languages list with the languages that Skyline has been localized to
            string defaultDisplayName = string.Format(Resources.ToolOptionsUI_ToolOptionsUI_Default___0__,
                                                      CultureUtil.GetDisplayLanguage(CultureInfo.InstalledUICulture).DisplayName);

            listBoxLanguages.Items.Add(new DisplayLanguageItem(string.Empty, defaultDisplayName));
            foreach (var culture in CultureUtil.AvailableDisplayLanguages())
            {
                listBoxLanguages.Items.Add(new DisplayLanguageItem(culture.Name, culture.DisplayName));
            }
            for (int i = 0; i < listBoxLanguages.Items.Count; i++)
            {
                var displayLanguageItem = (DisplayLanguageItem)listBoxLanguages.Items[i];
                if (Equals(displayLanguageItem.Key, Settings.Default.DisplayLanguage))
                {
                    listBoxLanguages.SelectedIndex = i;
                }
            }
            comboCompactFormatOption.Items.AddRange(CompactFormatOption.ALL_VALUES.ToArray());
            comboCompactFormatOption.SelectedItem = CompactFormatOption.FromSettings();

            var iModels = PrositIntensityModel.Models.ToList();

            iModels.Insert(0, string.Empty);
            var rtModels = PrositRetentionTimeModel.Models.ToList();

            rtModels.Insert(0, string.Empty);

            tbxPrositServer.Text = PrositConfig.GetPrositConfig().Server;
            intensityModelCombo.Items.AddRange(iModels.ToArray());
            iRTModelCombo.Items.AddRange(rtModels.ToArray());

            prositServerStatusLabel.Text = string.Empty;
            if (iModels.Contains(Settings.Default.PrositIntensityModel))
            {
                intensityModelCombo.SelectedItem = Settings.Default.PrositIntensityModel;
            }
            if (rtModels.Contains(Settings.Default.PrositRetentionTimeModel))
            {
                iRTModelCombo.SelectedItem = Settings.Default.PrositRetentionTimeModel;
            }

            ceCombo.Items.AddRange(
                Enumerable.Range(PrositConstants.MIN_NCE, PrositConstants.MAX_NCE - PrositConstants.MIN_NCE + 1).Select(c => (object)c)
                .ToArray());
            ceCombo.SelectedItem = Settings.Default.PrositNCE;
        }