public void OkDialog() { var helper = new MessageBoxHelper(this); int numDecoys; if (!helper.ValidateNumberTextBox(textNumberOfDecoys, 0, null, out numDecoys)) { return; } int numComparableGroups = RefinementSettings.SuggestDecoyCount(_document); if (numComparableGroups == 0) { helper.ShowTextBoxError(textNumberOfDecoys, Resources.GenerateDecoysError_No_peptide_precursor_models_for_decoys_were_found_); return; } if (!Equals(DecoysMethod, DecoyGeneration.SHUFFLE_SEQUENCE) && numComparableGroups < numDecoys) { helper.ShowTextBoxError(textNumberOfDecoys, Resources.GenerateDecoysDlg_OkDialog_The_number_of_peptides__0__must_be_less_than_the_number_of_peptide_precursor_models_for_decoys__1___or_use_the___2___decoy_generation_method_, null, numComparableGroups, DecoyGeneration.SHUFFLE_SEQUENCE); return; } _numDecoys = numDecoys; DialogResult = DialogResult.OK; }
public GenerateDecoysDlg(SrmDocument document) { _document = document; InitializeComponent(); Icon = Resources.Skyline; // Set initial decoys number textNumberOfDecoys.Text = RefinementSettings.SuggestDecoyCount(document).ToString(LocalizationHelper.CurrentCulture); // Fill method type combo box comboDecoysGenerationMethod.Items.AddRange(DecoyGeneration.Methods.Cast <object>().ToArray()); comboDecoysGenerationMethod.SelectedIndex = 0; }
protected override void DoTest() { // DDA with IDs and alignment string filePathDda = TestFilesDir.GetTestPath(@"DDA\Bereman_5proteins_spikein_decoys.sky.zip"); RunUI(() => SkylineWindow.OpenSharedFile(filePathDda)); var doc = WaitForDocumentLoaded(); int expectedDecoys = RefinementSettings.SuggestDecoyCount(doc); RunDlg <GenerateDecoysDlg>(() => SkylineWindow.ShowGenerateDecoysDlg(), decoysDlg => { decoysDlg.DecoysMethod = DecoyGeneration.SHUFFLE_SEQUENCE; decoysDlg.OkDialog(); }); doc = WaitForDocumentChange(doc); Assert.AreEqual(expectedDecoys, doc.Peptides.Count(p => p.IsDecoy)); ImportResultsFiles(DDA_FILES.Select(s => GetDataFile("DDA", s)).Select(MsDataFileUri.Parse)); RunUI(() => { SkylineWindow.SaveDocument(); SkylineWindow.ArrangeGraphsTiled(); SkylineWindow.ShowAlignedPeptideIDTimes(true); SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.SelectedNode.FirstNode; }); // Random nature of decoys makes it hard to make this very deterministic // But eventually we should see some peptides without IDs of their own // All peptides should have aligned IDs, if they don't have a single ID, // since it might be the only ID int countWithIds = 0, countTotal = 0; while (countWithIds < 20 || countTotal - 4 < countWithIds) { WaitForGraphs(); RunUI(() => { foreach (var graphChromatogram in SkylineWindow.GraphChromatograms) { countTotal++; int countIds = graphChromatogram.RetentionMsMs != null ? graphChromatogram.RetentionMsMs.Length : 0; if (countIds != 1) { Assert.IsNotNull(graphChromatogram.AlignedRetentionMsMs); Assert.AreNotEqual(0, graphChromatogram.AlignedRetentionMsMs.Length); } if (countIds > 0) { ValidateTimeRange(graphChromatogram, graphChromatogram.RetentionMsMs, 6, 90); countWithIds++; } else { ValidateTimeRange(graphChromatogram, graphChromatogram.AlignedRetentionMsMs, 6, 90); } } var nextNode = SkylineWindow.SequenceTree.SelectedNode.NextNode; if (nextNode != null) { SkylineWindow.SequenceTree.SelectedNode = nextNode; } }); } // DIA with DDA IDs string filePathDia = TestFilesDir.GetTestPath(@"DIA\Hoofnagle_QE_DIA_targeted_decoys.sky.zip"); RunUI(() => SkylineWindow.OpenSharedFile(filePathDia)); doc = WaitForDocumentLoaded(); expectedDecoys = RefinementSettings.SuggestDecoyCount(doc); RunDlg <GenerateDecoysDlg>(() => SkylineWindow.ShowGenerateDecoysDlg(), decoysDlg => { decoysDlg.DecoysMethod = DecoyGeneration.REVERSE_SEQUENCE; decoysDlg.OkDialog(); }); doc = WaitForDocumentChange(doc); Assert.AreEqual(expectedDecoys, doc.Peptides.Count(p => p.IsDecoy)); ImportResultsFiles(DIA_FILES.Select(s => GetDataFile("DIA", s)).Select(MsDataFileUri.Parse)); RunUI(() => { SkylineWindow.SaveDocument(); SkylineWindow.ArrangeGraphsTiled(); SkylineWindow.ShowOtherRunPeptideIDTimes(true); SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.SelectedNode.FirstNode; }); for (int i = 0; i < 6; i++) { WaitForGraphs(); RunUI(() => { foreach (var graphChromatogram in SkylineWindow.GraphChromatograms) { Assert.IsNull(graphChromatogram.RetentionMsMs); Assert.IsNull(graphChromatogram.AlignedRetentionMsMs); Assert.IsNotNull(graphChromatogram.UnalignedRetentionMsMs); Assert.AreNotEqual(0, graphChromatogram.UnalignedRetentionMsMs.Length); ValidateTimeRange(graphChromatogram, graphChromatogram.UnalignedRetentionMsMs, 8, 120); } SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.SelectedNode.NextNode; }); } // DIA with IRT values string filePathDiaIrt = TestFilesDir.GetTestPath(@"DIA-iRT\AQUA4_Human_picked_napedro2_full_rescore_iRT_decoys.sky.zip"); RunUI(() => SkylineWindow.OpenSharedFile(filePathDiaIrt)); doc = WaitForDocumentLoaded(); expectedDecoys = RefinementSettings.SuggestDecoyCount(doc); RunDlg <GenerateDecoysDlg>(() => SkylineWindow.ShowGenerateDecoysDlg(), decoysDlg => { decoysDlg.DecoysMethod = DecoyGeneration.SHUFFLE_SEQUENCE; decoysDlg.OkDialog(); }); doc = WaitForDocumentChange(doc); Assert.AreEqual(expectedDecoys, doc.Peptides.Count(p => p.IsDecoy)); ImportResultsFile(GetDataFile("DIA-iRT", IRT_FILES[0])); RunUI(() => { SkylineWindow.SaveDocument(); SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.SelectedNode.FirstNode; }); for (int i = 0; i < 6; i++) { WaitForGraphs(); RunUI(() => { foreach (var graphChromatogram in SkylineWindow.GraphChromatograms) { Assert.IsNull(graphChromatogram.RetentionMsMs); Assert.IsNull(graphChromatogram.AlignedRetentionMsMs); Assert.IsNull(graphChromatogram.UnalignedRetentionMsMs); Assert.IsTrue(graphChromatogram.PredictedRT.HasValue); ValidateTimeRange(graphChromatogram, new [] { graphChromatogram.PredictedRT.Value }, 8, 135); } SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.SelectedNode.NextNode; }); } }