private void DoStudy7Test() { // Preparing a Document to Accept the Study 7 Transition List, p. 15 RunUI(() => SkylineWindow.NewDocument()); var peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); var mod13Cr = new StaticMod("Label:13C(6) (C-term R)", "R", ModTerminus.C, false, null, LabelAtoms.C13, RelativeRT.Matching, null, null, null); AddHeavyMod(mod13Cr, peptideSettingsUI1, "Edit Isotope Modification form", 17); RunUI(() => { peptideSettingsUI1.PickedHeavyMods = new[] { "Label:13C(6) (C-term R)", HEAVY_K }; peptideSettingsUI1.PickedLibraries = new[] { "" }; peptideSettingsUI1.SelectedBackgroundProteome = Resources.SettingsList_ELEMENT_NONE_None; peptideSettingsUI1.OkDialog(); }); // Pasting a Transition List into the Document, p. 18. string clipboardSaveText = string.Empty; RunUI(() => { var filePath = GetTestPath(@"Study 7\Study7 transition list.xls"); SetExcelFileClipboardText(filePath, "Simple", 6, false); clipboardSaveText = ClipboardEx.GetText(); }); { var messageDlg = ShowDialog <ImportTransitionListErrorDlg>(SkylineWindow.Paste); PauseForScreenShot <ImportTransitionListErrorDlg>("Error message form (expected)", 18); OkDialog(messageDlg, messageDlg.CancelDialog); // Restore the clipboard text after pausing ClipboardEx.SetText(clipboardSaveText); } RunDlg <TransitionSettingsUI>(() => SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Instrument), transitionSettingsUI => { transitionSettingsUI.InstrumentMaxMz = 1800; transitionSettingsUI.OkDialog(); }); RunUI(() => { SkylineWindow.Paste(); SkylineWindow.CollapsePeptides(); }); PauseForScreenShot("Targets tree (selected from main window)", 19); // Adjusting Modifications Manually, p. 19. AdjustModifications("AGLCQTFVYGGCR", true, 'V', 747.348); PauseForScreenShot("Target tree clipped from main window", 22); AdjustModifications("IVGGWECEK", true, 'V', 541.763); AdjustModifications("YEVQGEVFTKPQLWP", false, 'L', 913.974); RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"Study 7\Study7.sky"))); // Importing Data from a Multiple Sample WIFF file, p. 23. var importResultsDlg1 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults); var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets = importResultsDlg1.GetDataSourcePathsFile(null)); RunUI(() => { openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Study 7")); openDataSourceDialog1.SelectAllFileType(IsFullData ? ".wiff" : ExtensionTestContext.ExtAbWiff); // Force true wiff for FullData }); if (UseRawFilesOrFullData) { var importResultsSamplesDlg = ShowDialog <ImportResultsSamplesDlg>(openDataSourceDialog1.Open); PauseForScreenShot <ImportResultsSamplesDlg>("Choose Samples form", 23); RunUI(() => { if (IsFullData) { importResultsSamplesDlg.CheckAll(true); importResultsSamplesDlg.ExcludeSample(0); // Blank importResultsSamplesDlg.ExcludeSample(25); // QC importResultsSamplesDlg.ExcludeSample(26); importResultsSamplesDlg.ExcludeSample(27); importResultsSamplesDlg.ExcludeSample(28); importResultsSamplesDlg.ExcludeSample(45); // A2 importResultsSamplesDlg.ExcludeSample(46); importResultsSamplesDlg.ExcludeSample(47); importResultsSamplesDlg.ExcludeSample(48); importResultsSamplesDlg.ExcludeSample(49); // gradientwash importResultsSamplesDlg.ExcludeSample(50); importResultsSamplesDlg.ExcludeSample(51); importResultsSamplesDlg.ExcludeSample(52); importResultsSamplesDlg.ExcludeSample(53); // A3 importResultsSamplesDlg.ExcludeSample(54); importResultsSamplesDlg.ExcludeSample(55); importResultsSamplesDlg.ExcludeSample(56); } else { importResultsSamplesDlg.CheckAll(false); importResultsSamplesDlg.IncludeSample(1); importResultsSamplesDlg.IncludeSample(2); importResultsSamplesDlg.IncludeSample(11); importResultsSamplesDlg.IncludeSample(12); } }); OkDialog(importResultsSamplesDlg, importResultsSamplesDlg.OkDialog); } else { RunUI(openDataSourceDialog1.Open); } { var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog); PauseForScreenShot <ImportDocResultsDlg>("Import Results Common prefix form", 24); OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog); } WaitForCondition(() => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); RestoreViewOnScreen(25); // Inspecting and Adjusting Peak Integration, p. 24. RunUI(() => { SkylineWindow.ShowPeakAreaReplicateComparison(); SkylineWindow.ShowGraphRetentionTime(true); }); if (!IsPauseForScreenShots && !IsFullData) { TestApplyToAll(); } PauseForScreenShot <GraphSummary.RTGraphView>("Main window with peaks and retention times showing", 25); CheckReportCompatibility.CheckAll(SkylineWindow.Document); RunUI(SkylineWindow.EditDelete); FindNode("IVGGWECEK"); // Not L10N TransitionGroupTreeNode selNodeGroup = null; RunUI(() => { selNodeGroup = (TransitionGroupTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[1]; Assert.AreEqual(selNodeGroup.StateImageIndex, (int)SequenceTree.StateImageId.peak_blank); }); RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI => { transitionSettingsUI.MZMatchTolerance = 0.065; transitionSettingsUI.OkDialog(); }); RunUI(() => { Assert.AreEqual((int)SequenceTree.StateImageId.peak, selNodeGroup.StateImageIndex); SkylineWindow.ToggleIntegrateAll(); }); RunUI(() => { foreach (PeptideDocNode nodePep in SkylineWindow.Document.Molecules) { string sequence = nodePep.Peptide.Sequence; int imageIndex = PeptideTreeNode.GetPeakImageIndex(nodePep, SkylineWindow.SequenceTree); if ((sequence != null) && (sequence.StartsWith("YLA") || sequence.StartsWith("YEV"))) // Not L10N { Assert.AreEqual((int)SequenceTree.StateImageId.keep, imageIndex, string.Format("Expected keep icon for the peptide {0}, found {1}", sequence, imageIndex)); } else if (sequence != null) { Assert.AreEqual((int)SequenceTree.StateImageId.peak, imageIndex, string.Format("Expected peak icon for the peptide {0}, found {1}", sequence, imageIndex)); } else // Custom Ion { Assert.AreEqual((int)SequenceTree.StateImageId.peak_blank, imageIndex, string.Format("Expected peak_blank icon for the custom ion {0}, found {1}", nodePep.ModifiedTarget, imageIndex)); } } }); PauseForScreenShot("Main window", 27); // Data Inspection with Peak Areas View, p. 27. FindNode("SSDLVALSGGHTFGK"); // Not L10N RunUI(NormalizeGraphToHeavy); RestoreViewOnScreen(28); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 28); FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++"); // ESDTSYVSLK - Not L10N PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 29); RunUI(SkylineWindow.ExpandPeptides); string hgflprLight = (363.7059).ToString(LocalizationHelper.CurrentCulture) + "++"; // HGFLPR - Not L10N FindNode(hgflprLight); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 30); RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view)); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph normalized metafile", 31); RunUI(() => SkylineWindow.ShowGraphPeakArea(false)); RunUI(() => SkylineWindow.ActivateReplicate("E_03")); PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile with interference", 31); RunUI(() => SkylineWindow.ShowGraphPeakArea(true)); RunUI(() => { SkylineWindow.ShowPeakAreaPeptideGraph(); SkylineWindow.ShowTotalTransitions(); SkylineWindow.ShowCVValues(true); SkylineWindow.ShowPeptideOrder(SummaryPeptideOrder.document); }); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Peptide Comparison graph metafile", 32); // Annotating replicates with concentration values var chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog); var editListDlg = ShowDialog <EditListDlg <SettingsListBase <AnnotationDef>, AnnotationDef> >(chooseAnnotationsDlg.EditAnnotationList); RunUI(editListDlg.ResetList); var defineAnnotationDlg = ShowDialog <DefineAnnotationDlg>(editListDlg.AddItem); RunUI(() => { defineAnnotationDlg.AnnotationName = "Concentration"; defineAnnotationDlg.AnnotationType = AnnotationDef.AnnotationType.number; defineAnnotationDlg.AnnotationTargets = AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.replicate); }); PauseForScreenShot <DefineAnnotationDlg>("Define Annotation form", 33); OkDialog(defineAnnotationDlg, defineAnnotationDlg.OkDialog); OkDialog(editListDlg, () => editListDlg.DialogResult = DialogResult.OK); RunUI(() => chooseAnnotationsDlg.AnnotationsCheckedListBox.SetItemChecked(0, true)); PauseForScreenShot <DocumentSettingsDlg>("Annotation Settings form", 34); OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.OkDialog); RunUI(() => SkylineWindow.ShowResultsGrid(true)); RunUI(() => { SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.MoleculeGroups, 0); }); WaitForGraphs(); WaitForConditionUI(() => FindOpenForm <LiveResultsGrid>().IsComplete); RunUI(() => { Settings.Default.ResultsGridSynchSelection = false; var resultsGrid = FindOpenForm <LiveResultsGrid>().DataGridView; var colConcentration = // ReSharper disable LocalizableElement resultsGrid.Columns.Cast <DataGridViewColumn>().First(col => "Concentration" == col.HeaderText); // Not L10N // ReSharper restore LocalizableElement if (IsFullData) { float[] concentrations = { 0f, 60, 175, 513, 1500, 2760, 4980, 9060, 16500, 30000 }; for (int i = 0; i < concentrations.Length; i++) { for (int j = i * 4; j < (i + 1) * 4; j++) { SetCellValue(resultsGrid, j, colConcentration.Index, concentrations[i]); } } } else { SetCellValue(resultsGrid, 0, colConcentration.Index, 0f); SetCellValue(resultsGrid, 1, colConcentration.Index, 0f); SetCellValue(resultsGrid, 2, colConcentration.Index, 175f); SetCellValue(resultsGrid, 3, colConcentration.Index, 175f); } }); WaitForGraphs(); PauseForScreenShot <LiveResultsGrid>("Results grid with annotations (scrolled to the end)", 35); FindNode("SSDLVALSGGHTFGK"); // Not L10N RunUI(() => { SkylineWindow.ShowPeakAreaReplicateComparison(); SkylineWindow.GroupByReplicateAnnotation("Concentration"); NormalizeGraphToHeavy(); }); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph with CVs metafile", 36); RunUI(() => SkylineWindow.ShowCVValues(false)); RunUI(() => SkylineWindow.SaveDocument()); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph grouped by concentration metafile", 36); PauseForAuditLog(); // Further Exploration, p. 33. RunUI(() => { SkylineWindow.OpenFile(GetTestPath(@"Study 7\Study II\Study 7ii (site 52).sky")); // Not L10N SkylineWindow.ShowPeakAreaPeptideGraph(); SkylineWindow.ShowCVValues(true); }); WaitForCondition(() => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas peptide comparison graph metafile", 37); FindNode("LSEPAELTDAVK"); RunUI(SkylineWindow.ShowRTReplicateGraph); PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times replicate graph metafile", 38); FindNode("INDISHTQSVSAK"); RunUI(SkylineWindow.ShowPeakAreaReplicateComparison); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas normalized to heave graph metafile", 38); RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.none)); WaitForGraphs(); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas no normalization graph metafile", 39); FindNode(hgflprLight); RunUI(() => { SkylineWindow.ShowAllTransitions(); NormalizeGraphToHeavy(); }); WaitForGraphs(); PauseForScreenShot <GraphSummary.AreaGraphView>("Area Ratio to Heavy graph showing interference metafile", 40); RunUI(() => SkylineWindow.ShowGraphPeakArea(false)); RunUI(() => SkylineWindow.ActivateReplicate("E_ 03")); WaitForGraphs(); PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile showing slight interference", 40); }
private void TestSettingIonsUI() { var ions = new MeasuredIon[0]; var ionList = new MeasuredIonList(); ionList.AddRange(ions); Settings.Default.MeasuredIonList = ionList; RunUI(() => SkylineWindow.ModifyDocument("Change measured ions", document => document.ChangeSettings( document.Settings.ChangeTransitionFilter(filter => filter.ChangeMeasuredIons(ions))))); var tranSettings = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI); var editMeasuredIonList = ShowDialog <EditListDlg <SettingsListBase <MeasuredIon>, MeasuredIon> >( tranSettings.EditSpecialTransitionsList); var editMeasuredIon1 = ShowDialog <EditMeasuredIonDlg>(editMeasuredIonList.AddItem); RunUI(() => { editMeasuredIon1.SwitchToCustom(); editMeasuredIon1.TextName = "Water"; editMeasuredIon1.Formula = "H2O"; }); var errorDlg = ShowDialog <MessageDlg>(() => editMeasuredIon1.Charge = -1); // Negative charge states are valid for small molecule only, not for reporter ions AssertEx.AreComparableStrings(String.Format(Resources.MessageBoxHelper_ValidateDecimalTextBox__0__must_be_greater_than_or_equal_to__1__, String.Empty, 1), errorDlg.Message); RunUI(() => errorDlg.OkDialog()); // Dismiss the warning RunUI(() => { editMeasuredIon1.Charge = 1; }); OkDialog(editMeasuredIon1, editMeasuredIon1.OkDialog); var editMeasuredIon2 = ShowDialog <EditMeasuredIonDlg>(editMeasuredIonList.AddItem); RunUI(() => { editMeasuredIon2.SwitchToCustom(); editMeasuredIon2.TextName = "Carbon"; editMeasuredIon2.Charge = 1; editMeasuredIon2.Formula = "CO2"; }); OkDialog(editMeasuredIon2, editMeasuredIon2.OkDialog); OkDialog(editMeasuredIonList, editMeasuredIonList.OkDialog); RunUI(() => { tranSettings.SetListAlwaysAdd(0, true); tranSettings.SetListAlwaysAdd(0, true); tranSettings.SetListAlwaysAdd(1, true); }); OkDialog(tranSettings, tranSettings.OkDialog); IdentityPath path; var newDoc = SkylineWindow.Document.ImportFasta(new StringReader(">peptide1\nPEPMCIDEPR"), true, IdentityPath.ROOT, out path); TransitionGroupDocNode nodeGroup = newDoc.PeptideTransitionGroups.ElementAt(0); var water = new MeasuredIon("Water", "H2O", null, null, 1); var carbon = new MeasuredIon("Carbon", "CO2", null, null, 1, true); var filteredWaterNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, true) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, water.CustomIon)); Assert.AreEqual(1, filteredWaterNodes.Count()); var filteredCarbonNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, true) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, carbon.CustomIon)); var unfilteredCarbonNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, false) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, carbon.CustomIon)); Assert.AreEqual(0, filteredCarbonNodes.Count()); Assert.AreEqual(1, unfilteredCarbonNodes.Count()); }
public override string ToString() { // Consider: maybe change TransitionGroupDocNode.ToString() to be this as well: return(TransitionGroupTreeNode.GetLabel(DocNode.TransitionGroup, DocNode.PrecursorMz, string.Empty)); }
private void DoStudy7Test() { // Preparing a Document to Accept the Study 7 Transition List, p. 18 RunUI(() => SkylineWindow.NewDocument()); var peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); if (IsCoverShotMode) { var modHeavyK = new StaticMod(HEAVY_K, "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, // Not L10N RelativeRT.Matching, null, null, null); AddHeavyMod(modHeavyK, peptideSettingsUI1, "Edit Isotope Modification form", 6); } var mod13Cr = new StaticMod("Label:13C(6) (C-term R)", "R", ModTerminus.C, false, null, LabelAtoms.C13, RelativeRT.Matching, null, null, null); AddHeavyMod(mod13Cr, peptideSettingsUI1, "Edit Isotope Modification form", 18); RunUI(() => { peptideSettingsUI1.PickedHeavyMods = new[] { "Label:13C(6) (C-term R)", HEAVY_K }; peptideSettingsUI1.PickedLibraries = new string[0]; peptideSettingsUI1.SelectedBackgroundProteome = Resources.SettingsList_ELEMENT_NONE_None; peptideSettingsUI1.OkDialog(); }); // Pasting a Transition List into the Document, p. 19. string clipboardSaveText = string.Empty; RunUI(() => { var filePath = GetTestPath(@"Study 7\Study7 transition list.xls"); SetExcelFileClipboardText(filePath, "Simple", 6, false); clipboardSaveText = ClipboardEx.GetText(); }); // We expect this to fail due to instrument settings rather than format issues eg "The product m/z 1519.78 is out of range for the instrument settings, in the peptide sequence YEVQGEVFTKPQLWP. Check the Instrument tab in the Transition Settings." { var transitionSelectdgl = ShowDialog <ImportTransitionListColumnSelectDlg>(SkylineWindow.Paste); var messageDlg = ShowDialog <ImportTransitionListErrorDlg>(transitionSelectdgl.AcceptButton.PerformClick); 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), messageDlg.ErrorList[0].ErrorMessage, 2); RunUI(() => messageDlg.Size = new Size(838, 192)); PauseForScreenShot <ImportTransitionListErrorDlg>("Error message form (expected)", 19); OkDialog(messageDlg, messageDlg.CancelButton.PerformClick); // Acknowledge the error but decline to proceed with import RunUI(() => transitionSelectdgl.DialogResult = DialogResult.Cancel); // Cancel the import // Restore the clipboard text after pausing ClipboardEx.SetText(clipboardSaveText); } RunDlg <TransitionSettingsUI>(() => SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Instrument), transitionSettingsUI => { transitionSettingsUI.InstrumentMaxMz = 1800; transitionSettingsUI.OkDialog(); }); PasteTransitionListSkipColumnSelect(); RunUI(SkylineWindow.CollapsePeptides); PauseForScreenShot("Targets tree (selected from main window)", 20); // Adjusting Modifications Manually, p. 19. AdjustModifications("AGLCQTFVYGGCR", true, 'V', 747.348); PauseForScreenShot("Target tree clipped from main window", 22); AdjustModifications("IVGGWECEK", true, 'V', 541.763); AdjustModifications("YEVQGEVFTKPQLWP", false, 'L', 913.974); RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"Study 7\Study7.sky"))); // Importing Data from a Multiple Sample WIFF file, p. 23. var importResultsDlg1 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults); var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets = importResultsDlg1.GetDataSourcePathsFile(null)); RunUI(() => { openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Study 7")); openDataSourceDialog1.SelectAllFileType(UseRawFilesOrFullData ? ".wiff" : ".mzML"); // Force true wiff for FullData }); if (UseRawFilesOrFullData) { var importResultsSamplesDlg = ShowDialog <ImportResultsSamplesDlg>(openDataSourceDialog1.Open); PauseForScreenShot <ImportResultsSamplesDlg>("Choose Samples form", 24); RunUI(() => { if (IsFullData) { importResultsSamplesDlg.CheckAll(true); importResultsSamplesDlg.ExcludeSample(0); // Blank importResultsSamplesDlg.ExcludeSample(25); // QC importResultsSamplesDlg.ExcludeSample(26); importResultsSamplesDlg.ExcludeSample(27); importResultsSamplesDlg.ExcludeSample(28); importResultsSamplesDlg.ExcludeSample(45); // A2 importResultsSamplesDlg.ExcludeSample(46); importResultsSamplesDlg.ExcludeSample(47); importResultsSamplesDlg.ExcludeSample(48); importResultsSamplesDlg.ExcludeSample(49); // gradientwash importResultsSamplesDlg.ExcludeSample(50); importResultsSamplesDlg.ExcludeSample(51); importResultsSamplesDlg.ExcludeSample(52); importResultsSamplesDlg.ExcludeSample(53); // A3 importResultsSamplesDlg.ExcludeSample(54); importResultsSamplesDlg.ExcludeSample(55); importResultsSamplesDlg.ExcludeSample(56); } else { importResultsSamplesDlg.CheckAll(false); importResultsSamplesDlg.IncludeSample(1); importResultsSamplesDlg.IncludeSample(2); importResultsSamplesDlg.IncludeSample(11); importResultsSamplesDlg.IncludeSample(12); } }); OkDialog(importResultsSamplesDlg, importResultsSamplesDlg.OkDialog); } else { RunUI(openDataSourceDialog1.Open); } { var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog); PauseForScreenShot <ImportResultsNameDlg>("Import Results Common prefix form", 25); OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog); } WaitForCondition(() => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); RestoreViewOnScreen(26); // Inspecting and Adjusting Peak Integration, p. 24. RunUI(() => { SkylineWindow.ShowPeakAreaReplicateComparison(); SkylineWindow.ShowGraphRetentionTime(true); SkylineWindow.Size = new Size(1029, 659); }); if (!IsPauseForScreenShots && !IsFullData) { TestApplyToAll(); } PauseForScreenShot <GraphSummary.RTGraphView>("Main window with peaks and retention times showing", 26); CheckReportCompatibility.CheckAll(SkylineWindow.Document); RunUI(SkylineWindow.EditDelete); FindNode("IVGGWECEK"); // Not L10N TransitionGroupTreeNode selNodeGroup = null; RunUI(() => { selNodeGroup = (TransitionGroupTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[1]; Assert.AreEqual(selNodeGroup.StateImageIndex, (int)SequenceTree.StateImageId.peak_blank); }); RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI => { transitionSettingsUI.MZMatchTolerance = 0.065; transitionSettingsUI.OkDialog(); }); RunUI(() => { Assert.AreEqual((int)SequenceTree.StateImageId.peak, selNodeGroup.StateImageIndex); SkylineWindow.ToggleIntegrateAll(); }); RunUI(() => { foreach (PeptideDocNode nodePep in SkylineWindow.Document.Molecules) { string sequence = nodePep.Peptide.Sequence; int imageIndex = PeptideTreeNode.GetPeakImageIndex(nodePep, SkylineWindow.SequenceTree); if ((sequence != null) && (sequence.StartsWith("YLA") || sequence.StartsWith("YEV"))) // Not L10N { Assert.AreEqual((int)SequenceTree.StateImageId.keep, imageIndex, string.Format("Expected keep icon for the peptide {0}, found {1}", sequence, imageIndex)); } else if (sequence != null) { Assert.AreEqual((int)SequenceTree.StateImageId.peak, imageIndex, string.Format("Expected peak icon for the peptide {0}, found {1}", sequence, imageIndex)); } else // Custom Ion { Assert.AreEqual((int)SequenceTree.StateImageId.peak_blank, imageIndex, string.Format("Expected peak_blank icon for the custom ion {0}, found {1}", nodePep.ModifiedTarget, imageIndex)); } } }); PauseForScreenShot("Main window", 27); // Data Inspection with Peak Areas View, p. 29. RestoreViewOnScreen(28); FindNode("SSDLVALSGGHTFGK"); // Not L10N RunUI(NormalizeGraphToHeavy); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 29); FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++"); // ESDTSYVSLK - Not L10N PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 30); RunUI(SkylineWindow.ExpandPeptides); string hgflprLight = (363.7059).ToString(LocalizationHelper.CurrentCulture) + "++"; // HGFLPR - Not L10N FindNode(hgflprLight); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 31); RunUI(() => SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.TOTAL)); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph normalized metafile", 32); RunUI(() => { SkylineWindow.ShowGraphPeakArea(false); SkylineWindow.ActivateReplicate("E_03"); SkylineWindow.Size = new Size(757, 655); }); PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile with interference", 32); RunUI(() => SkylineWindow.ShowGraphPeakArea(true)); RunUI(() => { SkylineWindow.ShowPeakAreaPeptideGraph(); SkylineWindow.ShowTotalTransitions(); SkylineWindow.ShowCVValues(true); SkylineWindow.ShowPeptideOrder(SummaryPeptideOrder.document); }); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Peptide Comparison graph metafile", 33); float[] concentrations = { 0f, 60, 175, 513, 1500, 2760, 4980, 9060, 16500, 30000 }; var documentGrid = ShowDialog <DocumentGridForm>(() => SkylineWindow.ShowDocumentGrid(true)); var pathConcentration = PropertyPath.Parse("AnalyteConcentration"); var pathSampleType = PropertyPath.Parse("SampleType"); RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates)); WaitForConditionUI(() => documentGrid.RowCount == (IsFullData ? concentrations.Length * 4 : 4) && documentGrid.FindColumn(pathConcentration) != null && documentGrid.FindColumn(pathSampleType) != null); // Let it initialize RunUI(() => { // Parent is a DocPane and Parent.Parent is the floating window documentGrid.Parent.Parent.Size = new Size(585, 325); var documentGridView = documentGrid.DataGridView; var colConcentration = documentGrid.FindColumn(pathConcentration); var colStandardType = documentGrid.FindColumn(pathSampleType); if (IsFullData) { for (int i = 0; i < concentrations.Length; i++) { for (int j = i * 4; j < (i + 1) * 4; j++) { double?concentration = concentrations[i]; SetCellValue(documentGridView, j, colConcentration.Index, concentration); SetCellValue(documentGridView, j, colStandardType.Index, concentration == 0 ? SampleType.BLANK : SampleType.STANDARD); } } } else { SetCellValue(documentGridView, 0, colConcentration.Index, 0.0); SetCellValue(documentGridView, 0, colStandardType.Index, SampleType.BLANK); SetCellValue(documentGridView, 1, colConcentration.Index, 0.0); SetCellValue(documentGridView, 1, colStandardType.Index, SampleType.BLANK); SetCellValue(documentGridView, 2, colConcentration.Index, 175.0); SetCellValue(documentGridView, 2, colStandardType.Index, SampleType.STANDARD); SetCellValue(documentGridView, 3, colConcentration.Index, 175.0); SetCellValue(documentGridView, 3, colStandardType.Index, SampleType.STANDARD); } }); WaitForGraphs(); PauseForScreenShot <DocumentGridForm>("Document grid filled (scrolled to the end)", 35); RunUI(() => documentGrid.Close()); FindNode("SSDLVALSGGHTFGK"); // Not L10N RunUI(() => { SkylineWindow.ShowPeakAreaReplicateComparison(); var settings = SkylineWindow.DocumentUI.Settings; var valConcentration = ReplicateValue.GetAllReplicateValues(settings).Skip(1).First(); SkylineWindow.GroupByReplicateValue(valConcentration); NormalizeGraphToHeavy(); }); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph with CVs metafile", 36); RunUI(() => SkylineWindow.ShowCVValues(false)); RunUI(() => SkylineWindow.SaveDocument()); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph grouped by concentration metafile", 37); PauseForAuditLog(); // Further Exploration, p. 33. RunUI(() => { SkylineWindow.OpenFile(GetTestPath(@"Study 7\Study II\Study 7ii (site 52).sky")); // Not L10N SkylineWindow.ShowPeakAreaPeptideGraph(); SkylineWindow.ShowCVValues(true); }); WaitForCondition(() => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); RestoreViewOnScreen(38); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas peptide comparison graph metafile", 38); FindNode("LSEPAELTDAVK"); RunUI(() => { SkylineWindow.ShowGraphPeakArea(false); SkylineWindow.Width = 920; SkylineWindow.ShowRTReplicateGraph(); }); PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times replicate graph metafile", 38); FindNode("INDISHTQSVSAK"); RunUI(SkylineWindow.ShowPeakAreaReplicateComparison); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas normalized to heave graph metafile", 39); if (IsCoverShotMode) { RunUI(() => { Settings.Default.ChromatogramFontSize = 14; Settings.Default.AreaFontSize = 14; SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR); SkylineWindow.AutoZoomBestPeak(); }); RestoreCoverViewOnScreen(); RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Parent); WaitForGraphs(); RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Nodes[0]); RunUI(SkylineWindow.FocusDocument); TakeCoverShot(); return; } RunUI(() => SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.NONE)); WaitForGraphs(); PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas no normalization graph metafile", 40); FindNode(hgflprLight); RunUI(() => { SkylineWindow.ShowAllTransitions(); NormalizeGraphToHeavy(); }); WaitForGraphs(); PauseForScreenShot <GraphSummary.AreaGraphView>("Area Ratio to Heavy graph showing interference metafile", 41); RunUI(() => SkylineWindow.ShowGraphPeakArea(false)); RunUI(() => SkylineWindow.ActivateReplicate("E_ 03")); WaitForGraphs(); PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile showing slight interference", 41); }
private void VerifyPrecursorRatio(TransitionGroupTreeNode precursorTreeNode, double ratioExpected) { Assert.AreEqual(ratioExpected, precursorTreeNode.DocNode.Results[0][0].Ratio.Value, 0.005); }
protected override void DoTest() { RunUI(() => { SkylineWindow.OpenFile(TestFilesDir.GetTestPath("SimpleRatiosTest.sky")); SkylineWindow.ExpandPrecursors(); }); Assert.IsFalse(SkylineWindow.Document.Settings.PeptideSettings.Quantification.SimpleRatios); Assert.AreEqual(new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy), SkylineWindow.Document.Settings.PeptideSettings.Quantification.NormalizationMethod); PeptideTreeNode peptideTreeNode = (PeptideTreeNode)SkylineWindow.SequenceTree.Nodes[0].Nodes[0]; TransitionGroupTreeNode lightTreeNode = (TransitionGroupTreeNode)peptideTreeNode.Nodes[0]; TransitionGroupTreeNode heavyTreeNode = (TransitionGroupTreeNode)peptideTreeNode.Nodes[1]; var lightTransitionAreas = lightTreeNode.DocNode.Transitions.Select(tran => tran.Results[0][0].Area).ToList(); Assert.AreEqual(4, lightTransitionAreas.Count); var heavyTransitionAreas = heavyTreeNode.DocNode.Transitions.Select(tran => tran.Results[0][0].Area).ToList(); Assert.AreEqual(2, heavyTransitionAreas.Count); // Verify that only the first two transition areas in both precursors contribute to the displayed ratio var expectedRatio = lightTransitionAreas.Take(2).Sum() / heavyTransitionAreas.Sum(); StringAssert.Contains(lightTreeNode.Text, GetTransitionGroupRatioText(expectedRatio)); RunUI(() => { SkylineWindow.ShowResultsGrid(true); SkylineWindow.SelectedPath = peptideTreeNode.Path; }); var resultsGridForm = FindOpenForm <LiveResultsGrid>(); WaitForConditionUI(() => resultsGridForm.IsComplete); RunDlg <ViewEditor>(resultsGridForm.DataboundGridControl.NavBar.CustomizeView, viewEditor => { viewEditor.ChooseColumnsTab.AddColumn(propertyPathNormalizedArea); viewEditor.ViewName = "PeptideResultsWithNormalizedArea"; viewEditor.OkDialog(); }); VerifyExpectedRatio(resultsGridForm, expectedRatio); RunDlg <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI, peptideSettingsUi => { peptideSettingsUi.SimpleRatios = true; peptideSettingsUi.OkDialog(); }); Assert.IsTrue(SkylineWindow.Document.Settings.PeptideSettings.Quantification.SimpleRatios); // When SimpleRatios is true, verify that all transitions contribute to the ratio expectedRatio = lightTransitionAreas.Sum() / heavyTransitionAreas.Sum(); StringAssert.Contains(lightTreeNode.Text, GetTransitionGroupRatioText(expectedRatio)); VerifyExpectedRatio(resultsGridForm, expectedRatio); // Verify that deleting a transition from the light precursor does not affect the heavy precursor Assert.AreEqual(4, lightTreeNode.DocNode.TransitionCount); Assert.AreEqual(2, heavyTreeNode.DocNode.TransitionCount); RunUI(() => { SkylineWindow.SequenceTree.SelectedPaths = new[] { SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Transitions, 0) }; SkylineWindow.EditDelete(); }); Assert.AreEqual(3, lightTreeNode.DocNode.TransitionCount); Assert.AreEqual(2, heavyTreeNode.DocNode.TransitionCount); expectedRatio = lightTransitionAreas.Skip(1).Sum() / heavyTransitionAreas.Sum(); StringAssert.Contains(lightTreeNode.Text, GetTransitionGroupRatioText(expectedRatio)); RunUI(() => SkylineWindow.SelectedPath = peptideTreeNode.Path); VerifyExpectedRatio(resultsGridForm, expectedRatio); }
private void TestSettingIonsUI() { var ions = new MeasuredIon[0]; var ionList = new MeasuredIonList(); ionList.AddRange(ions); Settings.Default.MeasuredIonList = ionList; RunUI(() => SkylineWindow.ModifyDocument("Change measured ions", document => document.ChangeSettings( document.Settings.ChangeTransitionFilter(filter => filter.ChangeMeasuredIons(ions))))); var tranSettings = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI); var editMeasuredIonList = ShowDialog <EditListDlg <SettingsListBase <MeasuredIon>, MeasuredIon> >( tranSettings.EditSpecialTransitionsList); var editMeasuredIon1 = ShowDialog <EditMeasuredIonDlg>(editMeasuredIonList.AddItem); RunUI(() => { editMeasuredIon1.SwitchToCustom(); editMeasuredIon1.TextName = "Water"; editMeasuredIon1.Formula = "H2O"; }); var errorDlg = ShowDialog <MessageDlg>(() => editMeasuredIon1.Charge = -1); // Negative charge states are valid for small molecule only, not for reporter ions AssertEx.AreComparableStrings(String.Format(Resources.MessageBoxHelper_ValidateDecimalTextBox__0__must_be_greater_than_or_equal_to__1__, String.Empty, 1), errorDlg.Message); RunUI(() => errorDlg.OkDialog()); // Dismiss the warning RunUI(() => { editMeasuredIon1.Charge = 1; }); OkDialog(editMeasuredIon1, editMeasuredIon1.OkDialog); var editMeasuredIon2 = ShowDialog <EditMeasuredIonDlg>(editMeasuredIonList.AddItem); RunUI(() => { editMeasuredIon2.SwitchToCustom(); editMeasuredIon2.TextName = "Carbon"; editMeasuredIon2.Charge = 1; editMeasuredIon2.Formula = "CO2"; }); OkDialog(editMeasuredIon2, editMeasuredIon2.OkDialog); OkDialog(editMeasuredIonList, editMeasuredIonList.OkDialog); RunUI(() => { tranSettings.SetListAlwaysAdd(0, true); // optional water tranSettings.SetListAlwaysAdd(0, true); // default water tranSettings.SetListAlwaysAdd(1, true); // optional carbon }); OkDialog(tranSettings, tranSettings.OkDialog); RunUI(() => SkylineWindow.ImportFasta(new StringReader(">peptide1\nPEPMCIDEPR"), 2, true, string.Empty)); var newDoc = SkylineWindow.Document; var water = new MeasuredIon("Water", "H2O", null, null, 1); var carbon = new MeasuredIon("Carbon", "CO2", null, null, 1, true); var nodeTranFirst = newDoc.MoleculeTransitions.ElementAt(0); Assert.IsTrue(nodeTranFirst.Transition.IsCustom()); Assert.AreEqual(water.CustomIon, nodeTranFirst.Transition.CustomIon); // Sort-of unit test forray away from actually using the UI var nodeGroup = newDoc.PeptideTransitionGroups.ElementAt(0); var filteredWaterNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, true) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, water.CustomIon)); Assert.AreEqual(1, filteredWaterNodes.Count()); var filteredCarbonNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, true) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, carbon.CustomIon)); var unfilteredCarbonNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, newDoc.Settings, newDoc.Peptides.ElementAt(0).ExplicitMods, false) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, carbon.CustomIon)); Assert.AreEqual(0, filteredCarbonNodes.Count()); Assert.AreEqual(1, unfilteredCarbonNodes.Count()); // Back to the UI: make sure removing the custom ion from settings // removes it from the document, which was once an issue that lead // to a document that could not be roundtripped RunUI(() => SkylineWindow.SelectedPath = newDoc.GetPathTo((int)SrmDocument.Level.TransitionGroups, 0)); // Add carbon ion RunDlg <PopupPickList>(SkylineWindow.ShowPickChildrenInTest, dlg => { dlg.ApplyFilter(false); dlg.ToggleItem(2); // precursor, water, carbon dlg.OnOk(); }); var docWithCarbon = WaitForDocumentChange(newDoc); var nodeTranCarbon = docWithCarbon.MoleculeTransitions.ElementAt(1); Assert.IsTrue(nodeTranCarbon.Transition.IsCustom()); Assert.AreEqual(carbon.CustomIon, nodeTranCarbon.Transition.CustomIon); RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, tranSettings2 => { tranSettings2.SetListAlwaysAdd(0, false); // remove water tranSettings2.OkDialog(); }); var docWithoutWater = WaitForDocumentChange(docWithCarbon); Assert.AreEqual(0, docWithoutWater.PeptideTransitions.Count(t => Equals(water.CustomIon, t.Transition.CustomIon))); Assert.AreEqual(1, docWithoutWater.PeptideTransitions.Count(t => Equals(carbon.CustomIon, t.Transition.CustomIon))); AssertEx.RoundTrip(docWithoutWater); RunDlg <PopupPickList>(SkylineWindow.ShowPickChildrenInTest, dlg => { dlg.AutoManageChildren = true; dlg.OnOk(); }); var docWithoutCustom = WaitForDocumentChange(docWithoutWater); Assert.AreEqual(0, docWithoutCustom.PeptideTransitions.Count(t => t.Transition.IsCustom())); AssertEx.RoundTrip(docWithoutCustom); }
public void ReporterIonTest() { // Test the code that updates old-style formulas Assert.AreEqual("C5C'H13N2", BioMassCalc.AddH("C5C'H12N2")); Assert.AreEqual("CO2H", BioMassCalc.AddH("CO2")); var docOriginal = new SrmDocument(SrmSettingsList.GetDefault().ChangeTransitionInstrument(instrument => instrument.ChangeMinMz(10))); // H2O2 is not very heavy! IdentityPath path; SrmDocument docPeptide = docOriginal.ImportFasta(new StringReader(">peptide1\nPEPMCIDEPR"), true, IdentityPath.ROOT, out path); // One of the prolines should have caused an extra transition Assert.AreEqual(4, docPeptide.PeptideTransitionCount); Assert.IsTrue(docPeptide.PeptideTransitions.Contains(nodeTran => nodeTran.Transition.Ordinal == 8)); const string formula = "H2O2"; // This was H2O, but that falls below mz=10 at z > 1 const string hydrogenPeroxide = "Hydrogen Perxoide"; var reporterIons = new[] { new MeasuredIon(hydrogenPeroxide, formula, null, null, 1), new MeasuredIon(hydrogenPeroxide, formula, null, null, 2), new MeasuredIon(hydrogenPeroxide, formula, null, null, 3), MeasuredIonList.NTERM_PROLINE }; SrmDocument docReporterIon = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter => filter.ChangeMeasuredIons(reporterIons))); AssertEx.IsDocumentTransitionCount(docReporterIon, 7); //Check With Monoisotopic double mass = BioMassCalc.MONOISOTOPIC.CalculateMassFromFormula(formula); for (int i = 0; i < 3; i++) { TransitionDocNode tranNode = docReporterIon.MoleculeTransitions.ElementAt(i); Transition tran = tranNode.Transition; Assert.AreEqual(reporterIons[i].CustomIon, tran.CustomIon); Assert.AreEqual(tran.Charge, i + 1); Assert.AreEqual(BioMassCalc.MONOISOTOPIC.CalculateIonMz(formula, i + 1), tranNode.Mz, BioMassCalc.MassElectron / 100); Assert.AreEqual(BioMassCalc.CalculateIonMz(mass, i + 1), tranNode.Mz, BioMassCalc.MassElectron / 100); } //Check with Average TransitionPrediction predSettings = docReporterIon.Settings.TransitionSettings.Prediction.ChangeFragmentMassType(MassType.Average); TransitionSettings tranSettings = docReporterIon.Settings.TransitionSettings.ChangePrediction(predSettings); SrmSettings srmSettings = docReporterIon.Settings.ChangeTransitionSettings(tranSettings); SrmDocument averageDocument = docReporterIon.ChangeSettings(srmSettings); mass = BioMassCalc.AVERAGE.CalculateMassFromFormula(formula); for (int i = 0; i < 3; i++) { TransitionDocNode tranNode = averageDocument.MoleculeTransitions.ElementAt(i); Transition tran = tranNode.Transition; Assert.AreEqual(reporterIons[i].CustomIon, tran.CustomIon); Assert.AreEqual(tran.Charge, i + 1); Assert.AreEqual(BioMassCalc.AVERAGE.CalculateIonMz(formula, i + 1), tranNode.Mz, BioMassCalc.MassElectron / 100); Assert.AreEqual(BioMassCalc.CalculateIonMz(mass, i + 1), tranNode.Mz, BioMassCalc.MassElectron / 100); } //Make sure the rest of the transitions aren't reporter ions for (int i = 3; i < 7; i++) { Transition tran = docReporterIon.MoleculeTransitions.ElementAt(i).Transition; Assert.AreNotEqual(tran.CustomIon, reporterIons); } var optionalIon = new MeasuredIon(hydrogenPeroxide, formula, null, null, 1, true); SrmDocument optionalDoc = docPeptide.ChangeSettings(docPeptide.Settings.ChangeTransitionFilter(filter => filter.ChangeMeasuredIons(new[] { optionalIon }))); Assert.AreEqual(3, optionalDoc.PeptideTransitionCount); optionalDoc = optionalDoc.ChangeSettings(optionalDoc.Settings.ChangeTransitionFilter(filter => filter.ChangeMeasuredIons(new[] { optionalIon.ChangeIsOptional(false) }))); AssertEx.IsDocumentTransitionCount(optionalDoc, 4); Assert.AreEqual(optionalIon.ChangeIsOptional(false).CustomIon, optionalDoc.MoleculeTransitions.ElementAt(0).Transition.CustomIon); optionalDoc = optionalDoc.ChangeSettings( optionalDoc.Settings.ChangeTransitionFilter( filter => filter.ChangeMeasuredIons(new[] { optionalIon.ChangeIsOptional(true) }))); TransitionGroupDocNode nodeGroup = optionalDoc.MoleculeTransitionGroups.ElementAt(0); var filteredNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, optionalDoc.Settings, optionalDoc.Molecules.ElementAt(0).ExplicitMods, true) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, optionalIon.CustomIon)); var unfilteredNodes = TransitionGroupTreeNode.GetChoices(nodeGroup, optionalDoc.Settings, optionalDoc.Molecules.ElementAt(0).ExplicitMods, false) .Cast <TransitionDocNode>() .Where(node => Equals(node.Transition.CustomIon, optionalIon.CustomIon)); Assert.AreEqual(0, filteredNodes.Count()); Assert.AreEqual(1, unfilteredNodes.Count()); }