private void TestIrts() { PrepareDocument("ImportPeptideSearch-irts.sky"); var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg); var doc = SkylineWindow.Document; RunUI(() => { Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.spectra_page); importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(new[] { GetTestPath("biognosystiny.blib") }); importPeptideSearchDlg.BuildPepSearchLibControl.IrtStandards = IrtStandard.BIOGNOSYS_11; importPeptideSearchDlg.BuildPepSearchLibControl.WorkflowType = ImportPeptideSearchDlg.Workflow.dia; }); var addIrtDlg = ShowDialog <AddIrtPeptidesDlg>(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton())); var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addIrtDlg.OkDialog); OkDialog(recalibrateDlg, recalibrateDlg.ClickNo); doc = WaitForDocumentChange(doc); RunUI(() => { Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page); importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles = new List <ImportPeptideSearch.FoundResultsFile> { new ImportPeptideSearch.FoundResultsFile(MODLESS_BASE_NAME, SearchFilesModless.First()) }; Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.transition_settings_page); Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page); Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.import_fasta_page); importPeptideSearchDlg.ImportFastaControl.SetFastaContent(GetTestPath("yeast-10.fasta")); }); var peptidesPerProteinDlg = ShowDialog <PeptidesPerProteinDlg>(importPeptideSearchDlg.ClickNextButtonNoCheck); RunUI(() => peptidesPerProteinDlg.KeepAll = true); WaitForConditionUI(() => peptidesPerProteinDlg.DocumentFinalCalculated); // The AllChromatogramsGraph will immediately show an error because the file being imported is bogus. var importResultsDlg = ShowDialog <AllChromatogramsGraph>(peptidesPerProteinDlg.OkDialog); doc = WaitForDocumentChangeLoaded(doc); WaitForConditionUI(5000, () => importResultsDlg.Finished && importResultsDlg.Files.Any(f => !string.IsNullOrEmpty(f.Error))); OkDialog(importResultsDlg, importResultsDlg.ClickClose); // The document should have the 11 Biognosys standard peptides in the first peptide group var irt = doc.PeptideGroups.First(); Assert.AreEqual(11, irt.PeptideCount); var irtMap = new TargetMap <bool>(IrtStandard.BIOGNOSYS_11.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); foreach (var nodePep in irt.Peptides) { Assert.IsTrue(irtMap.ContainsKey(nodePep.ModifiedTarget)); } RunUI(() => SkylineWindow.SaveDocument()); }
public static void SetStandards(IEnumerable <DbIrtPeptide> peptides, IEnumerable <Target> standards) { var standardMap = new TargetMap <bool>(standards.Select(target => new KeyValuePair <Target, bool>(target, true))); foreach (var pep in peptides.Where(pep => standardMap.ContainsKey(pep.ModifiedTarget))) { pep.Standard = true; } }
public void UpdateLists(List <SpectrumMzInfo> librarySpectra, List <DbIrtPeptide> dbIrtPeptides, bool rescale) { librarySpectra.AddRange(_librarySpectra); dbIrtPeptides.AddRange(_irtAdd.Select(rt => new DbIrtPeptide(rt.PeptideSequence, rt.RetentionTime, true, TimeSource.scan))); if (_irtTargets != null) { dbIrtPeptides.ForEach(pep => pep.Standard = _irtTargets.ContainsKey(pep.ModifiedTarget)); } if (rescale && Regression != null) { dbIrtPeptides.ForEach(pep => pep.Irt = Regression.GetY(pep.Irt)); } }
private bool ProcessStandard() { var standard = (IrtStandard)comboExisting.SelectedItem; if (ReferenceEquals(standard, IrtStandard.CIRT_SHORT)) { var knownIrts = new TargetMap <double>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); var matchingPeptides = _dbIrtPeptides.Where(pep => knownIrts.ContainsKey(pep.ModifiedTarget)).ToArray(); var regression = GetRegression(knownIrts, matchingPeptides, RCalcIrt.MIN_PEPTIDES_COUNT, out var graphData); if (regression != null) { var numCirts = graphData.XValues.Length; int cirtCount; using (var dlg = new AddIrtStandardsDlg(numCirts, string.Format(Resources.LibraryBuildNotificationHandler_AddIrts__0__distinct_CiRT_peptides_were_found__How_many_would_you_like_to_use_as_iRT_standards_, numCirts), graphData)) { if (dlg.ShowDialog(this) != DialogResult.OK) { return(false); } cirtCount = dlg.StandardCount; } Regression = regression; var outlierTargets = graphData.OutlierIndices.Select(idx => new Target(graphData.Tooltips[idx])).ToArray(); SetStandards(IrtPeptidePicker.Pick(cirtCount, matchingPeptides, outlierTargets)); return(true); } } var irts = new TargetMap <double>(standard.Peptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); var peptides = _dbIrtPeptides.Where(pep => irts.ContainsKey(pep.ModifiedTarget)).ToArray(); Regression = GetRegression(irts, peptides, null, out _); if (Regression != null) { SetStandards(standard.Peptides.Select(pep => pep.ModifiedTarget)); } else if (standard.HasDocument) { var missing = new TargetMap <bool>(standard.MissingFromDocument(Document).Select(target => new KeyValuePair <Target, bool>(target, true))); _irtAdd.AddRange(standard.Peptides.Where(pep => missing.ContainsKey(pep.ModifiedTarget)) .Select(pep => new MeasuredRetentionTime(pep.ModifiedTarget, pep.Irt, true, true))); Document = standard.ImportTo(Document); } return(true); }
private void comboRegression_SelectedIndexChanged(object sender, EventArgs e) { labelMinIrt.Enabled = textMinIrt.Enabled = labelMaxIrt.Enabled = textMaxIrt.Enabled = labelMinPeptide.Enabled = comboMinPeptide.Enabled = labelMaxPeptide.Enabled = comboMaxPeptide.Enabled = SelectedRegressionOption.AllowEditEquation; if (!SelectedRegressionOption.AllowEditEquation) { textMinIrt.Clear(); textMaxIrt.Clear(); comboMinPeptide.Items.Clear(); comboMaxPeptide.Items.Clear(); } lblEquation.Visible = calibrateMeasuredRt.Visible = !SelectedRegressionOption.ForcedIrts; if (IsRecalibration) { UpdateEquation(sender, e); return; } calibratePeptides.ReadOnly = calibrateMeasuredRt.ReadOnly = !SelectedRegressionOption.AllowEditGrid; gridViewCalibrate.AllowUserToAddRows = gridViewCalibrate.AllowUserToDeleteRows = SelectedRegressionOption.AllowEditGrid; if (SelectedRegressionOption.ForcedStandards) { _gridViewDriver.SetPeptides(SelectedRegressionOption.StandardPeptides.Select(pep => new StandardPeptide(pep)).ToArray()); return; } if (SelectedRegressionOption.MatchedPeptideCount == 0) // fixed point { StandardsChanged(sender, e); UpdateEquation(sender, e); return; } // If standard peptide list is empty, or contains over 50% of the selected regression's peptides, use results var regressionPeptides = new TargetMap <bool>(SelectedRegressionOption.MatchedRegressionPeptides.Select(match => new KeyValuePair <Target, bool>(match.Item1.ModifiedTarget, true))); if (StandardPeptideCount == 0 || StandardPeptideList.Count(pep => regressionPeptides.ContainsKey(pep.Target)) >= regressionPeptides.Count / 2) { if (!SetCalibrationPeptides()) { comboRegression.SelectedIndex = 0; return; } } UpdateEquation(sender, e); }
private void CirtLibraryBuildTest() { RunUI(() => { SkylineWindow.NewDocument(true); SkylineWindow.ModifyDocument("Set default settings", doc => doc.ChangeSettings(SrmSettingsList.GetDefault())); }); var peptideSettingsDlg = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); // build a library with CiRT peptides BuildLibrary(TestFilesDir.GetTestPath("maxquant_cirt"), null, null, false, true, false, false, IrtStandard.CIRT_SHORT); var addIrtStandardsDlg = WaitForOpenForm <AddIrtStandardsDlg>(); // use 15 CiRT peptides as standards const int numStandards = 15; RunUI(() => addIrtStandardsDlg.StandardCount = numStandards); var addIrtPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(addIrtStandardsDlg.OkDialog); // don't recalibrate; add RT predictor var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addIrtPeptidesDlg.OkDialog); var addRetentionTimePredictorDlg = ShowDialog <AddRetentionTimePredictorDlg>(recalibrateDlg.ClickNo); OkDialog(addRetentionTimePredictorDlg, addRetentionTimePredictorDlg.OkDialog); // verify that there are 15 CiRT peptides as standards in the calculator var editIrtCalcDlg = ShowDialog <EditIrtCalcDlg>(peptideSettingsDlg.EditCalculator); var cirtPeptides = new TargetMap <bool>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); RunUI(() => { Assert.AreEqual(numStandards, editIrtCalcDlg.StandardPeptideCount); Assert.IsTrue(editIrtCalcDlg.StandardPeptides.All(pep => cirtPeptides.ContainsKey(pep.ModifiedTarget))); }); OkDialog(editIrtCalcDlg, editIrtCalcDlg.CancelDialog); OkDialog(peptideSettingsDlg, peptideSettingsDlg.CancelDialog); RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath("cirt_test.sky"))); }
public void ScorePeptides(SrmDocument doc, IProgressMonitor progressMonitor) { var model = doc.Settings.PeptideSettings.Integration.PeakScoringModel; if (model == null || !model.IsTrained) { model = LegacyScoringModel.DEFAULT_MODEL; } var mProphetResultsHandler = new MProphetResultsHandler(doc, model); mProphetResultsHandler.ScoreFeatures(progressMonitor, true); if (progressMonitor.IsCanceled) { return; } var scoredPeptidesDict = new Dictionary <Target, ScoredPeptide>(); foreach (var nodePep in doc.Molecules.Where(pep => pep.PercentileMeasuredRetentionTime.HasValue && !pep.IsDecoy)) { var allStats = doc.MeasuredResults.MSDataFileInfos .Select(info => mProphetResultsHandler.GetPeakFeatureStatistics(nodePep.Id.GlobalIndex, info.FileId.GlobalIndex)) .Where(stats => stats != null).ToArray(); var value = float.MaxValue; if (allStats.Length > 0) { value = model is MProphetPeakScoringModel ? allStats.Select(stats => stats.QValue.Value).Max() : -allStats.Select(stats => stats.BestScore).Min(); } if (!scoredPeptidesDict.TryGetValue(nodePep.ModifiedTarget, out var existing) || value < existing.Score) { scoredPeptidesDict[nodePep.ModifiedTarget] = new ScoredPeptide( new MeasuredPeptide(doc.Settings.GetModifiedSequence(nodePep), nodePep.PercentileMeasuredRetentionTime.Value), nodePep, value); } } _scoredPeptides = scoredPeptidesDict.Values.OrderBy(pep => pep.Peptide.RetentionTime).ToArray(); _cirtPeptides = _scoredPeptides.Where(pep => _cirtAll.ContainsKey(pep.Peptide.Target)).ToArray(); }
private static void AddRetentionTimesToDict(IRetentionTimeProvider retentionTimes, IRegressionFunction regressionLine, IDictionary <Target, IrtPeptideAverages> dictPeptideAverages, IEnumerable <DbIrtPeptide> standardPeptideList) { var setStandards = new TargetMap <bool>(standardPeptideList.Select(peptide => new KeyValuePair <Target, bool>(peptide.Target, true))); foreach (var pepTime in retentionTimes.PeptideRetentionTimes.Where(p => !setStandards.ContainsKey(p.PeptideSequence))) { var peptideModSeq = pepTime.PeptideSequence; var timeSource = retentionTimes.GetTimeSource(peptideModSeq); var irt = regressionLine.GetY(pepTime.RetentionTime); if (!dictPeptideAverages.TryGetValue(peptideModSeq, out var pepAverage)) { dictPeptideAverages.Add(peptideModSeq, new IrtPeptideAverages(peptideModSeq, irt, timeSource)); } else { pepAverage.AddIrt(irt); } } }
public ChangeIrtPeptidesDlg(SrmDocument document, IList <DbIrtPeptide> irtPeptides) { TargetResolver = new TargetResolver(irtPeptides.Select(p => p.Target)); _dictSequenceToPeptide = new TargetMap <DbIrtPeptide>(irtPeptides.Select(pep => new KeyValuePair <Target, DbIrtPeptide>(pep.ModifiedTarget, pep))); _document = document; _picker = new IrtPeptidePicker(); InitializeComponent(); comboProteins.Items.Add(new ComboBoxProtein(null)); comboProteins.Items.AddRange(document.MoleculeGroups.Select(protein => new ComboBoxProtein(protein)) .Where(protein => protein.PeptideStrings(TargetResolver).Any()).ToArray()); comboProteins.SelectedIndex = 0; if (comboProteins.Items.Count == 1) { comboProteins.Enabled = false; } Peptides = irtPeptides.Where(peptide => peptide.Standard).ToArray(); // Find and select matching protein for (var i = 1; i < comboProteins.Items.Count; i++) { var item = (ComboBoxProtein)comboProteins.Items[i]; if (item.Protein.PeptideCount != PeptideLines.Length) { continue; } var targets = new TargetMap <bool>(((ComboBoxProtein)comboProteins.Items[i]).Protein.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); if (PeptideLines.All(line => targets.ContainsKey(new Target(line)))) { comboProteins.SelectedIndex = i; break; } } }
public static IEnumerable <Target> Pick(int count, DbIrtPeptide[] peptides, IEnumerable <Target> outliers) { var targets = new TargetMap <List <DbIrtPeptide> >(peptides.Select(pep => new KeyValuePair <Target, List <DbIrtPeptide> >(pep.ModifiedTarget, new List <DbIrtPeptide>()))); foreach (var pep in peptides) { targets[pep.ModifiedTarget].Add(pep); } var distinctPeps = new List <DbIrtPeptide>(); foreach (var list in targets.Values) { if (list.Count == 0) { continue; } var median = new Statistics(list.Select(pep => pep.Irt)).Median(); DbIrtPeptide best = null; var minDiff = double.MaxValue; foreach (var pep in list) { var diff = Math.Abs(pep.Irt - median); if (diff < minDiff) { minDiff = diff; best = pep; } } distinctPeps.Add(best); } var outlierMap = new TargetMap <bool>(outliers.Select(target => new KeyValuePair <Target, bool>(target, true))); if (distinctPeps.Count(pep => !outlierMap.ContainsKey(pep.ModifiedTarget)) >= count) { // don't use outliers if we have enough other values distinctPeps.RemoveAll(pep => outlierMap.ContainsKey(pep.ModifiedTarget)); } distinctPeps.Sort((x, y) => x.Irt.CompareTo(y.Irt)); var minIrt = distinctPeps.First().Irt; var maxIrt = distinctPeps.Last().Irt; var gradientLength = maxIrt - minIrt; for (var i = 0; i < count; i++) { var targetRt = minIrt + i * (gradientLength / (count - 1)); for (var j = 0; j < distinctPeps.Count; j++) { if (j + 1 > distinctPeps.Count - 1 || Math.Abs(distinctPeps[j].Irt - targetRt) < Math.Abs(distinctPeps[j + 1].Irt - targetRt)) { yield return(distinctPeps[j].ModifiedTarget); distinctPeps.RemoveAt(j); break; } } } }
public static List <IrtStandard> BestMatch(IEnumerable <Target> targets) { var targetMap = new TargetMap <bool>(targets.Select(t => new KeyValuePair <Target, bool>(t, true))); var matches = ALL.Where(s => s.Peptides.Count > 0 && s.Peptides.All(pep => targetMap.ContainsKey(pep.ModifiedTarget))).ToList(); if (matches.Contains(BIOGNOSYS_10) && matches.Contains(BIOGNOSYS_11)) { matches.Remove(BIOGNOSYS_10); } return(matches); }
public IEnumerable <Target> MissingFromDocument(SrmDocument document) { var found = new TargetMap <bool>(FindInDocument(document).Select(nodePep => new KeyValuePair <Target, bool>(nodePep.ModifiedTarget, true))); return(Peptides.Where(pep => !found.ContainsKey(pep.ModifiedTarget)).Select(pep => pep.ModifiedTarget)); }
public bool ImportFasta(IrtStandard irtStandard) { var settings = DocumentContainer.Document.Settings; var peptideSettings = settings.PeptideSettings; int missedCleavages = MaxMissedCleavages; var enzyme = Enzyme; if (!Equals(missedCleavages, peptideSettings.DigestSettings.MaxMissedCleavages) || !Equals(enzyme, peptideSettings.Enzyme)) { var digest = new DigestSettings(missedCleavages, peptideSettings.DigestSettings.ExcludeRaggedEnds); peptideSettings = peptideSettings.ChangeDigestSettings(digest).ChangeEnzyme(enzyme); DocumentContainer.ModifyDocumentNoUndo(doc => doc.ChangeSettings(settings.ChangePeptideSettings(peptideSettings))); } if (!string.IsNullOrEmpty(DecoyGenerationMethod)) { if (!NumDecoys.HasValue || NumDecoys <= 0) { MessageDlg.Show(WizardForm, Resources.ImportFastaControl_ImportFasta_Please_enter_a_valid_number_of_decoys_per_target_greater_than_0_); txtNumDecoys.Focus(); return(false); } else if (Equals(DecoyGenerationMethod, DecoyGeneration.REVERSE_SEQUENCE) && NumDecoys > 1) { MessageDlg.Show(WizardForm, Resources.ImportFastaControl_ImportFasta_A_maximum_of_one_decoy_per_target_may_be_generated_when_using_reversed_decoys_); txtNumDecoys.Focus(); return(false); } } if (!ContainsFastaContent) // The user didn't specify any FASTA content { var docCurrent = DocumentContainer.Document; // If the document has precursor transitions already, then just trust the user // knows what they are doing, and this document is already set up for MS1 filtering if (HasPrecursorTransitions(docCurrent)) { return(true); } if (docCurrent.PeptideCount == 0) { MessageDlg.Show(WizardForm, TextUtil.LineSeparate(Resources.ImportFastaControl_ImportFasta_The_document_does_not_contain_any_peptides_, Resources.ImportFastaControl_ImportFasta_Please_import_FASTA_to_add_peptides_to_the_document_)); return(false); } if (MessageBox.Show(WizardForm, TextUtil.LineSeparate(Resources.ImportFastaControl_ImportFasta_The_document_does_not_contain_any_precursor_transitions_, Resources.ImportFastaControl_ImportFasta_Would_you_like_to_change_the_document_settings_to_automatically_pick_the_precursor_transitions_specified_in_the_full_scan_settings_), Program.Name, MessageBoxButtons.OKCancel) != DialogResult.OK) { return(false); } DocumentContainer.ModifyDocumentNoUndo(doc => ImportPeptideSearch.ChangeAutoManageChildren(doc, PickLevel.transitions, true)); } else // The user specified some FASTA content { // If the user is about to add any new transitions by importing // FASTA, set FragmentType='p' and AutoSelect=true var docCurrent = DocumentContainer.Document; var docNew = ImportPeptideSearch.PrepareImportFasta(docCurrent); var nodeInsert = _sequenceTree.SelectedNode as SrmTreeNode; IdentityPath selectedPath = nodeInsert != null ? nodeInsert.Path : null; var newPeptideGroups = new List <PeptideGroupDocNode>(); if (!_fastaFile) { FastaText = tbxFasta.Text; PasteError error = null; // Import FASTA as content using (var longWaitDlg = new LongWaitDlg(DocumentContainer) { Text = Resources.ImportFastaControl_ImportFasta_Insert_FASTA }) { var docImportFasta = docNew; longWaitDlg.PerformWork(WizardForm, 1000, longWaitBroker => { docImportFasta = ImportFastaHelper.AddFasta(docImportFasta, longWaitBroker, ref selectedPath, out newPeptideGroups, out error); }); docNew = docImportFasta; } // Document will be null if there was an error if (docNew == null) { ImportFastaHelper.ShowFastaError(error); return(false); } } else { // Import FASTA as file var fastaPath = tbxFasta.Text; try { using (var longWaitDlg = new LongWaitDlg(DocumentContainer) { Text = Resources.ImportFastaControl_ImportFasta_Insert_FASTA }) { IdentityPath to = selectedPath; var docImportFasta = docNew; longWaitDlg.PerformWork(WizardForm, 1000, longWaitBroker => { IdentityPath nextAdd; docImportFasta = ImportPeptideSearch.ImportFasta(docImportFasta, fastaPath, longWaitBroker, to, out selectedPath, out nextAdd, out newPeptideGroups); }); docNew = docImportFasta; } } catch (Exception x) { MessageDlg.ShowWithException(this, string.Format(Resources.SkylineWindow_ImportFastaFile_Failed_reading_the_file__0__1__, fastaPath, x.Message), x); return(false); } } if (!newPeptideGroups.Any()) { MessageDlg.Show(this, Resources.ImportFastaControl_ImportFasta_Importing_the_FASTA_did_not_create_any_target_proteins_); return(false); } // Filter proteins based on number of peptides and add decoys using (var dlg = new PeptidesPerProteinDlg(docNew, newPeptideGroups, DecoyGenerationMethod, NumDecoys ?? 0)) { docNew = dlg.ShowDialog(WizardForm) == DialogResult.OK ? dlg.DocumentFinal : null; } // Document will be null if user was given option to keep or remove empty proteins and pressed cancel if (docNew == null) { return(false); } // Add iRT standards if not present if (irtStandard != null && !irtStandard.Name.Equals(IrtStandard.EMPTY.Name)) { using (var reader = irtStandard.GetDocumentReader()) { if (reader != null) { var standardMap = new TargetMap <bool>(irtStandard.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); var docStandards = new TargetMap <bool>(docNew.Peptides .Where(nodePep => standardMap.ContainsKey(nodePep.ModifiedTarget)).Select(nodePep => new KeyValuePair <Target, bool>(nodePep.ModifiedTarget, true))); if (irtStandard.Peptides.Any(pep => !docStandards.ContainsKey(pep.ModifiedTarget))) { docNew = docNew.ImportDocumentXml(reader, string.Empty, Model.Results.MeasuredResults.MergeAction.remove, false, null, Settings.Default.StaticModList, Settings.Default.HeavyModList, new IdentityPath(docNew.Children.First().Id), out _, out _, false); } } } } if (AutoTrain) { if (!docNew.Peptides.Any(pep => pep.IsDecoy)) { MessageDlg.Show(this, Resources.ImportFastaControl_ImportFasta_Cannot_automatically_train_mProphet_model_without_decoys__but_decoy_options_resulted_in_no_decoys_being_generated__Please_increase_number_of_decoys_per_target__or_disable_automatic_training_of_mProphet_model_); return(false); } docNew = docNew.ChangeSettings(docNew.Settings.ChangePeptideIntegration(integration => integration.ChangeAutoTrain(true))); } DocumentContainer.ModifyDocumentNoUndo(doc => { if (!ReferenceEquals(doc, docCurrent)) { throw new InvalidDataException(Resources.SkylineWindow_ImportFasta_Unexpected_document_change_during_operation); } return(docNew); }); if (RequirePrecursorTransition && !VerifyAtLeastOnePrecursorTransition(DocumentContainer.Document)) { return(false); } } return(true); }