protected override void DoTest()
        {
            RunUI(() => SkylineWindow.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));

            // Inserting a Transition List, p. 5
            {
                var doc = SkylineWindow.Document;

                SetCsvFileClipboardText(GetTestPath("Energy_TransitionList.csv"));
                RunUI(() =>
                {
                    SkylineWindow.Paste();
                    AdjustSequenceTreePanelWidth();
                });

                PauseForScreenShot <SkylineWindow>("Main window after paste from csv", 5);

                var docTargets = WaitForDocumentChange(doc);

                AssertEx.IsDocumentState(docTargets, null, 3, 18, 36, 36);
                Assert.IsFalse(docTargets.MoleculeTransitions.Any(t => t.Transition.IsPrecursor()));

                {
                    var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                    RunUI(() =>
                    {
                        // Predicition Settings
                        transitionSettingsUI.SelectedTab      = TransitionSettingsUI.TABS.Prediction;
                        transitionSettingsUI.RegressionCEName = "Waters Xevo"; // Collision Energy
                    });
                    PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings - Prediction tab", 6);


                    RunUI(() =>
                    {
                        // Filter Settings
                        transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter;
                        transitionSettingsUI.SmallMoleculePrecursorAdducts = Adduct.M_MINUS.AdductFormula;
                        transitionSettingsUI.SmallMoleculeFragmentAdducts  = Adduct.M_MINUS.AdductFormula;
                        transitionSettingsUI.SmallMoleculeFragmentTypes    = TransitionFilter.SMALL_MOLECULE_FRAGMENT_CHAR;
                    });
                    PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings -Filter tab", 7);

                    OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                    WaitForDocumentChange(docTargets);
                }

                RunUI(() => SkylineWindow.SaveDocument(GetTestPath("EnergyMet.sky")));


                // Export method - 2 minutes
                {
                    var exportMethodDlg2 = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.Method));
                    RunUI(() =>
                    {
                        exportMethodDlg2.InstrumentType = ExportInstrumentType.WATERS_XEVO_TQ;
                        exportMethodDlg2.MethodType     = ExportMethodType.Standard;
                        exportMethodDlg2.RunLength      = 2;
                        exportMethodDlg2.SetTemplateFile("VerifyETemplate.exp");
                    });
                    PauseForScreenShot <ExportMethodDlg>("Exporting 2 minute method", 9);
                    OkDialog(exportMethodDlg2, exportMethodDlg2.CancelDialog);
                }

                // Export transition list
                {
                    var exportTransitionList = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                    RunUI(() =>
                    {
                        exportTransitionList.InstrumentType = ExportInstrumentType.WATERS_XEVO_TQ;
                        exportTransitionList.MethodType     = ExportMethodType.Standard;
                        exportTransitionList.RunLength      = 2;
                    });
                    PauseForScreenShot <ExportMethodDlg>("Exporting transition list", 10);
                    OkDialog(exportTransitionList, exportTransitionList.CancelDialog);
                }

                using (new WaitDocumentChange(1, true))
                {
                    var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                    var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                                      importResultsDlg1.GetDataSourcePathsFile(null));
                    RunUI(() =>
                    {
                        openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Unscheduled"));
                        openDataSourceDialog1.SelectAllFileType(ExtWatersRaw);
                    });
                    PauseForScreenShot <OpenDataSourceDialog>("Import Results Files form", 11);
                    OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);

                    var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                    PauseForScreenShot <ImportResultsNameDlg>("Import Results common name form", 12);
                    OkDialog(importResultsNameDlg, importResultsNameDlg.OkDialog);
                    OkDialog(importResultsDlg1, importResultsDlg1.OkDialog);
                }

                SelectNode(SrmDocument.Level.Molecules, 0);
                SelectNode(SrmDocument.Level.MoleculeGroups, 0);

                PauseForScreenShot <SkylineWindow>("Skyline window multi-target graph", 13);

                // Renaming replicates
                {
                    var      manageResultsDlg = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);
                    string[] repNames         = new[] { "2 min", "5 min" };
                    RunUI(() => manageResultsDlg.Left = SkylineWindow.Right + 50);
                    for (var i = 0; i < 2; i++)
                    {
                        doc = SkylineWindow.Document;
                        var chromatograms = doc.Settings.MeasuredResults.Chromatograms;
                        var chrom         = chromatograms[i];
                        RunUI(() =>
                        {
                            manageResultsDlg.SelectedChromatograms = new[] { chrom };
                        });

                        var renameDlg = ShowDialog <RenameResultDlg>(manageResultsDlg.RenameResult);
                        RunUI(() => renameDlg.ReplicateName = repNames[i]);
                        if (i == 0)
                        {
                            PauseForScreenShot <SkylineWindow>("Manage Results and Rename Replicate (PrtScn and select in Paint)", 14);
                        }
                        OkDialog(renameDlg, renameDlg.OkDialog);
                    }
                    OkDialog(manageResultsDlg, manageResultsDlg.OkDialog);
                }

                PauseForScreenShot <SkylineWindow>("Skyline window (renamed)", 15);

                var docResults = SkylineWindow.Document;

                var msg = "";
                foreach (var chromatogramSet in docResults.Settings.MeasuredResults.Chromatograms)
                {
                    try
                    {
                        AssertResult.IsDocumentResultsState(docResults, chromatogramSet.Name, 18, 18, 18, 18, 18);
                    }
                    catch (Exception x)
                    {
                        msg += TextUtil.LineSeparate(x.Message);
                    }
                }
                if (!string.IsNullOrEmpty(msg))
                {
                    Assert.IsTrue(string.IsNullOrEmpty(msg), msg);
                }
                RunUI(() =>
                {
                    SkylineWindow.ShowPeakAreaReplicateComparison();
                    SkylineWindow.ShowRTReplicateGraph();
                    SkylineWindow.ArrangeGraphsTiled();
                });
                RestoreViewOnScreen(16);
                SelectNode(SrmDocument.Level.MoleculeGroups, 0);
                WaitForGraphs();
                RunUI(() =>
                {
                    SkylineWindow.Size = new Size(1054, 587);
                    AdjustSequenceTreePanelWidth(true);
                });

                PauseForScreenShot <SkylineWindow>("Skyline window multi-replicate layout", 16);

                // Set zoom to show better peak separation in 5 minute run
                for (var i = 0; i < 2; i++)
                {
                    WaitForGraphs();
                    RunUI(() => SkylineWindow.GraphChromatograms.ToArray()[i].ZoomTo(.8, 1.8, 1.39e+8));
                    WaitForGraphs();
                }
                PauseForScreenShot <SkylineWindow>("Skyline window showing relative peak separation", 17);

                // Set time window
                {
                    var peptideSettingsDlg = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                    RunUI(() =>
                    {
                        // ReSharper disable once RedundantCast
                        peptideSettingsDlg.SelectedTab = (PeptideSettingsUI.TABS) 0; //regular enum does not work because of the hidden tabs in the Small Molecule mode.
                        peptideSettingsDlg.TimeWindow  = 1;
                    });
                    PauseForScreenShot <PeptideSettingsUI>("Setting scheduled transition list time window", 18);
                    OkDialog(peptideSettingsDlg, peptideSettingsDlg.OkDialog);
                }

                // Export transition list
                {
                    var exportTransitionList = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                    RunUI(() =>
                    {
                        exportTransitionList.InstrumentType = ExportInstrumentType.WATERS_XEVO_TQ;
                        exportTransitionList.MethodType     = ExportMethodType.Scheduled;
                        exportTransitionList.OptimizeType   = ExportOptimize.NONE;
                    });
                    PauseForScreenShot <ExportMethodDlg>("Exporting scheduled transition list", 19);

                    var schedulingOptionsDlg = ShowDialog <SchedulingOptionsDlg>(() => exportTransitionList.OkDialog(GetTestPath("EnergyMet_5minutes_scheduled.csv")));
                    RunUI(() =>
                    {
                        schedulingOptionsDlg.Algorithm    = ExportSchedulingAlgorithm.Single;
                        schedulingOptionsDlg.ReplicateNum = 1;  // 5 min
                    });
                    PauseForScreenShot <SchedulingOptionsDlg>("Exporting scheduled transition list - choose replicate", 19);
                    OkDialog(schedulingOptionsDlg, schedulingOptionsDlg.OkDialog);
                    WaitForClosedForm(exportTransitionList);
                }

                using (new WaitDocumentChange(1, true))
                {
                    var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                    var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                                      importResultsDlg1.GetDataSourcePathsFile(null));
                    RunUI(() =>
                    {
                        openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Scheduled"));
                        openDataSourceDialog1.SelectAllFileType(ExtWatersRaw);
                    });
                    OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);

                    var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                    RunUI(() => importResultsNameDlg.IsRemove = false);
                    PauseForScreenShot <ImportResultsNameDlg>("Import Results common name form, not changing names", 20);
                    OkDialog(importResultsNameDlg, importResultsNameDlg.OkDialog);
                }

                // Remove 2 minute gradient
                // Renaming replicates
                string[] newNames = { "1:1_1", "1:1_2", "2:1_2", "1:2_2" };
                {
                    var manageResultsDlg = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);
                    SelectReplicate(manageResultsDlg, 0);

                    PauseForScreenShot <SkylineWindow>("Manage Results removing 2 min", 21);

                    RunUI(manageResultsDlg.RemoveReplicates);

                    for (var i = 0; i < newNames.Length; i++)
                    {
                        SelectReplicate(manageResultsDlg, i + 1);
                        RunDlg <RenameResultDlg>(manageResultsDlg.RenameResult, renameDlg =>
                        {
                            renameDlg.ReplicateName = newNames[i];
                            renameDlg.OkDialog();
                        });
                    }

                    PauseForScreenShot <SkylineWindow>("Manage Results replicate renamed", 22);
                    OkDialog(manageResultsDlg, manageResultsDlg.OkDialog);
                }

                SelectNode(SrmDocument.Level.Molecules, 0);
                RunUI(() =>
                {
                    var molNode = SkylineWindow.SelectedNode;
                    molNode.Expand();
                    Assert.AreEqual(2, molNode.Nodes.Count);
                    molNode.Nodes[0].Expand();
                    molNode.Nodes[1].Expand();
                    SkylineWindow.ArrangeGraphsTabbed();
                });
                PauseForScreenShot <SkylineWindow>("Skyline window with calibration data", 23);

                // Linearity
                var documentGrid = ShowDialog <DocumentGridForm>(() => SkylineWindow.ShowDocumentGrid(true));
                RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates));

                double[] concentrations      = { 1, 1, 2, 0.5 };
                var      namedConcentrations = newNames.Select((n, i) => new Tuple <string, double?>(n, concentrations[i]));
                SetDocumentGridSampleTypesAndConcentrations(namedConcentrations.ToDictionary(t => t.Item1,
                                                                                             t => new Tuple <SampleType, double?>(SampleType.STANDARD, t.Item2)));
                RunUI(() =>
                {
                    var gridFloatingWindow  = documentGrid.Parent.Parent;
                    gridFloatingWindow.Size = new Size(370, 230);
                    gridFloatingWindow.Top  = SkylineWindow.Top;
                    gridFloatingWindow.Left = SkylineWindow.Right + 20;
                });
                PauseForScreenShot <DocumentGridForm>("Document Grid - sample types and concentrations ", 23);
                RunUI(() => SkylineWindow.ShowDocumentGrid(false));

                using (new WaitDocumentChange(1, true))
                {
                    // Quant settings
                    var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

                    RunUI(() =>
                    {
                        // ReSharper disable once RedundantCast
                        peptideSettingsUI.SelectedTab              = (PeptideSettingsUI.TABS) 3;
                        peptideSettingsUI.QuantRegressionFit       = RegressionFit.LINEAR;
                        peptideSettingsUI.QuantNormalizationMethod =
                            new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                        peptideSettingsUI.QuantUnits = "ratio to heavy";
                    });

                    PauseForScreenShot <PeptideSettingsUI.QuantificationTab>("Peptide Settings - Quantitation", 24);
                    OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
                }

                var calibrationForm = ShowDialog <CalibrationForm>(() => SkylineWindow.ShowCalibrationForm());
                RunUI(() =>
                {
                    var calibrationFloatingWindow   = calibrationForm.Parent.Parent;
                    calibrationFloatingWindow.Width = 565;
                    calibrationFloatingWindow.Top   = SkylineWindow.Top;
                    calibrationFloatingWindow.Left  = SkylineWindow.Right + 20;
                });
                PauseForScreenShot <CalibrationForm>("Calibration Curve ", 25);
                OkDialog(calibrationForm, calibrationForm.Close); // Hide the calibration window

                {
                    var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                    RunUI(() => transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Prediction);
                    var editCurrentCE = ShowDialog <EditCEDlg>(transitionSettingsUI.EditCECurrent);
                    RunUI(() =>
                    {
                        editCurrentCE.StepSize  = 2;
                        editCurrentCE.StepCount = 5;
                    });
                    PauseForScreenShot <EditCEDlg>("Edit Collision Energy Equation form", 26);

                    RunUI(() =>
                    {
                        editCurrentCE.OkDialog();
                        transitionSettingsUI.UseOptimized = true;
                        transitionSettingsUI.OptimizeType = OptimizedMethodType.Transition.GetLocalizedString();
                    });
                    PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings - Prediction tab", 27);
                    OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                }

                // Export transition lists
                {
                    var exportTransitionList = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                    RunUI(() =>
                    {
                        exportTransitionList.ExportStrategy = ExportStrategy.Buckets;
                        exportTransitionList.IgnoreProteins = true;
                        exportTransitionList.MaxTransitions = 100;
                        exportTransitionList.InstrumentType = ExportInstrumentType.WATERS_XEVO_TQ;
                        exportTransitionList.MethodType     = ExportMethodType.Scheduled;
                        exportTransitionList.OptimizeType   = ExportOptimize.CE;
                    });
                    PauseForScreenShot <ExportMethodDlg>("Exporting scheduled transition list", 28);

                    var scheduleDlg = ShowDialog <SchedulingOptionsDlg>(() => exportTransitionList.OkDialog(GetTestPath("EnergyMet_5minutes_ceopt.csv")));
                    PauseForScreenShot <SchedulingOptionsDlg>("Scheduling", 29);
                    OkDialog(scheduleDlg, scheduleDlg.OkDialog);
                }

                // Import CE optimization runs
                using (new WaitDocumentChange(1, true))
                {
                    var importResultsDlg1 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                    RunUI(() =>
                    {
                        importResultsDlg1.RadioCreateMultipleChecked = true;
                        importResultsDlg1.OptimizationName           = ExportOptimize.CE;
                        importResultsDlg1.ReplicateName = "CE Optimization";
                    });
                    PauseForScreenShot <ImportResultsDlg>("Setting new replicate name to CE Optimization", 30);
                    var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.OkDialog());
                    RunUI(() =>
                    {
                        openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("CE Optimization"));
                        openDataSourceDialog1.SelectAllFileType(ExtWatersRaw);
                    });
                    PauseForScreenShot <OpenDataSourceDialog>("Import Results Files form", 31);
                    OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);
                }

                PauseForScreenShot <SkylineWindow>("Skyline shows new replicate \"CE Optimization\"", 32);
                RunUI(() =>
                {
                    SkylineWindow.Size = new Size(1600, 960);
                    SkylineWindow.ShowGraphRetentionTime(false, GraphTypeSummary.replicate);
                    SkylineWindow.AutoZoomBestPeak();
                    AdjustSequenceTreePanelWidth();
                    SkylineWindow.ShowSingleTransition();
                    SkylineWindow.ShowSplitChromatogramGraph(true);
                });
                PauseForScreenShot <SkylineWindow>("Split graph", 33);

                RunUI(() =>
                {
                    SkylineWindow.ShowPeakAreaLegend(false);
                });
                PauseForScreenShot <SkylineWindow>("No legend", 34);

                // Show Pentose-P
                SelectNode(SrmDocument.Level.Molecules, 6);
                PauseForScreenShot <SkylineWindow>("Pentose-P", 35);

                if (IsCoverShotMode)
                {
                    RunUI(() =>
                    {
                        Settings.Default.ChromatogramFontSize = 14;
                        Settings.Default.AreaFontSize         = 14;
                        SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                        SkylineWindow.ShowChromatogramLegends(false);
                    });

                    RestoreCoverViewOnScreen();
                    TakeCoverShot();
                    return;
                }

                // Export final transition list
                {
                    var exportTransitionList = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                    RunUI(() =>
                    {
                        exportTransitionList.ExportStrategy = ExportStrategy.Single;
                        exportTransitionList.IgnoreProteins = true;
                        exportTransitionList.MaxTransitions = 100;
                        exportTransitionList.InstrumentType = ExportInstrumentType.WATERS_XEVO_TQ;
                        exportTransitionList.MethodType     = ExportMethodType.Scheduled;
                    });
                    PauseForScreenShot <ExportMethodDlg>("Exporting final optimized transition list", 36);

                    var scheduleDlg = ShowDialog <SchedulingOptionsDlg>(() => exportTransitionList.OkDialog(GetTestPath("EnergyMet_5minutes_optimal.csv")));
                    PauseForScreenShot <SchedulingOptionsDlg>("Final Scheduling", 37);
                    OkDialog(scheduleDlg, scheduleDlg.OkDialog);
                }
            }
        }
예제 #2
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));

            //   •	On the Settings menu, click Default.
            //   •	Click No on the form asking if you want to save the current settings.
            RunUI(() => SkylineWindow.ResetDefaultSettings());

            var doc = SkylineWindow.Document;

            //   •	On the Settings menu, click Transition Settings.
            //   •	Click the Filter tab.
            var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(() =>
                                                                         SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Filter));

            //   •	This data was collected in negative ionization mode so [M+H] and[M +] can be removed from the Precursor Adducts and Fragment Adducts fields. However, they are harmless if left as is since the library we will use has only negative ion mode entries.
            //   •	In the Precursor Adducts field, enter “[M-H], [M+HCOO], [M+CH3COO]”.
            //   •	In the Fragment Adducts field, enter “[M-]”.
            RunUI(() =>
            {
                transitionSettingsUI.SmallMoleculePrecursorAdducts = "[M-H], [M+HCOO], [M+CH3COO]";
                transitionSettingsUI.SmallMoleculeFragmentAdducts  = "[M-]";
                transitionSettingsUI.SmallMoleculeFragmentTypes    = "f, p";
                transitionSettingsUI.Left = SkylineWindow.Right + 20;
            });
            //   •	The Transition Settings form should now look like this:
            PauseForScreenShot <TransitionSettingsUI.FilterTab>("Transition Settings: Filter", 3);

            RunUI(() =>
            {
                //   •	Click the Full-Scan tab in the Transition Settings form.
                transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.FullScan;
                //   •	 In the MS1 filtering section, set the Isotope peaks included field to Count.
                transitionSettingsUI.PrecursorIsotopesCurrent = FullScanPrecursorIsotopes.Count;
                //   •	Set the Precursor mass analyzer field to TOF.
                transitionSettingsUI.PrecursorMassAnalyzer = FullScanMassAnalyzerType.tof;
                //   •	Enter “20,000” in the Resolving power field.
                transitionSettingsUI.PrecursorRes = 20000;
                //   •	In the MS/MS filtering section, set the Acquisition method field to DIA.
                transitionSettingsUI.AcquisitionMethod = FullScanAcquisitionMethod.DIA;
                //   •	Set the Isolation scheme field to All Ions.
                transitionSettingsUI.IsolationSchemeName = IsolationScheme.SpecialHandlingType.ALL_IONS;
                //   •	Enter “20,000” in the Resolving power field.
                transitionSettingsUI.ProductRes = 20000;
                //   •	Check Use high-selectivity extraction.
                transitionSettingsUI.UseSelectiveExtraction = true;
            });

            //   The Transition Settings form should look like this:
            PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Transition Settings - Full-Scan", 4);
            //   •	Click the OK button.
            OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
            doc = WaitForDocumentChange(doc);

            //   Adding and Exploring a Spectral Library
            // Before you can explore the library, Skyline must be directed to its location by adding your library of interest to the global list of libraries for document editing.
            //   To get started with the small molecule library containing Drosophila lipids perform the following steps:
            //   •	From the Settings menu, click Molecule Settings.
            //   •	Click the Library tab.
            var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(() =>
                                                                   SkylineWindow.ShowPeptideSettingsUI(PeptideSettingsUI.TABS.Library));
            //   •	Click the Edit List button.
            var libListDlg =
                ShowDialog <EditListDlg <SettingsListBase <LibrarySpec>, LibrarySpec> >(peptideSettingsUI.EditLibraryList);
            //   •	Click the Add button in the Edit Libraries form.
            var addLibDlg        = ShowDialog <EditLibraryDlg>(libListDlg.AddItem);
            var drosophilaLipids = "Drosophila Lipids";

            RunUI(() =>
            {
                //   •	Enter “Drosophila Lipids” in the Name field of the Edit Library form.
                addLibDlg.LibraryName = drosophilaLipids;
                //   •	Click the Browse button.
                //   •	Navigate to the SmallMoleculeLibraries folder created earlier.
                //   •	Select the “Drosophila_Lipids_Neg.blib” file.
                addLibDlg.LibraryPath = GetFullDataPath("Drosophila_Lipids_Neg.blib");
            });
            //   •	Click the Open button.
            //   •	Click the OK button in the Edit Library form.
            OkDialog(addLibDlg, addLibDlg.OkDialog);
            //   •	Click the OK button in the Edit Libraries form.
            OkDialog(libListDlg, libListDlg.OkDialog);

            //   The Libraries list in the Molecule Settings form should now contain the Drosophila Lipids library you just created.
            //   •	Check the Drosophila Lipids checkbox to tell Skyline to use this library in the current document.
            //   •	If you have any other libraries in this list checked, uncheck them now.
            RunUI(() =>
            {
                peptideSettingsUI.PickedLibraries = new[] { drosophilaLipids };
                peptideSettingsUI.Left            = SkylineWindow.Right + 20;
            });
            //   The Molecule Settings form should now look like:
            PauseForScreenShot <PeptideSettingsUI.LibraryTab>("Molecule Settings - Library", 6);
            //   •	Click the OK button in the Molecule Settings form.
            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
            doc = WaitForDocumentChangeLoaded(doc);

            //   To open the library explorer and view the contents of the library you just added, do the following:
            //   •	From the View menu, click Spectral Libraries.
            var viewLibUI = ShowDialog <ViewLibraryDlg>(SkylineWindow.ViewSpectralLibraries);

            RunUI(() =>
            {
                viewLibUI.Left = SkylineWindow.Right + 20;
                viewLibUI.Top  = SkylineWindow.Top;
            });

            //   The library explorer should now resemble the image below:
            PauseForScreenShot("Library Explorer (probably need to resize wider)", 7);

            //  To add all the molecules in the library to your target list:
            //   •	Click the Add All button.
            //   •	A popup window will then notify you that you will add 34 molecules, 38 precursors, and 246 transitions to the document. Click Add All.
            var confirmAddDlg = ShowDialog <AlertDlg>(viewLibUI.AddAllPeptides);

            using (new CheckDocumentState(1, 34, 38, 246))
            {
                RunUI(confirmAddDlg.OkDialog);
                doc = WaitForDocumentChangeLoaded(doc);
            }

            //   •	Close the Spectral Library Explorer window.
            OkDialog(viewLibUI, viewLibUI.CancelDialog);

            //   Your Skyline window should now resemble:
            RunUI(() => SkylineWindow.Size = new Size(951, 607));
            PauseForScreenShot("Populated Skyline window", 8);

            //Importing Results Chromatogram.Data
            //    In this section, you will import the Drosophila data without utilizing IMS filtering. This is an initial look at the data to see the impact of interference among lipids and their shared fragments. To import the data, perform the following steps:
            //   •	On the File menu, click Save (Ctrl+S).
            //   •	Save this document in the tutorial folder you created.
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDirs[0].GetTestPath("Tutorial.sky")));

            //   •	From the File menu, choose Import and click Results.
            using (new WaitDocumentChange(null, true))
            {
                var importResultsDlg1 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                //   •	Set the Files to import simultaneously field to Many.
                //   •	Check Show chromatograms during import.
                //   The Import Results form will appear as follows:
                RunUI(() =>
                {
                    importResultsDlg1.Top  = SkylineWindow.Top;
                    importResultsDlg1.Left = SkylineWindow.Right + 20;
                });
                PauseForScreenShot <ImportResultsDlg>("Import Results", 9);
                var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                                  importResultsDlg1.GetDataSourcePathsFile(null));
                //   •	Click the OK button.
                //   The Import Results Files form will now show the.d files you have extracted into the tutorial folder:
                //   •	Select both .d files.
                RunUI(() =>
                {
                    var path = Path.GetDirectoryName(GetFullDataPath(Flies_M));
                    openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(path);
                    openDataSourceDialog1.SelectAllFileType(ExtAgilentRaw);
                    openDataSourceDialog1.Left = importResultsDlg1.Left;
                    openDataSourceDialog1.Top  = importResultsDlg1.Bottom + 10;
                });
                PauseForScreenShot <OpenDataSourceDialog>("Import Results Files selection form", 10);
                OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);

                //   •	Click the Open button.
                //   •	The Import Results window will ask if you would like to remove the common prefix and suffix to shorten the file names used in Skyline.Click OK to accept the names “F_A_018” and “M_A_001”.
                //This should start the import and cause Skyline to show the Importing Results progress form:
                var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                OkDialog(importResultsNameDlg, importResultsNameDlg.OkDialog);
                var allChromatograms = WaitForOpenForm <AllChromatogramsGraph>();
                RunUI(() =>
                {
                    allChromatograms.Top  = SkylineWindow.Top;
                    allChromatograms.Left = SkylineWindow.Right + 20;
                });
                PauseForScreenShot <AllChromatogramsGraph>("Importing results form", 11);
            }

            WaitForGraphs();

            //Reviewing the Extracted Ion Chromatograms
            //    Once the files are imported, you can examine the chromatograms to evaluate interference from peaks with retention times and m/z values within the tolerance of your target list.
            RunUI(() =>
            {
                //   •	From the Edit menu, choose Expand All and click Molecules (Ctrl+D).
                SkylineWindow.ExpandPeptides();
                SkylineWindow.SetDisplayTypeChrom(DisplayTypeChrom.all);
                //   •	From the View menu, choose Arrange Graphs and click Tiled (Ctrl+T).
                SkylineWindow.ArrangeGraphs(DisplayGraphsType.Row); // With just two panes, Tiled may go either row or column, force row
                //   •	Right-click in a chromatogram graph and click Synchronize Zooming(leave if already checked).
                SkylineWindow.SynchronizeZooming(true);
                // •	Right-click in a chromatogram graph and click Legend to hide the legend.
                SkylineWindow.ShowChromatogramLegends(false);
                //   •	Right-click in a chromatogram graph, choose Transitions and click Split Graph (leave if already checked).
                SkylineWindow.ShowSplitChromatogramGraph(true);
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.Size = new Size(1487, 786);
            });
            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, propDlg =>
            {
                propDlg.IsPeakWidthRelative = false;
                propDlg.TimeRange           = 7; // minutes
                propDlg.OkDialog();
            });
            //  •	Select the molecule PC(16:0_18:1) and your spectra should appear as:
            FindNode("PC(16:0_18:1)");
            PauseForScreenShot("Chromatograms - prtsc-paste-edit", 12);

            RestoreViewOnScreen(13);
            var libraryMatchView = WaitForOpenForm <GraphSpectrum>();

            RunUI(() => libraryMatchView.ZoomXAxis(100, 400));
            PauseForScreenShot("Library Match", 13);

            //Since there are only 38 precursors in this document, you may want to review all 38 to get an overall feel for how the XIC look prior to IMS filtering.Before starting this review, do the following:
            //   •	On the View menu, choose Retention Times and click Replicate Comparison (F8).
            //   •	Attach the Retention Times view to the left of the Library Match view by clicking in the title bar and dragging until the mouse cursor is inside the left-side docking icon.
            RunUI(() =>
            {
                SkylineWindow.ShowGraphRetentionTime(true, GraphTypeSummary.replicate);
                //   •	Right-click in the Retention Times view and click Legend to hide the legend in this graph.
                SkylineWindow.ShowRTLegend(false);
            });

            //   •	From the View menu, choose Peak Areas and click Replicate Comparison (F7).
            RestoreViewOnScreen(14);

            //   •	Attach the Peak Areas view above the Retention Times view by clicking in the title bar and dragging until the mouse cursor is inside the up-side docking icon.
            //    You should end up with a similar layout to that below:
            RunUI(() =>
            {
                SkylineWindow.Size = new Size(1310, 786);
            });
            if (IsPauseForScreenShots)
            {
                // Change selected node away and back to adjust graphs
                TreeNode selectedNode = null;
                RunUI(() => selectedNode = SkylineWindow.SequenceTree.SelectedNode);
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.NextNode);
                WaitForGraphs();
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = selectedNode);
                WaitForGraphs();
                PauseForScreenShot("Main window", 14);
            }

            //Skyline often does a good job picking peaks and most integration boundaries do not need to be edited.However, there are a few isomer pairs that require some manual peak picking.
            //    The first two cases are the lysophospholipids (LPC and LPE), which are phospholipids with one fatty acyl chain cleaved off.These molecules chromatographically separate depending on the sn- position of the single fatty acyl chain.Here the library match ID retention time markers can be utilized to determine the elution order of the LPC(0:0/18:2)/LPC(18:2/0:0) and LPE(0:0/16:0)/LPE(16:0/0:0) pairs.Drag the integration boundaries with your mouse to integrate the correct peaks.Note that male and female fruit flies have vastly different lysophospholipid profiles, which was also observed across almost all lysophospholipids in a larger Drosophila study.
            //    The final isomer pair is near the bottom of the document. PG(16:0_18:3) and PG(16:1_18:2) have different fatty acyl compositions, but the same total number of carbons and double bonds, causing them to share the same precursor formula and m/z value.Again, use the library match ID retention time markers to determine the correct peak for each lipid. To integrate the correct peaks, either drag the integration boundaries with your mouse or click the retention time above the peak apex.The product XIC may not be useful until IMS filtering is utilized.
            //

            //Understanding and Utilizing the IMS Separation
            //To this point, we have ignored the IMS dimension in this data.To better understand the IMS separation, you need to look at the underlying spectra from which these chromatograms were extracted by doing the following:
            //   •	On the View menu, choose Auto-Zoom and click Best Peak (F11).
            //   •	Select the molecule PE(16:1_18:3).
            FindNode("PE(16:1_18:3)");
            WaitForGraphs();
            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, propDlg =>
            {
                propDlg.IsPeakWidthRelative = true;
                propDlg.TimeRange           = 3.4; // widths
                propDlg.OkDialog();
            });
            WaitForGraphs();
            PauseForScreenShot("Chromatogram", 15);

            //   •	Hover the mouse cursor over the precursor chromatogram peak apex until a blue circle appears that tracks the mouse movement, and click on it.
            ClickChromatogram(F_A_018, 14.81, 162.1E3, PaneKey.PRECURSORS);
            //   This should bring up the Full-Scan view showing a familiar two-dimensional spectrum in profile mode:
            RunUI(() => SkylineWindow.GraphFullScan.SetSpectrum(true));
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(true));
            PauseForScreenShot("2D plot", 16);

            //   •	Click the Show 2D Spectrum button  to change the plot to a three-dimensional spectrum with drift time.
            RunUI(() => SkylineWindow.GraphFullScan.SetSpectrum(false));
            PauseForScreenShot("3D plot", 16);

            //   •	Click the Zoom to Selection button to see the entire 3D MS1 spectrum at the selected retention time.
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(false));
            PauseForScreenShot("3D plot full range", 17);

            //    This is a fairly typical MS1 spectrum for IMS-MS lipidomics data.You can get a better sense of the data by zooming into multiple areas on this plot.You can also select other lipids and click on the blue circle at the apex of each precursor chromatogram peak to see how this plot can differ with retention time. An interesting example is PE(O-18:0/16:1), which has distinct ion distributions showing correlations between m/z and drift time for different lipid classes.
            //    To inspect a relevant MS/MS spectrum:
            //   •	Re-select the molecule PE(16:1_18:3) if you navigated away from it to view other MS1 spectra.
            FindNode("PE(16:1_18:3)");
            //   •	Click on the Zoom to Selection button to zoom back in.
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(true));
            WaitForGraphs();
            //   •	Hover the mouse over the FA 18:3(+O) fragment chromatogram peak apex until a teal colored circle appears that tracks the mouse movement, and click on it.
            ClickChromatogram(F_A_018, 14.83, 120.5E3, PaneKey.PRODUCTS);
            //   The Full-Scan graph should change to:
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(true));
            PauseForScreenShot("3D plot MSMS zoomed", 18);


            //You can see that at least three visible ions are contributing to the extracted intensities at 33, 37, and 44 ms.This goes back to the nature of lipid fragmentation as previously discussed, where most lipids with an 18:3 fatty acyl chain will share this fragment.The complexity is increased for fatty acyl chains fragments with fewer double bonds, such as 18:2 at m/z 279, which may have multiple ions as well as isotopic overlap from the abundant 18:3 fragment at m/z 277 contributing to the extracted intensity.A similar observation can be made with the FA 16:1(+O) fragment.
            //   •	Click the Zoom to Selection button again to see the entire 3D MS/MS spectrum.
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(false));
            PauseForScreenShot("3D plot MSMS full range", 18);


            //    Reimporting Data with Drift Time Filtering

            // Prior to changing the settings and reimporting the data, you may want to save the current Skyline document and create a second file in order to compare the data before and after IMS filtering. To do so:
            //    •	On the File menu, click Save As...
            //    •	Save the file with a different name than your original Skyline document, such as “Drosophila_Lipids_Neg_IMS_Filtered”, in the tutorial folder you created.
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDirs[0].GetTestPath(@"Drosophila_Lipids_Neg_IMS_Filtered.sky")));
            RunUI(() => SkylineWindow.Width -= 300);

            //   •	From the Settings menu, click Transition Settings.
            //   •	Click the Ion Mobility tab.
            transitionSettingsUI = ShowDialog <TransitionSettingsUI>(() =>
                                                                     SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.IonMobility));

            //   •	Check Use spectral library ion mobility values when present.
            //   •	Set the Window Type field to Resolving power.
            //   •	In the Resolving power field, enter “50”.
            RunUI(() =>
            {
                // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                transitionSettingsUI.IonMobilityControl.IsUseSpectralLibraryIonMobilities = true;
                transitionSettingsUI.IonMobilityControl.IonMobilityFilterResolvingPower   = 50;
                transitionSettingsUI.IonMobilityControl.WindowWidthType =
                    IonMobilityWindowWidthCalculator.IonMobilityWindowWidthType.resolving_power;
                transitionSettingsUI.Left = SkylineWindow.Right + 20;
            });
            //   •	The Transition Settings form should now look like this:
            PauseForScreenShot <TransitionSettingsUI.IonMobilityTab>("Transition Settings: IonMobility", 20);            //The Transition Settings should now look like:


            //   •	Click the OK button.
            OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
            WaitForDocumentChange(doc);

            //   The results must now be reimported with the newly applied IMS settings.
            //   •	From the Edit menu, click Manage Results.
            //   •	Click the Re-import button. “*” Should appear to the left of F_A_018.
            //   •	Select M_A_001 in the Manage Results view.
            //   •	Click the Re-import button. “*” Should appear to the left of M_A_001.
            //   •	Click the OK button.
            doc = SkylineWindow.Document;
            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageDlg =>
            {
                manageDlg.SelectedChromatograms = SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.ToArray();
                manageDlg.ReimportResults();
                manageDlg.OkDialog();
            });
            //   This should start the re-import and cause Skyline to show the Importing Results progress form.
            WaitForDocumentChangeLoaded(doc);

            //   •	Click any other lipid in the Target list and re-select PE(16:1_18:3) to update the chromatograms.
            FindNode("PC(16:0_18:1)");
            WaitForGraphs();
            FindNode("PE(16:1_18:3)");
            WaitForGraphs();
            //   To explore the filtered data, perform the following:
            //   •	Click on the apex of the blue precursor chromatogram to show the Full-Scan graph.
            //   •	Click the Zoom to Selection button.
            RunUI(() => SkylineWindow.GraphFullScan.ZoomToSelection(true));
            //   The Full-Scan graph should now look something like this:
            ClickChromatogram(F_A_018, 14.807, 152.0E3, PaneKey.PRECURSORS);

            if (IsCoverShotMode)
            {
                RestoreCoverViewOnScreen();
                // Need to click again to get the full-scan graph populated after restoring view
                ClickChromatogram(F_A_018, 14.807, 152.0E3, PaneKey.PRECURSORS);
                TakeCoverShot();
                return;
            }

            PauseForScreenShot("Full scan graph with IM filtering", 21);

            // Note that if you were interested in lipids that are not present in the current spectral library, you can add to it manually or using LipidCreator. To access the LipidCreator plugin, do the following:
            //   •	From the Tools menu, click Tool Store.
            if (IsPauseForScreenShots)
            {
                RunUI(() =>
                {
                    SkylineWindow.GraphFullScan.Close();
                    SkylineWindow.Width -= 300;
                });
                var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg);
                //   •	Select LipidCreator.
                var pick = ShowDialog <ToolStoreDlg>(configureToolsDlg.AddFromWeb);
                RunUI(() =>
                {
                    pick.SelectTool("LipidCreator");
                    pick.Left = SkylineWindow.Right + 20;
                });
                PauseForScreenShot("LipidCreator in tool store", 22);
                RunUI(() => pick.CancelDialog());
                OkDialog(configureToolsDlg, configureToolsDlg.Cancel);
                //   •	Click the Install button.
            }

            //   The following steps can be taken to easily export an updated spectral library:
            //   •	From the File menu, choose Export and click Spectral Library.
            //   •	Enter a file name and click Save.
        }
예제 #3
0
        protected override void DoTest()
        {
            TestSmallMolecules = false; // The presence of the extra test node without any results is incompatible with what's being tested here.

            // Clean-up before running the test
            RunUI(() => SkylineWindow.ModifyDocument("Set default settings",
                                                     d => d.ChangeSettings(SrmSettingsList.GetDefault())));

            SrmDocument doc = SkylineWindow.Document;

            const string documentBaseName = "Ms1FilterTutorial";
            string       documentFile     = GetTestPath(documentBaseName + SrmDocument.EXT);

            RunUI(() => SkylineWindow.SaveDocument(documentFile));

            // show the empty Transition Setting dialog
            var transitionSettingsDlg = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() => transitionSettingsDlg.SelectedTab = TransitionSettingsUI.TABS.FullScan);
            PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Transition Settings - Full-Scan tab nothing set", 2);
            OkDialog(transitionSettingsDlg, transitionSettingsDlg.OkDialog);

            // Launch the wizard
            var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg);

            // We're on the "Build Spectral Library" page of the wizard.
            // Add the test xml file to the search files list and try to
            // build the document library.
            string[] searchFiles =
            {
                GetTestPath("100803_0001_MCF7_TiB_L.group.xml"),      // Not L10N
                GetTestPath("100803_0005b_MCF7_TiTip3.group.xml")     // Not L10N
            };
            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - Build Spectral Library empty page", 3);

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage ==
                              ImportPeptideSearchDlg.Pages.spectra_page);
                importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(searchFiles);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - Build Spectral Library populated page", 4);

            var ambiguousDlg = ShowDialog <MessageDlg>(importPeptideSearchDlg.ClickNextButtonNoCheck);

            OkDialog(ambiguousDlg, ambiguousDlg.OkDialog);

            // Verify document library was built
            string docLibPath          = BiblioSpecLiteSpec.GetLibraryFileName(documentFile);
            string redundantDocLibPath = BiblioSpecLiteSpec.GetRedundantName(docLibPath);

            Assert.IsTrue(File.Exists(docLibPath) && File.Exists(redundantDocLibPath));
            var librarySettings = SkylineWindow.Document.Settings.PeptideSettings.Libraries;

            Assert.IsTrue(librarySettings.HasDocumentLibrary);

            // We're on the "Extract Chromatograms" page of the wizard.
            // All the test results files are in the same directory as the
            // document file, so all the files should be found, and we should
            // just be able to move to the next page.
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page);
            PauseForScreenShot <ImportPeptideSearchDlg.ChromatogramsPage>("Import Peptide Search - Extract Chromatograms page", 5);

            var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(() => importPeptideSearchDlg.ClickNextButton());

            PauseForScreenShot <ImportResultsNameDlg>("Import Results - Common prefix form", 6);

            OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);

            // Wait for the "Add Modifications" page of the wizard.
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.match_modifications_page);

            List <string> modsToCheck = new List <string> {
                "Phospho (ST)", "Phospho (Y)", "Oxidation (M)"
            };                                                                                              // Not L10N

            RunUI(() =>
            {
                importPeptideSearchDlg.MatchModificationsControl.CheckedModifications = modsToCheck;
            });
            PauseForScreenShot <ImportPeptideSearchDlg.MatchModsPage>("Import Peptide Search - Add Modifications page", 7);
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // We're on the "Configure MS1 Full-Scan Settings" page of the wizard.
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page);
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorCharges      = new[] { 2, 3, 4 };
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorMassAnalyzer = FullScanMassAnalyzerType.tof;
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorRes          = 10 * 1000;

                Assert.AreEqual(importPeptideSearchDlg.FullScanSettingsControl.PrecursorIsotopesCurrent, FullScanPrecursorIsotopes.Count);
                Assert.AreEqual(FullScanMassAnalyzerType.tof, importPeptideSearchDlg.FullScanSettingsControl.PrecursorMassAnalyzer);
                Assert.AreEqual(10 * 1000, importPeptideSearchDlg.FullScanSettingsControl.PrecursorRes);
                Assert.AreEqual(3, importPeptideSearchDlg.FullScanSettingsControl.Peaks);
                Assert.AreEqual(RetentionTimeFilterType.ms2_ids, importPeptideSearchDlg.FullScanSettingsControl.RetentionTimeFilterType);
                Assert.AreEqual(5, importPeptideSearchDlg.FullScanSettingsControl.TimeAroundMs2Ids);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.Ms1FullScanPage>("Import Peptide Search - Configure MS1 Full-Scan Settings page", 8);

            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // Last page of wizard - Import Fasta.
            string fastaPath = GetTestPath("12_proteins.062011.fasta");

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.import_fasta_page);
                Assert.AreEqual("Trypsin [KR | P]", importPeptideSearchDlg.ImportFastaControl.Enzyme.GetKey());
                importPeptideSearchDlg.ImportFastaControl.MaxMissedCleavages = 2;
                importPeptideSearchDlg.ImportFastaControl.SetFastaContent(fastaPath);
                Assert.IsFalse(importPeptideSearchDlg.ImportFastaControl.DecoyGenerationEnabled);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.FastaPage>("Import Peptide Search - Import FASTA page", 10);

            var peptidesPerProteinDlg = ShowDialog <PeptidesPerProteinDlg>(() => importPeptideSearchDlg.ClickNextButton());

            WaitForCondition(() => peptidesPerProteinDlg.DocumentFinalCalculated);
            RunUI(() =>
            {
                int proteinCount, peptideCount, precursorCount, transitionCount;
                peptidesPerProteinDlg.NewTargetsAll(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                Assert.AreEqual(11, proteinCount);
                Assert.AreEqual(51, peptideCount);
                Assert.AreEqual(52, precursorCount);
                Assert.AreEqual(156, transitionCount);
                peptidesPerProteinDlg.NewTargetsFinal(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                Assert.AreEqual(11, proteinCount);
                Assert.AreEqual(51, peptideCount);
                Assert.AreEqual(52, precursorCount);
                Assert.AreEqual(156, transitionCount);
            });
            OkDialog(peptidesPerProteinDlg, peptidesPerProteinDlg.OkDialog);
            PauseForScreenShot <AllChromatogramsGraph>("Loading chromatograms window", 11);
            WaitForDocumentChangeLoaded(doc, 8 * 60 * 1000); // 10 minutes

            var libraryExplorer   = ShowDialog <ViewLibraryDlg>(() => SkylineWindow.OpenLibraryExplorer(documentBaseName));
            var matchedPepModsDlg = WaitForOpenForm <AddModificationsDlg>();

            PauseForScreenShot <MultiButtonMsgDlg>("Add mods alert", 12);
            RunUI(() =>
            {
                Assert.AreEqual(13, matchedPepModsDlg.NumMatched);
                Assert.AreEqual(0, matchedPepModsDlg.NumUnmatched);
                matchedPepModsDlg.CancelDialog();
            });
            RunUI(() =>
            {
                libraryExplorer.GraphSettings.ShowBIons        = true;
                libraryExplorer.GraphSettings.ShowYIons        = true;
                libraryExplorer.GraphSettings.ShowCharge1      = true;
                libraryExplorer.GraphSettings.ShowCharge2      = true;
                libraryExplorer.GraphSettings.ShowPrecursorIon = true;
            });

            PauseForScreenShot <ViewLibraryDlg>("Spectral Library Explorer", 13);
            RunUI(() =>
            {
                const string sourceFirst = "100803_0005b_MCF7_TiTip3.wiff";
                const double timeFirst   = 35.2128;
                Assert.AreEqual(sourceFirst, libraryExplorer.SourceFile);
                Assert.AreEqual(timeFirst, libraryExplorer.RetentionTime, 0.0001);
                libraryExplorer.SelectedIndex++;
                Assert.AreNotEqual(sourceFirst, libraryExplorer.SourceFile);
                Assert.AreNotEqual(timeFirst, libraryExplorer.RetentionTime, 0.0001);
            });
            OkDialog(libraryExplorer, libraryExplorer.CancelDialog);

            const int TIB_L = 0; // index for Tib_L
            const int TIP3  = 1; // index for Tip3

            AssertEx.IsDocumentState(SkylineWindow.Document, null, 11, 51, 52, 156);
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, GetFileNameWithoutExtension(searchFiles[TIB_L]), 51, 52, 0, 156, 0);
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, GetFileNameWithoutExtension(searchFiles[TIP3]), 51, 52, 0, 156, 0);
            string Tib_LFilename = searchFiles[TIB_L].Replace(".group.xml", PreferedExtAbWiff);
            string Tip3Filename  = searchFiles[TIP3].Replace(".group.xml", PreferedExtAbWiff);

            // Select the first transition group.
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedPath =
                    SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                SkylineWindow.GraphSpectrumSettings.ShowAIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowBIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowYIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowPrecursorIon = true;
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
            });
            RunDlg <SpectrumChartPropertyDlg>(SkylineWindow.ShowSpectrumProperties, dlg =>
            {
                dlg.FontSize = GraphFontSize.NORMAL;
                dlg.OkDialog();
            });
            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, dlg =>
            {
                dlg.FontSize = GraphFontSize.NORMAL;
                dlg.OkDialog();
            });
            RunUI(() =>
            {
                // Make window screenshot size
                if (IsPauseForScreenShots && SkylineWindow.WindowState != FormWindowState.Maximized)
                {
                    SkylineWindow.Width  = 1160;
                    SkylineWindow.Height = 792;
                }
            });
            RestoreViewOnScreen(13);
            PauseForScreenShot("Main window with imported data", 14);

//            RunUIWithDocumentWait(() =>
//            {
//                SkylineWindow.ToggleIntegrateAll(); // TODO: No longer necessary.  Change in tutorial
//            });
            RunUI(() =>
            {
                SkylineWindow.ShowGraphPeakArea(true);
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.none);
                Settings.Default.ShowDotProductPeakArea = true;
                Settings.Default.ShowLibraryPeakArea    = true;
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas view (show context menu)", 16);

            RestoreViewOnScreen(15);
            RunUI(() =>
            {
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.ShowChromatogramLegends(false);
            });
            PauseForScreenShot("Main window layout", 17);

            int atest = 0;

            CheckAnnotations(TIB_L, 0, atest++);
            int pepIndex = 3;

            RunUI(() => SkylineWindow.CollapsePeptides());
            RunUI(() => SkylineWindow.ShowAlignedPeptideIDTimes(true));
            ChangePeakBounds(TIB_L, pepIndex, 38.79, 39.385);
            PauseForScreenShot("Chromatogram graphs clipped from main window", 19);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            var alignmentForm = ShowDialog <AlignmentForm>(() => SkylineWindow.ShowRetentionTimeAlignmentForm());

            RunUI(() =>
            {
                alignmentForm.Width  = 711;
                alignmentForm.Height = 561;
                alignmentForm.ComboAlignAgainst.SelectedIndex = 0;     // to match what's in the tutorial doc
            });
            PauseForScreenShot <AlignmentForm>("Retention time alignment form", 20);

            OkDialog(alignmentForm, alignmentForm.Close);
            PauseForScreenShot("Status bar clipped from main window - 4/51 pep 4/52 prec 10/156 tran", 21);

            pepIndex = JumpToPeptide("SSKASLGSLEGEAEAEASSPK");
            RunUI(() => SkylineWindow.ShowChromatogramLegends(true));
            Assert.IsTrue(8 == pepIndex);
            PauseForScreenShot("Chromatogram graph metafiles for 9th peptide", 21);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            ZoomSingle(TIP3, 32.6, 41.4); // simulate the wheel scroll described in tutorial
            PauseForScreenShot("Chromatogram graph metafile showing all peaks for 1_MCF_TiB_L", 22);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            // current TIB_L peak should have idotp .87 and ppm -6.9
            Assert.AreEqual(0.87, GetTransitionGroupChromInfo(TIB_L, pepIndex).IsotopeDotProduct ?? -1, .005);
            Assert.AreEqual(-10.8, GetTransitionChromInfo(TIB_L, pepIndex, 0).MassError ?? -1, .05);

            ChangePeakBounds(TIB_L, pepIndex, 36.5, 38.0);

            // now current TIB_L peak should have idotp .9 and ppm -6.5
            Assert.AreEqual(0.9, GetTransitionGroupChromInfo(TIB_L, pepIndex).IsotopeDotProduct ?? -1, .005);
            Assert.AreEqual(-9.4, GetTransitionChromInfo(TIB_L, pepIndex, 0).MassError ?? -1, .05);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            var undoIndex = SkylineWindow.Document.RevisionIndex; // preserve for simulating ctrl-z

            PickPeakBoth(pepIndex, 40.471035, 40.8134);           // select peak for both chromatograms at these respective retention times
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 23);

            int[] m1Thru4 = { 1, 2, 3, 4, 5 };
            PickTransitions(pepIndex, m1Thru4, "Transition pick list filtered", 24, "Transition pick list unfiltered", 24); // turn on chromatograms
            PickPeakBoth(pepIndex, 36.992836, 37.3896027);                                                                  // select peak for both chromatograms at these respective retention times
            ZoomSingle(TIP3, 32.4, 39.6);                                                                                   // set the view for screenshot
            PauseForScreenShot("Chromatogram graph metafile comparing 33 and 37 minute peaks", 25);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            RevertDoc(undoIndex);                             // undo changes
            pepIndex = JumpToPeptide("ASLGSLEGEAEAEASSPKGK"); // Not L10N
            Assert.IsTrue(10 == pepIndex);
            PauseForScreenShot("Chhromatogram graph meta files for peptide ASLGSLEGEAEAEASSPKGK", 26);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            PickTransitions(pepIndex, m1Thru4); // turn on M+3 and M+4
            ChangePeakBounds(TIP3, pepIndex, 37.35, 38.08);
            ZoomSingle(TIP3, 36.65, 39.11);     // simulate the wheel scroll described in tutorial
            PauseForScreenShot("upper - Chromatogram graph metafile for peptide ASLGSLEGEAEAEASSPKGK with adjusted integration", 27);
            CheckAnnotations(TIP3, pepIndex, atest++);

            RevertDoc(undoIndex);                              // undo changes
            pepIndex = JumpToPeptide("AEGEWEDQEALDYFSDKESGK"); // Not L10N
            PauseForScreenShot("lower - Chromatogram graph metafiles for peptide AEGEWEDQEALDYFSDKESGK", 27);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            int[] m1Thru5 = { 1, 2, 3, 4, 5, 6 };
            PickTransitions(pepIndex, m1Thru5); // turn on M+3 M+4 and M+5
            PauseForScreenShot("Chromatogram graph metafiles with M+3, M+4 and M+5 added", 28);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            JumpToPeptide("ALVEFESNPEETREPGSPPSVQR"); // Not L10N
            PauseForScreenShot("Chromatogram graph metafiles for peptide ALVEFESNPEETREPGSPPSVQR", 29);

            pepIndex = JumpToPeptide("YGPADVEDTTGSGATDSKDDDDIDLFGSDDEEESEEAKR"); // Not L10N
            PauseForScreenShot("upper - Peak Areas graph metafile for peptide YGPADVEDTTGSGATDSKDDDDIDLFGSDDEEESEEAKR", 30);

            int[] m1Thru7 = { 1, 2, 3, 4, 5, 6, 7, 8 };
            PickTransitions(pepIndex, m1Thru7); // enable [M+3] [M+4] [M+5] [M+6] [M+7]
            PauseForScreenShot("lower - Peak Areas graph metafile with M+3 through M+7 added", 30);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            // page 32 zooming setup
            RunUI(() =>
            {
                SkylineWindow.SynchronizeZooming(true);
                SkylineWindow.LockYChrom(false);
                SkylineWindow.AlignToFile = SkylineWindow.GraphChromatograms.ToArray()[TIP3].GetChromFileInfoId(); // align to Tip3
            });
            ZoomBoth(36.5, 39.5, 1600);                                                                            // simulate the wheel scroll described in tutorial
            RunUI(() => SkylineWindow.ShowChromatogramLegends(false));
            PauseForScreenShot("Chromatogram graphs clipped from main window with synchronized zooming", 32);

            RestoreViewOnScreen(33);                                                                                                      // float the  Library Match window TODO this causes a crash at next call to ChangePeakBounds, in pwiz.Skyline.Controls.Graphs.GraphChromatogram.ChromGroupInfos.get() Line 492 , why?
            RunUI(() => SkylineWindow.GraphSpectrum.SelectSpectrum(new SpectrumIdentifier(MsDataFileUri.Parse(Tip3Filename), 37.6076f))); // set the Library Match view
            PauseForScreenShot <GraphSpectrum>("Library Match graph metafile - 5b_MCF7_TiTip3 (37.61 Min)", 33);

            RunUI(() => SkylineWindow.GraphSpectrum.SelectSpectrum(new SpectrumIdentifier(MsDataFileUri.Parse(Tib_LFilename), 37.0335f))); // set the Library Match view
            PauseForScreenShot <GraphSpectrum>("Library Match graph metafile - 1_MCF_TiB_L (37.03 min)", 33);

            RestoreViewOnScreen(34);                    // back to normal view

            pepIndex = JumpToPeptide("GVVDSEDLPLNISR"); // Not L10N
            RunUI(() => SkylineWindow.ShowChromatogramLegends(true));
            PauseForScreenShot("upper - Chromatogram graph metafiles for peptide GVVDSEDLPLNISR", 34);

            ZoomBoth(35.05, 36.9, 480);
            PauseForScreenShot("lower - Chromatogram graph metafile - effect of zoom ", 34);
            ChangePeakBounds(TIP3, pepIndex, 35.7, 36.5);  // adjust integration per tutorial
            CheckAnnotations(TIP3, pepIndex, atest++);     // check the new idotp values

            /* pepIndex = */ JumpToPeptide("DQVANSAFVER"); // Not L10N
            PauseForScreenShot("Chromatogram graph metafiles for peptide DQVANSAFVER", 35);

//            int[] m1 = {2};
//            PickTransitions(pepIndex, m1); // enable [M+1] only
//            // Measured times in TIB_L are different from displayed times, because of alignment
//            ChangePeakBounds(TIB_L, pepIndex, 23.99, 25.29);
//            ChangePeakBounds(TIP3, pepIndex, 23.81, 25.21);
//            // First transition selected for screenshot
//            RunUI(() =>
//            {
//                var pathPep = SkylineWindow.SelectedPath;
//                var nodePep = ((PeptideTreeNode)SkylineWindow.SelectedNode).DocNode;
//                var nodeGroup = nodePep.TransitionGroups.First();
//                var nodeTran = nodeGroup.Transitions.First();
//                SkylineWindow.SelectedPath = new IdentityPath(
//                    new IdentityPath(pathPep, nodeGroup.TransitionGroup), nodeTran.Transition);
//            });
//            PauseForScreenShot("page 36 - M+1 only, with adjusted integration");
//            CheckAnnotations(TIB_L, pepIndex, atest++);
//            CheckAnnotations(TIP3, pepIndex, EXPECTED_ANNOTATIONS[atest]);

            var docAfter = WaitForProteinMetadataBackgroundLoaderCompletedUI();

            // Minimizing a chromatogram cache file.
            RunUI(SkylineWindow.CollapsePeptides);
            for (int i = 0; i < 5; i++) // just do the first 5
            {
                int iPeptide = i;
                var path     = docAfter.GetPathTo((int)SrmDocument.Level.Molecules, iPeptide);
                RunUI(() =>
                {
                    SkylineWindow.SelectedPath = path;
                });
                WaitForGraphs();
            }

            // Eliminate extraneous chromatogram data.
            doc = WaitForProteinMetadataBackgroundLoaderCompletedUI();
            var minimizedFile = GetTestPath("Ms1FilteringTutorial-2min.sky"); // Not L10N
            var cacheFile     = Path.ChangeExtension(minimizedFile, ChromatogramCache.EXT);

            {
                // TODO: Figure out why the minimize fails to unlock the .skyd file, if not minimized to current file
                RunUI(() => SkylineWindow.SaveDocument(minimizedFile));

                var manageResultsDlg   = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);
                var minimizeResultsDlg = ShowDialog <MinimizeResultsDlg>(manageResultsDlg.MinimizeResults);
                RunUI(() =>
                {
                    minimizeResultsDlg.LimitNoiseTime = true;
                    minimizeResultsDlg.NoiseTimeRange = 2;                                                        // Not L10N
                });
                PauseForScreenShot <MinimizeResultsDlg>("Minimize Results form (percentages vary slightly)", 36); // old p. 23

                OkDialog(minimizeResultsDlg, () => minimizeResultsDlg.MinimizeToFile(minimizedFile));
                WaitForCondition(() => File.Exists(cacheFile));
                WaitForClosedForm(manageResultsDlg);
            }
            WaitForDocumentChange(doc);

            // Inclusion list method export for MS1 filtering
            doc = SkylineWindow.Document;
            RunDlg <PeptideSettingsUI>(() => SkylineWindow.ShowPeptideSettingsUI(PeptideSettingsUI.TABS.Prediction), dlg =>
            {
                dlg.IsUseMeasuredRT = true;
                dlg.TimeWindow      = 10;
                dlg.OkDialog();
            });
            WaitForDocumentChangeLoaded(doc);

            // Now deviating from the tutorial script for a moment to make sure we can choose a Scheduled export method.
            RunDlg <RefineDlg>(SkylineWindow.ShowRefineDlg, dlg =>
            {
                dlg.MinPeptides = 1; // Not L10N
                const double minPeakFoundRatio = 0.1;
                dlg.MinPeakFoundRatio          = minPeakFoundRatio;
                dlg.OkDialog();
            });

            // Ready to export, although we will just cancel out of the dialog.
            var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.Method));

            RunUI(() =>
            {
                exportMethodDlg.InstrumentType = ExportInstrumentType.ABI_TOF; // Not L10N
                exportMethodDlg.MethodType     = ExportMethodType.Scheduled;
                exportMethodDlg.CancelButton.PerformClick();
            });
            WaitForClosedForm(exportMethodDlg);

            RunUI(() => SkylineWindow.SaveDocument());
            RunUI(SkylineWindow.NewDocument);
        }
예제 #4
0
        protected override void DoTest()
        {
            // Clear all the settings lists that will be defined in this tutorial
            ClearSettingsLists();

            // Open the file
            RunUI(() => SkylineWindow.OpenFile(GetTestPath(DIA_START_CHECKPOINT)));
            WaitForDocumentLoaded();

            // Specify DIA acquisition scheme and machine settings
            var transitionSettings = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() =>
            {
                transitionSettings.SelectedTab              = TransitionSettingsUI.TABS.FullScan;
                transitionSettings.AcquisitionMethod        = FullScanAcquisitionMethod.DIA;
                transitionSettings.PrecursorIsotopesCurrent = FullScanPrecursorIsotopes.Count;
                transitionSettings.PrecursorMassAnalyzer    = FullScanMassAnalyzerType.orbitrap;
                transitionSettings.PrecursorRes             = 35000;
                transitionSettings.PrecursorResMz           = 200;
                transitionSettings.ProductMassAnalyzer      = FullScanMassAnalyzerType.orbitrap;
                transitionSettings.ProductRes   = 17500;
                transitionSettings.ProductResMz = 200;
            });
            PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Transition Settings - Full-Scan", 4);

            // Set up isolation scheme
            var isolationSchemeDlg = ShowDialog <EditIsolationSchemeDlg>(transitionSettings.AddIsolationScheme);

            PauseForScreenShot <EditIsolationSchemeDlg>("Edit Isolation Scheme form", 5);

            RunUI(() =>
            {
                isolationSchemeDlg.UseResults = false;
            });

            var calculateIsolationDlg = ShowDialog <CalculateIsolationSchemeDlg>(isolationSchemeDlg.Calculate);

            RunUI(() =>
            {
                calculateIsolationDlg.WindowWidth             = 20;
                calculateIsolationDlg.Start                   = 500;
                calculateIsolationDlg.End                     = 900;
                calculateIsolationDlg.OptimizeWindowPlacement = true;
            });
            PauseForScreenShot <CalculateIsolationSchemeDlg>("Calculate Isolation Scheme form", 6);
            OkDialog(calculateIsolationDlg, calculateIsolationDlg.OkDialog);
            PauseForScreenShot <EditIsolationSchemeDlg>("Edit Isolation Scheme Dialog Filled", 7);

            var isolationSchemeGraphDlg = ShowDialog <DiaIsolationWindowsGraphForm>(isolationSchemeDlg.OpenGraph);

            PauseForScreenShot <DiaIsolationWindowsGraphForm>("Graph of Isolation Scheme", 8);
            OkDialog(isolationSchemeGraphDlg, isolationSchemeGraphDlg.CloseButton);
            RunUI(() => isolationSchemeDlg.IsolationSchemeName = "500 to 900 by 20");
            OkDialog(isolationSchemeDlg, isolationSchemeDlg.OkDialog);
            OkDialog(transitionSettings, transitionSettings.OkDialog);

            // Export isolation scheme
            var exportIsolationDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.IsolationList));

            PauseForScreenShot <ExportMethodDlg>("Export Isolation List form", 9);
            OkDialog(exportIsolationDlg, () => exportIsolationDlg.OkDialog(GetTestPath("DIA_tutorial_isolation_list.csv")));

            // Adjust modifications and filter
            var newPeptideSettings = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => newPeptideSettings.AutoSelectMatchingPeptides = true);
            OkDialog(newPeptideSettings, newPeptideSettings.OkDialog);

            // Set up chromatogram retention time restriction
            var newTransitionSettings = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() => newTransitionSettings.SetRetentionTimeFilter(RetentionTimeFilterType.ms2_ids, 5.0));
            PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Retention time filtering options", 16);

            // Adjust library transition ranking
            RunUI(() =>
            {
                newTransitionSettings.SelectedTab    = TransitionSettingsUI.TABS.Library;
                newTransitionSettings.UseLibraryPick = true;
                newTransitionSettings.Filtered       = true;
            });
            PauseForScreenShot <TransitionSettingsUI.LibraryTab>("Transition Settings - Library tab", 22);
            OkDialog(newTransitionSettings, newTransitionSettings.OkDialog);
            PauseForScreenShot <SequenceTreeForm>("Targets pane with precursors and best 5 transitions only", 23);

            // Build spectral library using Import Peptide Search
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath(DIA_TUTORIAL_CHECKPOINT)));

            // "Build Spectral Library" page
            var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(() => SkylineWindow.ShowImportPeptideSearchDlg());

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.spectra_page);
                importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(new[] { GetTestPath("interact-20130311_DDA_Pit01.pep.xml") }); // Not L10N
                importPeptideSearchDlg.BuildPepSearchLibControl.WorkflowType = ImportPeptideSearchDlg.Workflow.dia;
            });
            PauseForScreenShot <BuildLibraryDlg>("Build Library form - input files", 10);

            const string prefixKeep = "DIA_Pit0";

            if (IsFullImportMode)
            {
                SrmDocument doc = SkylineWindow.Document;
                RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));
                doc = WaitForDocumentChange(doc);

                // "Extract Chromatograms" page
                RunUI(() =>
                {
                    Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page);
                    importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles =
                        _importFiles.Select(f => new ImportPeptideSearch.FoundResultsFile(f, GetTestPath(f + ExtensionTestContext.ExtThermoRaw))).ToList();
                });
                var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importPeptideSearchDlg.ClickNextButtonNoCheck);
                RunUI(() =>
                {
                    string prefix = importResultsNameDlg.Prefix;
                    Assert.IsTrue(prefix.EndsWith(prefixKeep));
                    importResultsNameDlg.Prefix = prefix.Substring(0, prefix.Length - prefixKeep.Length);
                    importResultsNameDlg.YesDialog();
                });
                WaitForClosedForm(importResultsNameDlg);

                // "Add Modifications" page
                RunUI(() =>
                {
                    const string modCarbamidomethyl = "Carbamidomethyl (C)";
                    const string modOxidation       = "Oxidation (M)";
                    Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.match_modifications_page);
                    // Define expected matched/unmatched modifications
                    var expectedMatched = new[] { modCarbamidomethyl, modOxidation };
                    // Verify matched/unmatched modifications
                    AssertEx.AreEqualDeep(expectedMatched, importPeptideSearchDlg.MatchModificationsControl.MatchedModifications.ToArray());
                    Assert.IsFalse(importPeptideSearchDlg.MatchModificationsControl.UnmatchedModifications.Any());
                    importPeptideSearchDlg.MatchModificationsControl.CheckedModifications = new[] { modCarbamidomethyl };
                    Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
                });
                WaitForDocumentChange(doc);

                // "Configure Transition Settings" page
                RunUI(() =>
                {
                    Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.transition_settings_page);
                    importPeptideSearchDlg.TransitionSettingsControl.PrecursorCharges      = new[] { 1, 2, 3, 4 };
                    importPeptideSearchDlg.TransitionSettingsControl.IonCharges            = new[] { 1, 2 };
                    importPeptideSearchDlg.TransitionSettingsControl.IonTypes              = new[] { IonType.y, IonType.b, IonType.precursor };
                    importPeptideSearchDlg.TransitionSettingsControl.ExclusionUseDIAWindow = true;
                    importPeptideSearchDlg.TransitionSettingsControl.IonCount              = 5;
                    importPeptideSearchDlg.TransitionSettingsControl.IonMatchTolerance     = 0.05;
                    Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
                });

                // "Configure Full-Scan Settings" page
                RunUI(() =>
                {
                    Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page);
                    Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
                });

                // "Import FASTA" page
                RunUI(() =>
                {
                    importPeptideSearchDlg.ImportFastaControl.SetFastaContent(GetTestPath("pituitary_database.fasta"));
                    Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
                });

                WaitForClosedForm(importPeptideSearchDlg);
                WaitForCondition(10 * 60 * 1000, () => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);    // 10 minutes

                RunUI(() =>
                {
                    SkylineWindow.SaveDocument(GetTestPath(DIA_IMPORTED_CHECKPOINT));
                    SkylineWindow.SaveDocument(GetTestPath(DIA_TUTORIAL_CHECKPOINT));
                });
            }
            else
            {
                OkDialog(importPeptideSearchDlg, importPeptideSearchDlg.CancelDialog);
                RunUI(() => SkylineWindow.OpenFile(GetTestPath(DIA_IMPORTED_CHECKPOINT)));
            }
            WaitForDocumentLoaded();
            WaitForGraphs();

            RunUI(() =>
            {
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.Size = new Size(750, 788);
            });

            // Generate decoys
//            var decoysDlg = ShowDialog<GenerateDecoysDlg>(SkylineWindow.ShowGenerateDecoysDlg);
//            PauseForScreenShot<GenerateDecoysDlg>("Add Decoy Peptides form", 24);
//            RunUI(() =>
//            {
//                decoysDlg.NumDecoys = 26;
//                Assert.AreEqual(decoysDlg.DecoysMethod, DecoyGeneration.SHUFFLE_SEQUENCE);
//            });
//            OkDialog(decoysDlg, decoysDlg.OkDialog);
//            RunUI(() => SkylineWindow.SequenceTree.TopNode = SkylineWindow.SequenceTree.SelectedNode.PrevNode.Nodes[6]);
//            PauseForScreenShot<SequenceTreeForm>("Targets pane with decoys added", 25);

            RunUI(() =>
            {
                SkylineWindow.CollapsePeptides();
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 6);
                var nodePepTree            = SkylineWindow.SelectedNode as PeptideTreeNode;
                Assert.IsNotNull(nodePepTree);
                Assert.AreEqual("VLQAVLPPLPQVVCTYR", nodePepTree.DocNode.Peptide.Sequence);
                SkylineWindow.ShowSplitChromatogramGraph(true);
                SkylineWindow.AutoZoomBestPeak();
                var graphChrom   = SkylineWindow.GetGraphChrom(prefixKeep + "1");
                var labelStrings = graphChrom.GetAnnotationLabelStrings().ToArray();
                Assert.IsTrue(labelStrings.Contains(string.Format("{0}\n+{1} ppm\n(idotp {2})", 75.4, 3, 0.59)),
                              string.Format("Missing expected label in {0}", string.Join("|", labelStrings)));
                SkylineWindow.Width = 1250;
            });

            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, dlg =>
            {
                dlg.FontSize = GraphFontSize.NORMAL;
                dlg.OkDialog();
            });

            RestoreViewOnScreen(27);
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile", 26);

            RunUI(() =>
            {
                SkylineWindow.SelectedNode.Expand();
                var nodeTree = SkylineWindow.SelectedNode.Nodes[0].Nodes[0] as SrmTreeNode;
                Assert.IsNotNull(nodeTree);
                Assert.AreEqual((int)SequenceTree.StateImageId.no_peak, nodeTree.StateImageIndex);
            });

            PauseForScreenShot <SequenceTreeForm>("Targets view - ", 27);

            RunUI(() =>
            {
                SkylineWindow.SetIntegrateAll(true);
                var nodeTree = SkylineWindow.SelectedNode.Nodes[0].Nodes[0] as SrmTreeNode;
                Assert.IsNotNull(nodeTree);
                Assert.AreEqual((int)SequenceTree.StateImageId.peak, nodeTree.StateImageIndex);
                var nodeGroupTree = SkylineWindow.SelectedNode.Nodes[0] as TransitionGroupTreeNode;
                Assert.IsNotNull(nodeGroupTree);
                Assert.AreEqual(0.99, nodeGroupTree.DocNode.GetIsotopeDotProduct(0) ?? 0, 0.005);
                Assert.AreEqual(0.83, nodeGroupTree.DocNode.GetLibraryDotProduct(0) ?? 0, 0.005);
                SkylineWindow.ShowOtherRunPeptideIDTimes(true);
            });

            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile - with ID lines", 28);

            RunUI(() =>
            {
                SkylineWindow.AutoZoomNone();
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 1);
            });

            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile - zoomed out and small peak", 30);

            RunUI(SkylineWindow.AutoZoomBestPeak);

            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile - zoomed to peak", 31);
            if (IsFullImportMode)
            {
                ClickChromatogram(74.9, 1.775E+7, PaneKey.PRECURSORS);
                RestoreViewOnScreen(33);
                PauseForScreenShot <GraphFullScan>("Full Scan graph with precursors - zoom manually", 32);

                ClickChromatogram(74.8, 1.753E+6, PaneKey.PRODUCTS);
                PauseForScreenShot <GraphFullScan>("Full Scan graph showing y7", 33);

                ClickChromatogram(74.9, 9.64E+5, PaneKey.PRODUCTS);
                PauseForScreenShot <GraphFullScan>("Full Scan graph showing b3 - zoom manually", 34);

                ClickChromatogram(74.9, 1.25E+5, PaneKey.PRODUCTS);
                PauseForScreenShot <GraphFullScan>("Full Scan graph showing y3 - zoom manually", 34);
            }

            RunUI(() =>
            {
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 2);
                Assert.AreEqual("CNTDYSDCIHEAIK", ((PeptideTreeNode)SkylineWindow.SelectedNode).DocNode.Peptide.Sequence);
            });

            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile - split between two precursors", 35);

            RunUI(() =>
            {
                SkylineWindow.SelectedNode.Expand();
                SkylineWindow.SelectedPath = ((SrmTreeNode)SkylineWindow.SelectedNode.Nodes[0]).Path;
            });

            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile - double charged precursor", 36);

            RunUI(() =>
            {
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 3);
                Assert.AreEqual("ELVYETVR", ((PeptideTreeNode)SkylineWindow.SelectedNode).DocNode.Peptide.Sequence);
            });

            RunUI(() =>
            {
                SkylineWindow.SelectedNode.Expand();
                var nodeGroupTree = SkylineWindow.SelectedNode.Nodes[0] as TransitionGroupTreeNode;
                Assert.IsNotNull(nodeGroupTree);
                Assert.AreEqual(0.99, nodeGroupTree.DocNode.GetIsotopeDotProduct(0) ?? 0, 0.005);
                Assert.AreEqual(0.99, nodeGroupTree.DocNode.GetIsotopeDotProduct(0) ?? 0, 0.005);
            });

            RestoreViewOnScreen(38);
            PauseForScreenShot <GraphSpectrum>("Library Match view - zoom manually", 37);

            RestoreViewOnScreen(39);
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile", 38);

            if (IsFullImportMode)
            {
                RestoreViewOnScreen(40);
                ClickChromatogram(41.9, 1.166E+8, PaneKey.PRECURSORS);
                PauseForScreenShot <GraphFullScan>("Full Scan graph showing precursor interference - zoom manually", 39);

                RunUI(() => SkylineWindow.GraphFullScan.ChangeScan(-12));
                CheckFullScanSelection(41.7, 1.532E+8, PaneKey.PRECURSORS);
                PauseForScreenShot <GraphFullScan>("Full Scan graph showing transition between interference and real peak - zoom manually", 39);
            }

            // Clear all the settings lists that were defined in this tutorial
            ClearSettingsLists();
        }
        protected override void DoTest()
        {
            var folderAbsoluteQuant = UseRawFiles ? "AbsoluteQuant" : "AbsoluteQuantMzml";
            // Generating a Transition List, p. 4
            {
                var doc = SkylineWindow.Document;
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() =>
                {
                    // Predicition Settings
                    transitionSettingsUI.SelectedTab       = TransitionSettingsUI.TABS.Prediction;
                    transitionSettingsUI.PrecursorMassType = MassType.Monoisotopic;
                    transitionSettingsUI.FragmentMassType  = MassType.Monoisotopic;
                    transitionSettingsUI.RegressionCEName  = "Thermo TSQ Vantage";
                    transitionSettingsUI.RegressionDPName  = Resources.SettingsList_ELEMENT_NONE_None;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings - Prediction tab", 4);

                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab      = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.PrecursorCharges = "2";
                    transitionSettingsUI.ProductCharges   = "1";
                    transitionSettingsUI.FragmentTypes    = "y";
                    transitionSettingsUI.RangeFrom        = Resources.TransitionFilter_FragmentStartFinders_ion_3;
                    transitionSettingsUI.RangeTo          = Resources.TransitionFilter_FragmentEndFinders_last_ion_minus_1;
                    transitionSettingsUI.SpecialIons      = new string[0];
                });
                PauseForScreenShot <TransitionSettingsUI.FilterTab>("Transition Settings - Filter tab", 4);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(doc);
            }

            // Configuring Peptide settings p. 4
            PeptideSettingsUI peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Modifications);
            PauseForScreenShot <PeptideSettingsUI.ModificationsTab>("Peptide Settings - Modification tab", 5);

            var modHeavyK = new StaticMod("Label:13C(6)15N(2) (C-term K)", "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15,
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyK, peptideSettingsUI, "Edit Isotope Modification over Transition Settings", 5);
            RunUI(() => peptideSettingsUI.PickedHeavyMods = new[] { modHeavyK.Name });
            PauseForScreenShot <PeptideSettingsUI.ModificationsTab>("Peptide Settings - Modification tab with mod added", 5);

            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);

            // Inserting a peptide sequence p. 5
            using (new CheckDocumentState(1, 1, 2, 10))
            {
                RunUI(() => SetClipboardText("IEAIPQIDK\tGST-tag"));
                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg);
                RunUI(pasteDlg.PastePeptides);
                WaitForProteinMetadataBackgroundLoaderCompletedUI();
                PauseForScreenShot <PasteDlg.PeptideListTab>("Insert Peptide List", 6);

                OkDialog(pasteDlg, pasteDlg.OkDialog);
            }

            RunUI(SkylineWindow.ExpandPrecursors);
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath(folderAbsoluteQuant + @"test_file.sky")));
            WaitForCondition(() => File.Exists(TestFilesDir.GetTestPath(folderAbsoluteQuant + @"test_file.sky")));
            PauseForScreenShot("Main window with Targets view", 6);

            // Exporting a transition list p. 6
            {
                var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.InstrumentType = ExportInstrumentType.THERMO;
                    exportMethodDlg.ExportStrategy = ExportStrategy.Single;
                    exportMethodDlg.OptimizeType   = ExportOptimize.NONE;
                    exportMethodDlg.MethodType     = ExportMethodType.Standard;
                });
                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List", 7);

                OkDialog(exportMethodDlg, () =>
                         exportMethodDlg.OkDialog(TestFilesDir.GetTestPath("Quant_Abs_Thermo_TSQ_Vantage.csv")));
            }

            // Importing RAW files into Skyline p. 7
            var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            PauseForScreenShot <ImportResultsDlg>("Import Results - click OK to get shot of Import Results Files and then cancel", 8);

            RunUI(() =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value.Skip(1);
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg.NamedPathSets = namedPathSets.ToArray();
            });
            RunDlg <ImportResultsNameDlg>(importResultsDlg.OkDialog,
                                          importResultsNameDlg => importResultsNameDlg.NoDialog());

            WaitForGraphs();

            RunUI(() =>
            {
                SkylineWindow.SelectedPath             = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                Settings.Default.ArrangeGraphsOrder    = GroupGraphsOrder.Document.ToString();
                Settings.Default.ArrangeGraphsReversed = false;
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.AutoZoomBestPeak();
            });
            WaitForCondition(() => Equals(8, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden)),
                             "unexpected visible graphChromatogram count");

            WaitForCondition(10 * 60 * 1000,    // ten minutes
                             () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            PauseForScreenShot("Main window with imported data", 9);

            // Analyzing SRM Data from FOXN1-GST Sample p. 9
            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults,
                                      importResultsDlg1 =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value.Take(1);
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg1.NamedPathSets = namedPathSets.ToArray();
                importResultsDlg1.OkDialog();
            });
            WaitForGraphs();
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
            WaitForCondition(5 * 60 * 1000, // five minutes
                             () =>
                             SkylineWindow.Document.Settings.HasResults &&
                             SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);

            RunUI(() =>
            {
                SkylineWindow.ToggleIntegrateAll();
                SkylineWindow.ArrangeGraphsTabbed();
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.ShowPeakAreaReplicateComparison();
                // Total normalization
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view);
            });

            RunUI(() => SkylineWindow.ActivateReplicate("FOXN1-GST"));
            WaitForGraphs();
            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 0));
            WaitForGraphs();
            RunUI(() =>
            {
                Assert.AreEqual(SkylineWindow.SelectedResultsIndex, SkylineWindow.GraphPeakArea.ResultsIndex);
                Assert.AreEqual(SkylineWindow.SelectedResultsIndex, SkylineWindow.GraphRetentionTime.ResultsIndex);
            });

            RunUI(() =>
            {
                int transitionCount = SkylineWindow.DocumentUI.PeptideTransitionGroups.First().TransitionCount;
                CheckGstGraphs(transitionCount, transitionCount);
            });
            PauseForScreenShot("Main window with Peak Areas, Retention Times and FOXN1-GST for light", 10);

            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 1));
            WaitForGraphs();

            RunUI(() =>
            {
                int transitionCount = SkylineWindow.DocumentUI.PeptideTransitionGroups.ToArray()[1].TransitionCount;
                CheckGstGraphs(transitionCount, transitionCount);
            });
            PauseForScreenShot("Main window with Peak Areas, Retention Times and FOXN1-GST for heavy", 10);

            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.Molecules, 0));
            WaitForGraphs();
            // Heavy normalization
            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_ratio_view));
            WaitForGraphs();

            RunUI(() =>
            {
                int transitionGroupCount = SkylineWindow.DocumentUI.Peptides.First().TransitionGroupCount;
                CheckGstGraphs(transitionGroupCount, transitionGroupCount - 1);
            });
            PauseForScreenShot("Main window with totals graphs for light and heavy and FOXN1-GST", 11);
            const int columnsToAddCount = 4;
            var       columnSeparator   = TextUtil.CsvSeparator;
            // Generating a Calibration Curve p. 11
            var          exportLiveReportDlg = ShowDialog <ExportLiveReportDlg>(SkylineWindow.ShowExportReportDialog);
            var          editReportListDlg   = ShowDialog <ManageViewsForm>(exportLiveReportDlg.EditList);
            const string reportName          = "Peptide Ratio Results Test";
            var          columnsToAdd        = new[]
            {
                PropertyPath.Parse("Proteins!*.Peptides!*.Sequence"),
                PropertyPath.Parse("Proteins!*.Name"),
                PropertyPath.Parse("Replicates!*.Name"),
                PropertyPath.Parse("Proteins!*.Peptides!*.Results!*.Value.RatioToStandard"),
            };

            Assert.AreEqual(columnsToAddCount, columnsToAdd.Length);
            {
                var viewEditor = ShowDialog <ViewEditor>(editReportListDlg.AddView);
                RunUI(() =>
                {
                    viewEditor.ViewName = reportName;
                    foreach (var id in columnsToAdd)
                    {
                        Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(id), "Unable to select {0}", id);
                        viewEditor.ChooseColumnsTab.AddSelectedColumn();
                    }
                    Assert.AreEqual(columnsToAdd.Length, viewEditor.ChooseColumnsTab.ColumnCount);
                });
                // TODO: MultiViewProvider not yet supported in Common
                PauseForScreenShot <ViewEditor>("Edit Report form", 12);

                OkDialog(viewEditor, viewEditor.OkDialog);
            }

            RunUI(editReportListDlg.OkDialog);
            WaitForClosedForm(editReportListDlg);
            RunUI(() =>
            {
                exportLiveReportDlg.ReportName = reportName;
                exportLiveReportDlg.OkDialog(TestFilesDir.GetTestPath("Calibration.csv"), columnSeparator);
            });

            // Check if export file is correct.
            string filePath = TestFilesDir.GetTestPath("Calibration.csv");

            Assert.IsTrue(File.Exists(filePath));
            string[] lines = File.ReadAllLines(filePath);
            string[] line0 = lines[0].Split(columnSeparator);
            int      count = line0.Length;

            Assert.IsTrue(lines.Count() == SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Count + 1);
            Assert.AreEqual(columnsToAddCount, count);

            // Check export file data
            double ratio1 = Double.Parse(lines[1].Split(new[] { columnSeparator }, 4)[3]);
            double ratio2 = Double.Parse(lines[2].Split(new[] { columnSeparator }, 4)[3]);
            double ratio3 = Double.Parse(lines[3].Split(new[] { columnSeparator }, 4)[3]);
            double ratio4 = Double.Parse(lines[4].Split(new[] { columnSeparator }, 4)[3]);
            double ratio5 = Double.Parse(lines[5].Split(new[] { columnSeparator }, 4)[3]);
            double ratio6 = Double.Parse(lines[6].Split(new[] { columnSeparator }, 4)[3]);
            double ratio7 = Double.Parse(lines[7].Split(new[] { columnSeparator }, 4)[3]);
            double ratio8 = Double.Parse(lines[8].Split(new[] { columnSeparator }, 4)[3]);
            double ratio9 = Double.Parse(lines[9].Split(new[] { columnSeparator }, 4)[3]);

            Assert.AreEqual(21.4513, ratio1, 0.1);
            Assert.AreEqual(6.2568, ratio2, 0.1);
            Assert.AreEqual(2.0417, ratio3, 0.1);
            Assert.AreEqual(0.8244, ratio4, 0.1);
            Assert.AreEqual(0.2809, ratio5, 0.1);
            Assert.AreEqual(0.1156, ratio6, 0.1);
            Assert.AreEqual(0.0819, ratio7, 0.1);
            Assert.AreEqual(0.0248, ratio8, 0.1);
            Assert.AreEqual(0.7079, ratio9, 0.1);
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
        }
        protected override void DoTest()
        {
            // Lest we get "To export a scheduled method, you must first choose a retention time predictor in Peptide Settings / Prediction, or import results for all peptides in the document."
            TestSmallMolecules = false;

            // Skyline Collision Energy Optimization
            RunUI(() => SkylineWindow.OpenFile(GetTestPath("CE_Vantage_15mTorr.sky"))); // Not L10N

            if (AsSmallMolecules)
            {
                var doc    = WaitForDocumentLoaded();
                var refine = new RefinementSettings();
                SkylineWindow.SetDocument(refine.ConvertToSmallMolecules(doc), doc);
            }

            // Deriving a New Linear Equation, p. 2
            var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
            var editList             =
                ShowDialog <EditListDlg <SettingsListBase <CollisionEnergyRegression>, CollisionEnergyRegression> >
                    (transitionSettingsUI.EditCEList);

            RunUI(() => editList.SelectItem("Thermo")); // Not L10N
            EditCEDlg editItem = ShowDialog <EditCEDlg>(editList.EditItem);

            PauseForScreenShot <EditCEDlg>("Edit Collision Energy Equation form", 3);

            ChargeRegressionLine regressionLine2 = new ChargeRegressionLine(2, 0.034, 3.314);
            ChargeRegressionLine regressionLine3 = new ChargeRegressionLine(3, 0.044, 3.314);

            CheckRegressionLines(new[] { regressionLine2, regressionLine3 }, editItem.Regression.Conversions);

            RunUI(() =>
            {
                editItem.DialogResult             = DialogResult.OK;
                editList.DialogResult             = DialogResult.Cancel;
                transitionSettingsUI.DialogResult = DialogResult.Cancel;
            });
            WaitForClosedForm(transitionSettingsUI);

            // Measuring Retention Times for Method Scheduling, p. 3
            {
                var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.InstrumentType = ExportInstrumentType.THERMO;
                    exportMethodDlg.ExportStrategy = ExportStrategy.Single;
                    exportMethodDlg.OptimizeType   = ExportOptimize.NONE;
                    exportMethodDlg.MethodType     = ExportMethodType.Standard;
                });

                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List form", 4);

                RunUI(() => exportMethodDlg.OkDialog(GetTestPath("CE_Vantage_15mTorr_unscheduled.csv"))); // Not L10N
                WaitForClosedForm(exportMethodDlg);
            }

            string filePathTemplate = GetTestPath("CE_Vantage_15mTorr_unscheduled.csv"); // Not L10N

            CheckTransitionList(filePathTemplate, 1, 6);

            const string unscheduledName = "Unscheduled"; // Not L10N

            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults, importResultsDlg =>
            {
                importResultsDlg.RadioAddNewChecked = true;
                var path =
                    new[] { new KeyValuePair <string, MsDataFileUri[]>(unscheduledName,
                                                                                                                                                                       // This is not actually a valid file path (missing OptimizeCE)
                                                                                                                                                                       // but Skyline should correctly find the file in the same folder
                                                                                                                                                                       // as the document.
                                                                       new[] { MsDataFileUri.Parse(GetTestPath("CE_Vantage_15mTorr_unscheduled" + ExtThermoRaw)) }) }; // Not L10N
                importResultsDlg.NamedPathSets = path;
                importResultsDlg.OkDialog();
            });
            WaitForCondition(5 * 60 * 1000, () => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);    // 5 minutes
            AssertEx.IsDocumentState(SkylineWindow.Document, null, 7, 27, 30, 120);
            var docUnsched = SkylineWindow.Document;

            AssertResult.IsDocumentResultsState(SkylineWindow.Document,
                                                unscheduledName,
                                                docUnsched.MoleculeCount,
                                                docUnsched.MoleculeTransitionGroupCount, 0,
                                                docUnsched.MoleculeTransitionCount - 1, 0);

            RunUI(() =>
            {
                SkylineWindow.ExpandProteins();
                SkylineWindow.ExpandPeptides();
            });

            PauseForScreenShot("Main Skyline window", 5);

            // Creating Optimization Methods, p. 5
            {
                var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.InstrumentType = ExportInstrumentType.THERMO;
                    exportMethodDlg.ExportStrategy = ExportStrategy.Buckets;
                    exportMethodDlg.MaxTransitions = 110;
                    exportMethodDlg.IgnoreProteins = true;
                    exportMethodDlg.OptimizeType   = ExportOptimize.CE;
                    exportMethodDlg.MethodType     = ExportMethodType.Scheduled;
                });

                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List form", 6);

                RunUI(() => exportMethodDlg.OkDialog(GetTestPath("CE_Vantage_15mTorr.csv"))); // Not L10N
                WaitForClosedForm(exportMethodDlg);
            }

            string filePathTemplate1 = GetTestPath("CE_Vantage_15mTorr_000{0}.csv"); // Not L10N

            CheckTransitionList(filePathTemplate1, 5, 9);

            var filePath = GetTestPath("CE_Vantage_15mTorr_0001.csv"); // Not L10N

            CheckCEValues(filePath, 11);

            // Analyze Optimization Data, p. 7
            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults, importResultsDlg =>
            {
                importResultsDlg.RadioAddNewChecked = true;
                importResultsDlg.OptimizationName   = ExportOptimize.CE;
                importResultsDlg.NamedPathSets      = DataSourceUtil.GetDataSourcesInSubdirs(TestFilesDirs[0].FullPath).ToArray();
                importResultsDlg.NamedPathSets[0]   =
                    new KeyValuePair <string, MsDataFileUri[]>("Optimize CE", importResultsDlg.NamedPathSets[0].Value.Take(5).ToArray()); // Not L10N
                importResultsDlg.OkDialog();
            });
            RunUI(() =>
            {
                SkylineWindow.ShowSingleTransition();
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ShowPeakAreaReplicateComparison();
            });

            WaitForDocumentLoaded(15 * 60 * 1000); // 10 minutes

            if (AsSmallMolecules)
            {
                return;  // Too peptide-centric from here to end of test
            }

            FindNode("IHGFDLAAINLQR");
            RestoreViewOnScreen(8);

            PauseForScreenShot("Main Skyline window", 8);

            // p. 8
            // Not L10N
            RemovePeptide("EGIHAQQK");

            FindNode("IDALNENK");

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view));

            PauseForScreenShot("Main Skyline window", 9);

            RunUI(SkylineWindow.EditDelete);

            RemovePeptide("LICDNTHITK");

            // Creating a New Equation for CE, p. 9
            var transitionSettingsUI1 = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
            var editCEDlg1            = ShowDialog <EditListDlg <SettingsListBase <CollisionEnergyRegression>, CollisionEnergyRegression> >(transitionSettingsUI1.EditCEList);
            var addItem = ShowDialog <EditCEDlg>(editCEDlg1.AddItem);

            RunUI(() =>
            {
                addItem.RegressionName = "Thermo Vantage Tutorial"; // Not L10N
                addItem.UseCurrentData();
            });

            var graphRegression = ShowDialog <GraphRegression>(addItem.ShowGraph);

            PauseForScreenShot <GraphRegression>("Collision Energy Regression graphs", 10);

            var graphDatas = graphRegression.RegressionGraphDatas.ToArray();

            Assert.AreEqual(2, graphDatas.Length);

            ChargeRegressionLine regressionLine21 = new ChargeRegressionLine(2, 0.0305, 2.5061);
            ChargeRegressionLine regressionLine31 = new ChargeRegressionLine(3, 0.0397, 1.4217);
            var expectedRegressions = new[] { regressionLine21, regressionLine31 };

            CheckRegressionLines(expectedRegressions, new[]
            {
                new ChargeRegressionLine(2,
                                         Math.Round(graphDatas[0].RegressionLine.Slope, 4),
                                         Math.Round(graphDatas[0].RegressionLine.Intercept, 4)),
                new ChargeRegressionLine(3,
                                         Math.Round(graphDatas[1].RegressionLine.Slope, 4),
                                         Math.Round(graphDatas[1].RegressionLine.Intercept, 4)),
            });

            RunUI(graphRegression.CloseDialog);
            WaitForClosedForm(graphRegression);
            RunUI(addItem.OkDialog);
            WaitForClosedForm(addItem);
            RunUI(editCEDlg1.OkDialog);
            WaitForClosedForm(editCEDlg1);
            RunUI(transitionSettingsUI1.OkDialog);
            WaitForClosedForm(transitionSettingsUI1);

            // Optimizing Each Transition, p. 10
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI2 =>
            {
                transitionSettingsUI2.UseOptimized = true;
                transitionSettingsUI2.OptimizeType = OptimizedMethodType.Transition.GetLocalizedString();
                transitionSettingsUI2.OkDialog();
            });
            RunDlg <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List), exportMethodDlg =>
            {
                exportMethodDlg.ExportStrategy = ExportStrategy.Single;
                exportMethodDlg.OkDialog(GetTestPath("CE_Vantage_15mTorr_optimized.csv")); // Not L10N
            });

            var filePathTemplate2 = GetTestPath("CE_Vantage_15mTorr_optimized.csv"); // Not L10N

            CheckTransitionList(filePathTemplate2, 1, 9);

            RunUI(() => SkylineWindow.SaveDocument());
            WaitForConditionUI(() => !SkylineWindow.Dirty);
        }
예제 #7
0
        protected override void DoTest()
        {
            LinkPdf = "http://www.srmcourse.ch/tutorials2014/Tutorial-1_Settings.pdf";

            //Tutorial 1
            string fastaFile = GetTestPath("Tutorial-1_Settings/TubercuList_v2-6.fasta.txt");

            WaitForCondition(() => File.Exists(fastaFile));
            var pepSettings = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() =>
            {
                SkylineWindow.Size              = new Size(1600, 800);
                pepSettings.SelectedTab         = PeptideSettingsUI.TABS.Digest;
                pepSettings.ComboEnzymeSelected = "Trypsin [KR | P]";
                pepSettings.MaxMissedCleavages  = 0;
            });

            var backProteomeDlg = ShowDialog <BuildBackgroundProteomeDlg>(pepSettings.AddBackgroundProteome);

            RunUI(() =>
            {
                backProteomeDlg.BackgroundProteomePath = GetTestPath("Skyline");
                backProteomeDlg.BackgroundProteomeName = "TubercuList_v2-6";
                backProteomeDlg.AddFastaFile(fastaFile);
                WaitForCondition(() => backProteomeDlg.StatusText.Length > 10);
                Assert.IsTrue(backProteomeDlg.StatusText.Contains("3982".ToString(CultureInfo.CurrentCulture)));
            });
            OkDialog(backProteomeDlg, backProteomeDlg.OkDialog);

            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Prediction);

            RunUI(() =>
            {
                pepSettings.SelectedTab                = PeptideSettingsUI.TABS.Filter;
                pepSettings.TextMinLength              = 7;
                pepSettings.TextMaxLength              = 25;
                pepSettings.TextExcludeAAs             = 0;
                pepSettings.AutoSelectMatchingPeptides = true;
            });

            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Library);
            var editListDlg =
                ShowDialog <EditListDlg <SettingsListBase <LibrarySpec>, LibrarySpec> >(pepSettings.EditLibraryList);
            var editLibraryDlg = ShowDialog <EditLibraryDlg>(editListDlg.AddItem);

            RunUI(() =>
            {
                editLibraryDlg.LibraryName = "Mtb_proteome_library";
                editLibraryDlg.LibraryPath = GetTestPath("Skyline\\Mtb_DirtyPeptides_QT_filtered_cons.sptxt");
            });
            OkDialog(editLibraryDlg, editLibraryDlg.OkDialog);
            OkDialog(editListDlg, editListDlg.OkDialog);
            RunUI(() => pepSettings.SetLibraryChecked(0, true));

            RunUI(() => { pepSettings.SelectedTab = PeptideSettingsUI.TABS.Modifications; });
            var editHeavyModListDlg =
                ShowDialog <EditListDlg <SettingsListBase <StaticMod>, StaticMod> >(pepSettings.EditHeavyMods);
            var addDlgOne = ShowDialog <EditStaticModDlg>(editHeavyModListDlg.AddItem);

            RunUI(() => addDlgOne.SetModification("Label:13C(6)15N(2) (C-term K)"));
            PauseForScreenShot("Isotope modification 1", 3);
            OkDialog(addDlgOne, addDlgOne.OkDialog);
            var addDlgTwo = ShowDialog <EditStaticModDlg>(editHeavyModListDlg.AddItem);

            RunUI(() => addDlgTwo.SetModification("Label:13C(6)15N(4) (C-term R)"));
            PauseForScreenShot("Isotope modification 2", 3);
            OkDialog(addDlgTwo, addDlgTwo.OkDialog);
            OkDialog(editHeavyModListDlg, editHeavyModListDlg.OkDialog);
            RunUI(() =>
            {
                pepSettings.SetIsotopeModifications(0, true);
                pepSettings.SetIsotopeModifications(1, true);
            });
            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Digest);
            PauseForScreenShot("Digestion tab", 4);
            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Prediction);
            PauseForScreenShot("Prediction tab", 4);
            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Filter);
            PauseForScreenShot("Filter tab", 4);
            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Library);
            PauseForScreenShot("Library tab", 4);
            RunUI(() => pepSettings.SelectedTab = PeptideSettingsUI.TABS.Modifications);
            PauseForScreenShot("Modifications tab", 4);

            OkDialog(pepSettings, pepSettings.OkDialog);

            WaitForCondition(
                () => SkylineWindow.Status.Contains(Resources.BackgroundProteomeSpec_Digest_Digesting__0__.Split('{').First()) &&
                SkylineWindow.Status.Contains(Resources.BackgroundProteomeSpec_Digest_Digesting__0__.Split('}').Last()));
            WaitForCondition(
                () => SkylineWindow.Status.Contains(Resources.BackgroundProteomeManager_LoadBackground_Resolving_protein_details_for__0__proteome.Split('{').First()) &&
                SkylineWindow.Status.Contains(Resources.BackgroundProteomeManager_LoadBackground_Resolving_protein_details_for__0__proteome.Split('}').Last()));
            WaitForCondition(() => SkylineWindow.Status.Contains(Resources.SkylineWindow_UpdateProgressUI_Ready));
            WaitForDocumentLoaded();

            var transitionDlg = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() =>
            {
                transitionDlg.SelectedTab       = TransitionSettingsUI.TABS.Prediction;
                transitionDlg.PrecursorMassType = MassType.Monoisotopic;
                transitionDlg.FragmentMassType  = MassType.Monoisotopic;
                transitionDlg.RegressionCEName  = "ABI 5500 QTrap";
            });

            RunUI(() =>
            {
                transitionDlg.SelectedTab      = TransitionSettingsUI.TABS.Filter;
                transitionDlg.PrecursorCharges = "2,3".ToString(CultureInfo.CurrentCulture);
                transitionDlg.ProductCharges   = "1,2".ToString(CultureInfo.CurrentCulture);
                transitionDlg.FragmentTypes    = "y";
                transitionDlg.RangeFrom        = Resources.TransitionFilter_FragmentStartFinders_ion_1;
                transitionDlg.RangeTo          = Resources.TransitionFilter_FragmentEndFinders_last_ion;
                transitionDlg.SetListAlwaysAdd(0, false);
                transitionDlg.ExclusionWindow = 5;
                transitionDlg.SetAutoSelect   = true;
            });

            RunUI(() =>
            {
                transitionDlg.SelectedTab       = TransitionSettingsUI.TABS.Library;
                transitionDlg.IonMatchTolerance = 1.0;
                transitionDlg.UseLibraryPick    = true;
                transitionDlg.IonCount          = 5;
                transitionDlg.Filtered          = true;
            });

            RunUI(() =>
            {
                transitionDlg.SelectedTab = TransitionSettingsUI.TABS.Instrument;
                transitionDlg.MinMz       = 300;
                transitionDlg.MaxMz       = 1250;
            });

            RunUI(() => transitionDlg.SelectedTab = TransitionSettingsUI.TABS.Prediction);
            PauseForScreenShot("Prediction Tab", 7);
            RunUI(() => transitionDlg.SelectedTab = TransitionSettingsUI.TABS.Filter);
            PauseForScreenShot("Filter Tab", 7);
            RunUI(() => transitionDlg.SelectedTab = TransitionSettingsUI.TABS.Library);
            PauseForScreenShot("Library Tab", 7);
            RunUI(() => transitionDlg.SelectedTab = TransitionSettingsUI.TABS.Instrument);
            PauseForScreenShot("Instrument Tab", 7);
            OkDialog(transitionDlg, transitionDlg.OkDialog);
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath("Tutorial-1_Settings\\SRMcourse_20140210_Settings.sky")));


            //Tutorial 2
            LinkPdf = "http://www.srmcourse.ch/tutorials2014/Tutorial-2_TransitionList.pdf";

            RunUI(() => { });
            SetExcelFileClipboardText(GetTestPath(@"Tutorial-2_TransitionList\\target_peptides.xlsx"), "Sheet1", 1,
                                      false);
            var peptidePasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg);
            var matchingDlg     = ShowDialog <FilterMatchedPeptidesDlg>(peptidePasteDlg.PastePeptides);

            PauseForScreenShot("Filter Peptides", 1);
            OkDialog(matchingDlg, matchingDlg.OkDialog);
            OkDialog(peptidePasteDlg, peptidePasteDlg.OkDialog);

            int expectedTrans = TransitionGroup.IsAvoidMismatchedIsotopeTransitions ? 306 : 313;

            AssertEx.IsDocumentState(SkylineWindow.Document, null, 10, 30, 68, expectedTrans);
            RunUI(() =>
            {
                SkylineWindow.ExpandProteins();
                SkylineWindow.ExpandPeptides();
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].FirstNode.FirstNode;
            });
            PauseForScreenShot("Skyline Window", 2);

            var exportDlg = ShowDialog <ExportMethodDlg>(SkylineWindow.ShowExportTransitionListDlg);

            RunUI(() =>
            {
                exportDlg.InstrumentType = "AB SCIEX";
                exportDlg.ExportStrategy = ExportStrategy.Single;
                exportDlg.DwellTime      = 20;
            });
            PauseForScreenShot("Export Transition List", 3);
            var declusteringWarningDlg = ShowDialog <MultiButtonMsgDlg>(
                () => exportDlg.OkDialog(GetTestPath("Tutorial-2_TransitionList\\SRMcourse_20140210_MtbProteomeLib_TransList.csv")));

            PauseForScreenShot("Decluster Window", 3);
            OkDialog(declusteringWarningDlg, declusteringWarningDlg.Btn1Click);
            WaitForClosedForm(exportDlg);

            //Tutorial 3
            LinkPdf = "http://www.srmcourse.ch/tutorials2014/Tutorial-3_Library.pdf";
            var pepSettings2 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => pepSettings2.SelectedTab = PeptideSettingsUI.TABS.Library);
            var buildLibraryDlg = ShowDialog <BuildLibraryDlg>(pepSettings2.ShowBuildLibraryDlg);

            RunUI(() =>
            {
                buildLibraryDlg.LibraryPath      = GetTestPath("Skyline");
                buildLibraryDlg.LibraryName      = "Mtb_hDP_20140210";
                buildLibraryDlg.LibraryCutoff    = 0.9;
                buildLibraryDlg.LibraryAuthority = "SRMcourse";
            });
            PauseForScreenShot("Build Library Window", 2);
            RunUI(() =>
            {
                buildLibraryDlg.OkWizardPage();
                buildLibraryDlg.AddDirectory(GetTestPath("Tutorial-3_Library"));
            });
            PauseForScreenShot("Build Library Window Next", 2);
            OkDialog(buildLibraryDlg, buildLibraryDlg.OkWizardPage);
            RunUI(() =>
            {
                pepSettings2.SetLibraryChecked(0, true);
                pepSettings2.SetLibraryChecked(1, true);
            });
            OkDialog(pepSettings2, pepSettings2.OkDialog);
            WaitForLibrary(20213);
            WaitForCondition(() => SkylineWindow.Document.PeptideTransitionCount != expectedTrans);
            int expectedTransAfter = TransitionGroup.IsAvoidMismatchedIsotopeTransitions ? 444 : 450;

            AssertEx.IsDocumentState(SkylineWindow.Document, null, 10, 30, 96, expectedTransAfter);

            var libraryExpl    = ShowDialog <ViewLibraryDlg>(SkylineWindow.ViewSpectralLibraries);
            var messageWarning = WaitForOpenForm <MultiButtonMsgDlg>();

            OkDialog(messageWarning, messageWarning.Btn1Click);
            PauseForScreenShot("Spectral Library Explorer Window", 3);
            OkDialog(libraryExpl, libraryExpl.Close);

            var exportDlg2 = ShowDialog <ExportMethodDlg>(SkylineWindow.ShowExportTransitionListDlg);

            RunUI(() =>
            {
                exportDlg2.InstrumentType = "AB SCIEX";
                exportDlg2.ExportStrategy = ExportStrategy.Buckets;
                exportDlg2.MaxTransitions = 150;
                exportDlg2.DwellTime      = 20;
                exportDlg2.IgnoreProteins = true;
            });
            var declusteringWarningDlg2 = ShowDialog <MultiButtonMsgDlg>(() =>
                                                                         exportDlg2.OkDialog(GetTestPath("Tutorial-3_Library\\SRMcourse_20140210_MtbProteomeLib_hDP_TransList.csv")));

            OkDialog(declusteringWarningDlg2, declusteringWarningDlg2.Btn1Click);
            WaitForClosedForm(exportDlg2);

            //Tutorial 4-A
            LinkPdf = "http://www.srmcourse.ch/tutorials2014/Tutorial-4_Parameters.pdf";

            SrmDocument smallDocument = SkylineWindow.Document;

            PeptideGroupDocNode[] newProteins = smallDocument.PeptideGroups.Take(0).ToArray();
            smallDocument = (SrmDocument)smallDocument.ChangeChildren(newProteins);

            Assert.IsTrue(SkylineWindow.SetDocument(smallDocument, SkylineWindow.Document)); // TODO: Must be a better way to do this

            var transitionSettings = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() =>
            {
                transitionSettings.SelectedTab      = TransitionSettingsUI.TABS.Prediction;
                transitionSettings.RegressionCEName = "ABI QTrap 4000";
            });
            var editCollisionEnergy = ShowDialog <EditCEDlg>(() =>
                                                             transitionSettings.RegressionCEName = Resources.SettingsListComboDriver_Edit_current);

            RunUI(() =>
            {
                editCollisionEnergy.StepSize  = 2;
                editCollisionEnergy.StepCount = 5;
            });
            PauseForScreenShot("Edit Collision Energy Equation Window", 2);
            OkDialog(editCollisionEnergy, editCollisionEnergy.OkDialog);
            OkDialog(transitionSettings, transitionSettings.OkDialog);

            SetExcelFileClipboardText(GetTestPath("Tutorial-4_Parameters\\transition_list_for_CEO.xlsx"), "Sheet1", 3,
                                      false);
            var insertTransitionDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);

            RunUI(() => insertTransitionDlg.IsMolecule = false); // Make sure it's ready to accept peptides, not small molecules
            RunUI(insertTransitionDlg.PasteTransitions);
            OkDialog(insertTransitionDlg, insertTransitionDlg.OkDialog);

            AssertEx.IsDocumentState(SkylineWindow.Document, null, 10, 30, 30, 143);

            var exportDlg3 = ShowDialog <ExportMethodDlg>(SkylineWindow.ShowExportTransitionListDlg);

            RunUI(() =>
            {
                exportDlg3.InstrumentType = "AB SCIEX";
                exportDlg3.ExportStrategy = ExportStrategy.Single;
                exportDlg3.OptimizeType   = ExportOptimize.CE;
                exportDlg3.MethodType     = ExportMethodType.Standard;
                exportDlg2.DwellTime      = 20;
            });
            PauseForScreenShot("Export Transition List", 3);
            var defaultWaringDlg = ShowDialog <MultiButtonMsgDlg>(
                () => exportDlg3.OkDialog(GetTestPath("Tutorial-4_Parameters\\SRMcourse_20140211_Parameters_CEO.csv")));

            OkDialog(defaultWaringDlg, defaultWaringDlg.Btn1Click);
            WaitForClosedForm(exportDlg3);

            var paths = new string[4];

            for (int i = 0; i < paths.Length; i++)
            {
                paths[i] = GetTestPath("Tutorial-4_Parameters\\CEO_" + (i + 1) + ".wiff");
            }

            ImportResults("CEO", paths, ExportOptimize.CE);

            RestoreViewOnScreen(43);
            RunUI(() => SkylineWindow.ShowChromatogramLegends(false));
            PauseForScreenShot("Skyline Window", 3);

            ImportResults("", new[]
            {
                GetTestPath("Tutorial-4_Parameters\\CE_plus10.wiff"),
                GetTestPath("Tutorial-4_Parameters\\CE_minus10.wiff")
            }, ExportOptimize.NONE, false);

            RunUI(() =>
            {
                SkylineWindow.ShowAllTransitions();
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_maximum_view);
            });
            RestoreViewOnScreen(44);
            PauseForScreenShot("Skyline Window", 4);

            var transitionSettings2 = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

            RunUI(() => { transitionSettings2.SelectedTab = TransitionSettingsUI.TABS.Prediction; });
            var addCollisionEnergyDlg = ShowDialog <EditCEDlg>(transitionSettings2.AddToCEList);

            RunUI(() =>
            {
                addCollisionEnergyDlg.UseCurrentData();
                addCollisionEnergyDlg.RegressionName = "SRMcourse_20140211_Parameters_custom-CE-equation";
            });
            var equationGraphDlg = ShowDialog <GraphRegression>(addCollisionEnergyDlg.ShowGraph);

            PauseForScreenShot("Collision Energy Equation Graph", 6);
            OkDialog(equationGraphDlg, equationGraphDlg.CloseDialog);
            OkDialog(addCollisionEnergyDlg, addCollisionEnergyDlg.OkDialog);
            RunUI(() =>
            {
                transitionSettings2.RegressionCEName = "SRMcourse_20140211_Parameters_custom-CE-equation";
                transitionSettings2.SelectedTab      = TransitionSettingsUI.TABS.Instrument;
                transitionSettings2.MZMatchTolerance = 0.01;
            });
            PauseForScreenShot("Instrument Tab", 7);
            OkDialog(transitionSettings2, transitionSettings2.OkDialog);

            //Tutorial 4-B
            var manageResultsDlg = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);

            RunUI(manageResultsDlg.RemoveAllReplicates);
            OkDialog(manageResultsDlg, manageResultsDlg.OkDialog);
            string[] paths2 =
            {
                GetTestPath(string.Format("Tutorial-4_Parameters\\unscheduled_dwell{0}ms.wiff", 10)),
                GetTestPath(string.Format("Tutorial-4_Parameters\\unscheduled_dwell{0}ms.wiff", 20)),
                GetTestPath(string.Format("Tutorial-4_Parameters\\unscheduled_dwell{0}ms.wiff", 40)),
                GetTestPath(string.Format("Tutorial-4_Parameters\\unscheduled_dwell{0}ms.wiff", 60)),
                GetTestPath(string.Format("Tutorial-4_Parameters\\unscheduled_dwell{0}ms.wiff", 100))
            };

            ImportResults("", paths2, null, false);
            RestoreViewOnScreen(48);
            RunUI(() => SkylineWindow.AutoZoomBestPeak());
            PauseForScreenShot("Skyline Window", 8);
        }
예제 #8
0
        protected void DoResultsGridView()
        {
            // Results Grid View
            RestoreViewOnScreen(25);
            PauseForScreenShot <LiveResultsGrid>("Take full screen capture of floating windows", 25);
            RestoreViewOnScreen(26);
            PauseForScreenShot("Main window layout", 26);

            // Not understood: WaitForOpenForm occasionally hangs in nightly test runs. Fixed it by calling
            // ShowDialog when LiveResultsGrid cannot be found.
            //var resultsGridForm = WaitForOpenForm<LiveResultsGrid>();
            var resultsGridForm = FindOpenForm <LiveResultsGrid>() ??
                                  ShowDialog <LiveResultsGrid>(() => SkylineWindow.ShowResultsGrid(true));
            BoundDataGridView resultsGrid = null;

            RunUI(() =>
            {
                resultsGrid = resultsGridForm.DataGridView;
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.SelectedPath = ((SrmTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[0]).Path;
            });
            WaitForGraphs();

            RunUI(() =>
            {
                var precursorNoteColumn =
                    resultsGrid.Columns.Cast <DataGridViewColumn>()
                    .First(col => GetLocalizedCaption("PrecursorReplicateNote") == col.HeaderText);
                resultsGrid.CurrentCell = resultsGrid.Rows[0].Cells[precursorNoteColumn.Index];
                resultsGrid.BeginEdit(true);
                // ReSharper disable LocalizableElement
                resultsGrid.EditingControl.Text = "Low signal";   // Not L10N
                // ReSharper restore LocalizableElement
                resultsGrid.EndEdit();
                resultsGrid.CurrentCell = resultsGrid.Rows[1].Cells[resultsGrid.CurrentCell.ColumnIndex];
            });
            WaitForGraphs();
            RunUI(() => SkylineWindow.SelectedResultsIndex = 1);
            WaitForGraphs();

            PauseForScreenShot("Results Grid view subsection", 27);

            RunDlg <ViewEditor>(resultsGridForm.NavBar.CustomizeView, resultsGridViewEditor =>
            {
                // TODO: Update tutorial instructions with new name.
                resultsGridViewEditor.ViewName = "NewResultsGridView";
                var chooseColumnTab            = resultsGridViewEditor.ChooseColumnsTab;
                foreach (
                    var column in
                    new[]
                {
                    PropertyPath.Parse("MinStartTime"), PropertyPath.Parse("MaxEndTime"),
                    PropertyPath.Parse("LibraryDotProduct"), PropertyPath.Parse("TotalBackground"),
                    PropertyPath.Parse("TotalAreaRatio")
                })
                {
                    Assert.IsTrue(chooseColumnTab.ColumnNames.Contains(GetLocalizedCaption(column.Name)));
                    Assert.IsTrue(chooseColumnTab.TrySelect(column), "Unable to select {0}", column);
                    chooseColumnTab.RemoveColumn(column);
                    Assert.IsFalse(chooseColumnTab.ColumnNames.Contains(GetLocalizedCaption(column.Name)));
                }
                resultsGridViewEditor.OkDialog();
            });

            RunUI(() => SkylineWindow.SelectedNode.Expand());

            // Custom Annotations, p. 25
            var chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            var editListDlg          = ShowDialog <EditListDlg <SettingsListBase <AnnotationDef>, AnnotationDef> >(chooseAnnotationsDlg.EditAnnotationList);
            var defineAnnotationDlg  = ShowDialog <DefineAnnotationDlg>(editListDlg.AddItem);

            RunUI(() =>
            {
                defineAnnotationDlg.AnnotationName    = "Tailing"; // Not L10N
                defineAnnotationDlg.AnnotationType    = AnnotationDef.AnnotationType.true_false;
                defineAnnotationDlg.AnnotationTargets = AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.precursor_result);
            });
            PauseForScreenShot <DefineAnnotationDlg>("Define Annotation form", 28);

            OkDialog(defineAnnotationDlg, defineAnnotationDlg.OkDialog);
            OkDialog(editListDlg, editListDlg.OkDialog);
            RunUI(() => chooseAnnotationsDlg.AnnotationsCheckedListBox.SetItemChecked(0, true));
            PauseForScreenShot <DocumentSettingsDlg>("Annotation Settings form", 29);   // p. 26

            OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.OkDialog);

            FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++");
            var        liveResultsGrid = FindOpenForm <LiveResultsGrid>();
            ViewEditor viewEditor      = ShowDialog <ViewEditor>(liveResultsGrid.NavBar.CustomizeView);

            RunUI(() =>
            {
                viewEditor.ChooseColumnsTab.ActivateColumn(2);
                Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(
                                  PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX + "Tailing")));
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
            });
            PauseForScreenShot <ViewEditor.ChooseColumnsView>("Customize View form showing Tailing annotation checked", 30);
            OkDialog(viewEditor, viewEditor.OkDialog);
            PauseForScreenShot("Main window with Tailing column added to Results Grid");   // p. 27
        }
예제 #9
0
        protected override void DoTest()
        {
            // IsPauseForScreenShots = true;
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("SplitGraphUnitTest.sky")));
            CollectionAssert.AreEqual(new[] { "SplitGraph_rev1.clib" }, SkylineWindow.Document.Settings.PeptideSettings.Libraries.LibrarySpecs
                                      .Select(spec => Path.GetFileName(spec.FilePath)).ToArray());
            WaitForDocumentLoaded();
            // Test that AutoZoomNone and AutoZoomBestPeak work
            var graphChromatogram             = Application.OpenForms.OfType <GraphChromatogram>().First();
            var graphChromatogramGraphControl = AllControls(graphChromatogram).OfType <ZedGraphControl>().First();

            RunUI(() =>
            {
                // Select the first transition group
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 0);
                SkylineWindow.AutoZoomBestPeak();
                // Make sure that we are zoomed in to approximately the best peak
                Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0);
                Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 14.0, 1.0);
                // Remember the zoom state so that we can pretend to manually zoom later
                var zoomStateAuto = new ZoomState(graphChromatogramGraphControl.GraphPane, ZoomState.StateType.Zoom);
                SkylineWindow.AutoZoomNone();
                Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0);
                Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Max, 35.0, 1.0);
                // Pretend to manually zoom
                zoomStateAuto.ApplyState(graphChromatogramGraphControl.GraphPane);
                Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 13.0, 1.0);
                // Select some other transition group:
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo(2, 1);
                SkylineWindow.ShowPeakAreaReplicateComparison();
            });
            WaitForGraphs();
            // Ensure that we zoomed out when the selected transition group changed
            Assert.AreEqual(graphChromatogramGraphControl.GraphPane.XAxis.Scale.Min, 0.0, 1.0);

            var peakAreaSummary          = Application.OpenForms.OfType <GraphSummary>().First();
            var graphLibraryMatch        = Application.OpenForms.OfType <GraphSpectrum>().First();
            var libraryMatchGraphControl = AllControls(graphLibraryMatch).OfType <ZedGraphControl>().First();

            RunUI(() =>
            {
                Assert.IsTrue(Settings.Default.ShowLibraryChromatograms);
                AssertCurveListsSame(graphChromatogram.CurveList,
                                     libraryMatchGraphControl.GraphPane.CurveList);
                AssertCurveListsSame(graphChromatogram.CurveList,
                                     peakAreaSummary.GraphControl.GraphPane.CurveList);
                Assert.AreEqual(9, graphChromatogram.CurveList.Count);
                Assert.AreEqual(1, graphChromatogramGraphControl.MasterPane.PaneList.Count);
                Assert.AreEqual(1, peakAreaSummary.GraphControl.MasterPane.PaneList.Count);
                SkylineWindow.ShowPrecursorTransitions();
                Assert.AreEqual(3, graphChromatogram.CurveList.Count);
                // TODO(nicksh): Enable this when libraries filter based on precursor/product
                //AssertCurveListsSame(graphChromatogram.CurveList, libraryMatchGraphControl.GraphPane.CurveList);
                AssertCurveListsSame(graphChromatogram.CurveList,
                                     peakAreaSummary.GraphControl.GraphPane.CurveList);
                SkylineWindow.ShowProductTransitions();
                Assert.AreEqual(6, graphChromatogram.CurveList.Count);
                // TODO(nicksh): Enable this when libraries filter based on precursor/product
                AssertCurveListsSame(graphChromatogram.CurveList,
                                     libraryMatchGraphControl.GraphPane.CurveList);
                AssertCurveListsSame(graphChromatogram.CurveList,
                                     peakAreaSummary.GraphControl.GraphPane.CurveList);
                SkylineWindow.ShowAllTransitions();
                SkylineWindow.ShowSplitChromatogramGraph(true);
            });
            WaitForGraphs();
            Assert.AreEqual(2, graphChromatogramGraphControl.MasterPane.PaneList.Count);
            Assert.AreEqual(2, peakAreaSummary.GraphControl.MasterPane.PaneList.Count);
            AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[0]),
                                 peakAreaSummary.GraphControl.MasterPane.PaneList[0].CurveList);
            AssertCurveListsSame(graphChromatogram.GetCurveList(graphChromatogramGraphControl.MasterPane.PaneList[1]),
                                 peakAreaSummary.GraphControl.MasterPane.PaneList[1].CurveList);
        }
예제 #10
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));

            // Inserting a Transition List, p. 2
            {
                var doc = SkylineWindow.Document;

                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);

                RunUI(() =>
                {
                    pasteDlg.IsMolecule = true;
                    pasteDlg.SetSmallMoleculeColumns(null);  // Default columns
                });
                PauseForScreenShot <PasteDlg>("Paste Dialog in small molecule mode, default columns - show Columns checklist", 4);


                var columnsOrdered = new[]
                {
                    // Prepare transition list insert window to match tutorial
                    SmallMoleculeTransitionListColumnHeaders.moleculeGroup,
                    SmallMoleculeTransitionListColumnHeaders.namePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.labelType,
                    SmallMoleculeTransitionListColumnHeaders.mzPrecursor,
                    SmallMoleculeTransitionListColumnHeaders.chargePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.mzProduct,
                    SmallMoleculeTransitionListColumnHeaders.chargeProduct,
                    SmallMoleculeTransitionListColumnHeaders.coneVoltage,
                    SmallMoleculeTransitionListColumnHeaders.cePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.rtPrecursor,
                }.ToList();
                RunUI(() => { pasteDlg.SetSmallMoleculeColumns(columnsOrdered); });
                WaitForConditionUI(() => pasteDlg.GetUsableColumnCount() == columnsOrdered.Count);
                PauseForScreenShot <PasteDlg>("Paste Dialog with selected and ordered columns", 6);

                var text = "DrugX,Drug,light,283.04,1,129.96,1,26,16,2.7\r\nDrugX,Drug,heavy,286.04,1,133.00,1,26,16,2.7\r\n";
                text = text.Replace(',', TextUtil.CsvSeparator).Replace(".", LocalizationHelper.CurrentCulture.NumberFormat.NumberDecimalSeparator);
                SetClipboardText(text);
                RunUI(pasteDlg.PasteTransitions);
                RunUI(pasteDlg.ValidateCells);
                PauseForScreenShot <PasteDlg>("Paste Dialog with validated contents", 6);

                OkDialog(pasteDlg, pasteDlg.OkDialog);
                var docTargets = WaitForDocumentChange(doc);

                AssertEx.IsDocumentState(docTargets, null, 1, 1, 2, 2);
                Assert.IsFalse(docTargets.MoleculeTransitions.Any(t => t.Transition.IsPrecursor()));

                RunUI(() =>
                {
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                    SkylineWindow.Size = new Size(957, 654);
                });
                SelectNode(SrmDocument.Level.Transitions, 0);
                SelectNode(SrmDocument.Level.Transitions, 1);
                SelectNode(SrmDocument.Level.Molecules, 0);
                PauseForScreenShot <SkylineWindow>("Skyline with small molecule targets", 7);

                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() =>
                {
                    // Predicition Settings
                    transitionSettingsUI.SelectedTab             = TransitionSettingsUI.TABS.Prediction;
                    transitionSettingsUI.PrecursorMassType       = MassType.Monoisotopic;
                    transitionSettingsUI.FragmentMassType        = MassType.Monoisotopic;
                    transitionSettingsUI.RegressionCEName        = "Waters Xevo";                            // Collision Energy
                    transitionSettingsUI.RegressionDPName        = Resources.SettingsList_ELEMENT_NONE_None; // Declustering Potential
                    transitionSettingsUI.OptimizationLibraryName = Resources.SettingsList_ELEMENT_NONE_None; // Optimization Library
                    transitionSettingsUI.RegressionCOVName       = Resources.SettingsList_ELEMENT_NONE_None; // Compensation Voltage

                    transitionSettingsUI.UseOptimized = true;
                    transitionSettingsUI.OptimizeType = OptimizedMethodType.Transition.GetLocalizedString();
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings - Prediction tab", 4);


                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.SelectedPeptidesSmallMolsSubTab = 1;
                    transitionSettingsUI.SmallMoleculePrecursorAdducts   = Adduct.M_PLUS_H.AdductFormula;
                    transitionSettingsUI.SmallMoleculeFragmentAdducts    = Adduct.M_PLUS.AdductFormula;
                    transitionSettingsUI.SmallMoleculeFragmentTypes      = TransitionFilter.SMALL_MOLECULE_FRAGMENT_CHAR;
                    transitionSettingsUI.FragmentMassType = MassType.Monoisotopic;
                    transitionSettingsUI.SetAutoSelect    = true;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings -Filter tab", 4);


                RunUI(() =>
                {
                    // Instrument Settings
                    transitionSettingsUI.SelectedTab      = TransitionSettingsUI.TABS.Instrument;
                    transitionSettingsUI.MinMz            = 50;
                    transitionSettingsUI.MaxMz            = 1500;
                    transitionSettingsUI.MZMatchTolerance = .02;
                    transitionSettingsUI.MinTime          = null;
                    transitionSettingsUI.MaxTime          = null;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings -Instrument tab", 4);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(docTargets);

                RunUI(() => SkylineWindow.SaveDocument(GetTestPath("SMQuant_v1.sky")));

                ImportReplicates(true);

                SelectNode(SrmDocument.Level.Transitions, 1);
                SelectNode(SrmDocument.Level.Molecules, 0);

                PauseForScreenShot <SkylineWindow>("Skyline window multi-precursor graph", 8);

                var docResults = SkylineWindow.Document;

                var expectedTransCount = new Dictionary <string, int[]>
                {
                    // peptide count, transition groups, heavy transition groups, tranistions, heavy transitions
                    { "Blank_01", new[] { 1, 0, 1, 0, 1 } },
                    { "DoubleBlank1", new[] { 1, 0, 1, 0, 1 } },
                    { "DoubleBlank2", new[] { 1, 0, 1, 0, 1 } },
                    { "DoubleBlank3", new[] { 1, 0, 1, 0, 1 } },
                    { "47_0_1_1_00_1021523591", new[] { 1, 0, 1, 0, 1 } },
                };
                var msg = "";
                foreach (var chromatogramSet in docResults.Settings.MeasuredResults.Chromatograms)
                {
                    int[] transitions;
                    if (!expectedTransCount.TryGetValue(chromatogramSet.Name, out transitions))
                    {
                        transitions = new[] { 1, 1, 1, 1, 1 }
                    }
                    ;                                        // Most have this value
                    try
                    {
                        AssertResult.IsDocumentResultsState(docResults, chromatogramSet.Name, transitions[0],
                                                            transitions[1], transitions[2], transitions[3], transitions[4]);
                    }
                    catch (Exception x)
                    {
                        msg += TextUtil.LineSeparate(x.Message);
                    }
                }
                if (!string.IsNullOrEmpty(msg))
                {
                    Assert.IsTrue(string.IsNullOrEmpty(msg), msg);
                }

                RestoreViewOnScreen(9);
                SelectNode(SrmDocument.Level.Transitions, 0);
                SelectNode(SrmDocument.Level.Transitions, 1);
                SelectNode(SrmDocument.Level.Molecules, 0);
                PauseForScreenShot <SkylineWindow>("Skyline window multi-replicate layout", 9);

                // Peak integration correction
                ActivateReplicate("DoubleBlank1"); // First with mismatched RT
                PauseForScreenShot <SkylineWindow>("Selected replicate with unexpected RT", 10);
                ChangePeakBounds("DoubleBlank2", 26.5, 27.5);
                ChangePeakBounds("DoubleBlank3", 26.5, 27.5);
                ChangePeakBounds("DoubleBlank1", 26.5, 27.5);
                PauseForScreenShot <SkylineWindow>("Adjusted peak boundaries", 13);

                using (new WaitDocumentChange(1, true))
                {
                    // Quant settings
                    var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

                    RunUI(() =>
                    {
                        peptideSettingsUI.SelectedTab              = PeptideSettingsUI.TABS.Quantification;
                        peptideSettingsUI.QuantRegressionFit       = RegressionFit.LINEAR;
                        peptideSettingsUI.QuantNormalizationMethod =
                            new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                        peptideSettingsUI.QuantRegressionWeighting = RegressionWeighting.ONE_OVER_X_SQUARED;
                        peptideSettingsUI.QuantMsLevel             = null; // All
                        peptideSettingsUI.QuantUnits = "uM";
                    });
                    PauseForScreenShot <PeptideSettingsUI.QuantificationTab>("Peptide Settings - Quantitation", 14);
                    OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
                }

                // Setting sample types
                WaitForClosedForm <DocumentGridForm>();
                var documentGrid = ShowDialog <DocumentGridForm>(() => SkylineWindow.ShowDocumentGrid(true));
                RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates));
                PauseForScreenShot <DocumentGridForm>("Document Grid - replicates", 15);

                /*IDictionary<string, Tuple<SampleType, double?>> sampleTypes =
                 *  new Dictionary<string, Tuple<SampleType, double?>> {
                 *  {"Blank_01", new Tuple<SampleType, double?>(SampleType.BLANK,null)},
                 *  {"Blank_02", new Tuple<SampleType, double?>(SampleType.BLANK,null)},
                 *  {"Blank_03", new Tuple<SampleType, double?>(SampleType.BLANK,null)},
                 *  {"Cal_1_01", new Tuple<SampleType, double?>(SampleType.STANDARD,10)},
                 *  {"Cal_1_02", new Tuple<SampleType, double?>(SampleType.STANDARD,10)},
                 *  {"Cal_2_01", new Tuple<SampleType, double?>(SampleType.STANDARD,20)},
                 *  {"Cal_2_02", new Tuple<SampleType, double?>(SampleType.STANDARD,20)},
                 *  {"Cal_3_01", new Tuple<SampleType, double?>(SampleType.STANDARD,100)},
                 *  {"Cal_3_02", new Tuple<SampleType, double?>(SampleType.STANDARD,100)},
                 *  {"Cal_4_01", new Tuple<SampleType, double?>(SampleType.STANDARD,200)},
                 *  {"Cal_4_02", new Tuple<SampleType, double?>(SampleType.STANDARD,200)},
                 *  {"Cal_5_01", new Tuple<SampleType, double?>(SampleType.STANDARD,400)},
                 *  {"Cal_5_02", new Tuple<SampleType, double?>(SampleType.STANDARD,400)},
                 *  {"Cal_6_01", new Tuple<SampleType, double?>(SampleType.STANDARD,600)},
                 *  {"Cal_6_02", new Tuple<SampleType, double?>(SampleType.STANDARD,600)},
                 *  {"Cal_7_01", new Tuple<SampleType, double?>(SampleType.STANDARD,800)},
                 *  {"Cal_7_02", new Tuple<SampleType, double?>(SampleType.STANDARD,800)},
                 *  {"DoubleBlank1", new Tuple<SampleType, double?>(SampleType.DOUBLE_BLANK,null)},
                 *  {"DoubleBlank2", new Tuple<SampleType, double?>(SampleType.DOUBLE_BLANK,null)},
                 *  {"DoubleBlank3", new Tuple<SampleType, double?>(SampleType.DOUBLE_BLANK,null)},
                 *  {"QC_High_01", new Tuple<SampleType, double?>(SampleType.QC,589)},
                 *  {"QC_High_02", new Tuple<SampleType, double?>(SampleType.QC,589)},
                 *  {"QC_High_03", new Tuple<SampleType, double?>(SampleType.QC,589)},
                 *  {"QC_Low_01", new Tuple<SampleType, double?>(SampleType.QC,121)},
                 *  {"QC_Low_02", new Tuple<SampleType, double?>(SampleType.QC,121)},
                 *  {"QC_Low_03", new Tuple<SampleType, double?>(SampleType.QC,121)},
                 *  {"QC_Mid_01", new Tuple<SampleType, double?>(SampleType.QC,346)},
                 *  {"QC_Mid_02", new Tuple<SampleType, double?>(SampleType.QC,346)},
                 *  {"QC_Mid_03", new Tuple<SampleType, double?>(SampleType.QC,346)}
                 * };*/

                string concentrationsFileName;
                if (CultureInfo.CurrentUICulture.Name.StartsWith("zh"))
                {
                    concentrationsFileName = "Concentrations_zh.xlsx";
                }
                else if (CultureInfo.CurrentUICulture.Name.StartsWith("ja"))
                {
                    concentrationsFileName = "Concentrations_ja.xlsx";
                }
                else
                {
                    concentrationsFileName = "Concentrations.xlsx";
                }
                SetExcelFileClipboardText(GetTestPath(concentrationsFileName), "Sheet1", 3, false);
                RunUI(() =>
                {
                    // Find and select Blank_01 cell
                    var replicateColumnIndex = documentGrid.FindColumn(PropertyPath.Root).Index;
                    documentGrid.DataGridView.CurrentCell = documentGrid.DataGridView.Rows.Cast <DataGridViewRow>()
                                                            .Select(row => row.Cells[replicateColumnIndex])
                                                            .FirstOrDefault(cell => ((Replicate)cell.Value).Name == "Blank_01");

                    documentGrid.DataGridView.SendPaste();
                });
                //SetDocumentGridSampleTypesAndConcentrations(sampleTypes);
                PauseForScreenShot <DocumentGridForm>("Document Grid - sample types - enlarge for screenshot so all rows can be seen ", 16);
                foreach (var chromatogramSet in SkylineWindow.Document.MeasuredResults.Chromatograms)
                {
                    if (chromatogramSet.Name.StartsWith("DoubleBlank"))
                    {
                        Assert.AreEqual(SampleType.DOUBLE_BLANK, chromatogramSet.SampleType);
                    }
                    else if (chromatogramSet.Name.StartsWith("Blank"))
                    {
                        Assert.AreEqual(SampleType.BLANK, chromatogramSet.SampleType);
                    }
                    else if (chromatogramSet.Name.StartsWith("QC"))
                    {
                        Assert.AreEqual(SampleType.QC, chromatogramSet.SampleType);
                    }
                    else if (chromatogramSet.Name.StartsWith("Cal"))
                    {
                        Assert.AreEqual(SampleType.STANDARD, chromatogramSet.SampleType);
                    }
                    else
                    {
                        Assert.AreEqual(SampleType.UNKNOWN, chromatogramSet.SampleType);
                    }
                }

                RunUI(() => SkylineWindow.ShowCalibrationForm());
                PauseForScreenShot <CalibrationForm>("Calibration Curve ", 18);

                EnableDocumentGridColumns(documentGrid, Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates, 47,
                                          new[]
                {
                    "Proteins!*.Peptides!*.Results!*.Value.Quantification.Accuracy",
                    "Proteins!*.Peptides!*.Results!*.Value.ExcludeFromCalibration"
                },
                                          "Replicates_custom_quant");
                PauseForScreenShot <DocumentGridForm>("Custom document grid - resize so all rows are visible before screenshot", 19);

                SetDocumentGridExcludeFromCalibration();
                PauseForScreenShot <CalibrationForm>("Calibration Curve - outliers disabled", 20);

                if (IsCoverShotMode)
                {
                    RunUI(() =>
                    {
                        Settings.Default.ChromatogramFontSize = 14;
                        Settings.Default.AreaFontSize         = 14;
                        SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                        SkylineWindow.AutoZoomBestPeak();
                    });

                    RestoreCoverViewOnScreen();

                    RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, resultsDlg =>
                    {
                        resultsDlg.SelectedChromatograms =
                            SkylineWindow.DocumentUI.Settings.MeasuredResults.Chromatograms.Take(15);
                        resultsDlg.RemoveReplicates();
                        resultsDlg.OkDialog();
                    });

                    RunUI(SkylineWindow.FocusDocument);
                    TakeCoverShot();
                    return;
                }

                ImportReplicates(false); // Import the rest of the replicates
                PauseForScreenShot <CalibrationForm>("Calibration Curve - all replicates loaded", 21);

                RunUI(() => documentGrid.ChooseView(Resources.ReportSpecList_GetDefaults_Peptide_Ratio_Results));
                WaitForConditionUI(() => documentGrid.ColumnCount > 6);
                RunUI(() => {
                    var colReplicate = documentGrid.FindColumn(PropertyPath.Parse("Results!*.Value.ResultFile.Replicate"));
                    documentGrid.DataGridView.Sort(colReplicate, ListSortDirection.Ascending);
                });

                PauseForScreenShot <DocumentGridForm>("Document Grid - Peptide Ratio Results", 15);
                Settings.Default.CalibrationCurveOptions.LogXAxis = true;
                Settings.Default.CalibrationCurveOptions.LogYAxis = true;

                var calibrationForm = FindOpenForm <CalibrationForm>();
                RunUI(() => calibrationForm.UpdateUI(false));
                PauseForScreenShot <CalibrationForm>("Calibration Curve: Log");
            }
        }
예제 #11
0
        protected override void DoTest()
        {
            RunUI(() =>
            {
                SkylineWindow.ResetDefaultSettings();
                SkylineWindow.NewDocument();
            });
            ShowAndPositionAuditLog(false);
            PauseForScreenShot <AuditLogForm>("Empty Audit Log form.", 2);

            // Configuring Settings for Inserting a New Peptide, p. 3
            {
                var doc = SkylineWindow.Document;
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.RangeFrom   = Resources.TransitionFilter_FragmentStartFinders_ion_3;
                    transitionSettingsUI.RangeTo     = Resources.TransitionFilter_FragmentEndFinders_last_ion_minus_1;
                });
                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(doc);
            }

            PeptideSettingsUI peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Modifications);

            var modHeavyK = new StaticMod("Label:13C(6)15N(2) (C-term K)", "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15,
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyK, peptideSettingsUi);
            RunUI(() => peptideSettingsUi.PickedHeavyMods = new[] { modHeavyK.Name });

            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            PauseForScreenShot <AuditLogForm>("Audit Log form with settings modifications.", 4);

            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.Close();
                SkylineWindow.Width = 1010;
            });

            PauseForScreenShot("Undo list expanded. (manual)", 4);

            RunUI(SkylineWindow.Undo);

            PauseForScreenShot("Redo list expanded. (manual)", 5);

            RunUI(SkylineWindow.Redo);

            // Inserting a peptide sequence p. 5
            using (new CheckDocumentState(1, 1, 2, 10))
            {
                WaitForProteinMetadataBackgroundLoaderCompletedUI();

                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg);
                RunUI(() => SetClipboardText("IEAIPQIDK\tGST-tag"));
                RunUI(pasteDlg.PastePeptides);
                RunUI(() =>
                {
                    pasteDlg.Size = new Size(700, 210);
                    pasteDlg.Top  = SkylineWindow.Bottom + 20;
                });
                PauseForScreenShot <PasteDlg.PeptideListTab>("Insert Peptide List", 6);

                using (new WaitDocumentChange())
                {
                    OkDialog(pasteDlg, pasteDlg.OkDialog);
                }

                WaitForConditionUI(() => SkylineWindow.SequenceTree.Nodes.Count > 0);
            }

            RunUI(() =>
            {
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.Height = 390;
            });

            PauseForScreenShot("Main window with Targets view", 6);

            ShowAndPositionAuditLog(true);
            PauseForScreenShot <AuditLogForm>("Audit Log form with inserted peptide.", 7);

            ShowLastExtraInfo("Extra info form with inserted peptide info.", 7);

            string documentPath = GetTestPath("AuditLogTutorial" + SrmDocument.EXT);

            RunUI(() => SkylineWindow.SaveDocument(documentPath));
            WaitForCondition(() => File.Exists(documentPath));

            // Importing RAW files into Skyline p. 7
            var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            RunUI(() =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value;
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg.NamedPathSets = namedPathSets.ToArray();
            });
            OkDialog(importResultsDlg, importResultsDlg.OkDialog);

            WaitForGraphs();

            RunUI(() =>
            {
                SkylineWindow.SelectedPath             = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                Settings.Default.ArrangeGraphsOrder    = GroupGraphsOrder.Document.ToString();
                Settings.Default.ArrangeGraphsReversed = false;
                SkylineWindow.ArrangeGraphsTabbed();
                SkylineWindow.AutoZoomBestPeak();
            });
            WaitForCondition(() => Equals(9, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden)),
                             "unexpected visible graphChromatogram count");

            WaitForCondition(10 * 60 * 1000,    // ten minutes
                             () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);

            PauseForScreenShot <AuditLogForm>("Audit Log form with imported data files.", 9);

            ShowLastExtraInfo("Extra info form for the import.", 9);

            // Peptide Quantitification Settings p. 9
            peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            RunUI(() => peptideSettingsUi.SelectedTab = (PeptideSettingsUI.TABS) 5);
            const string quantUnits = "fmol/ul";

            RunUI(() =>
            {
                peptideSettingsUi.QuantRegressionFit       = RegressionFit.LINEAR;
                peptideSettingsUi.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                peptideSettingsUi.QuantUnits = quantUnits;
            });
            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            PauseForScreenShot <AuditLogForm>("Audit Log form with quantification settings.", 10);

            // Specify analyte concentrations of external standards
            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.Close();
                SkylineWindow.ShowDocumentGrid(true);
            });
            var documentGridForm = FindOpenForm <DocumentGridForm>();

            RunUI(() =>
            {
                documentGridForm.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates);
            });
            WaitForConditionUI(() => documentGridForm.IsComplete);

            var concentrations = new[] { 40, 12.5, 5, 2.5, 1, .5, .25, .1 };

            string pasteString = TextUtil.LineSeparate(concentrations.Select((f, i) =>
                                                                             QuantificationStrings.SampleType_STANDARD_Standard + "\t" + f));

            ClipboardEx.SetText(pasteString);

            using (new WaitDocumentChange())
            {
                RunUI(() =>
                {
                    var colSampleType = documentGridForm.FindColumn(PropertyPath.Root.Property("SampleType"));
                    documentGridForm.DataGridView.CurrentCell = documentGridForm.DataGridView.Rows[1].Cells[colSampleType.Index];
                    documentGridForm.DataGridView.SendPaste();
                });
            }

            // ReSharper restore AccessToModifiedClosure
            WaitForConditionUI(() => documentGridForm.IsComplete);
            RunUI(() =>
            {
                var gridFloatingWindow  = documentGridForm.Parent.Parent;
                gridFloatingWindow.Size = new Size(370, 315);
                gridFloatingWindow.Top  = SkylineWindow.Bottom + 20;
            });
            PauseForScreenShot <DocumentGridForm>("Document grid with concentrations filled in", 11);
            RunUI(documentGridForm.Close);

            ShowAndPositionAuditLog(true);
            PauseForScreenShot <AuditLogForm>("Audit Log form with grid changes", 12);

            ShowLastExtraInfo("Extra Info for the analyte data import.", 12);
            RunUI(SkylineWindow.AuditLogForm.Close);

            const string unknownReplicate = "FOXN1-GST";

            RestoreViewOnScreen(13);
            ActivateReplicate(unknownReplicate);
            SelectNode(SrmDocument.Level.TransitionGroups, 1);
            RunUI(() => SkylineWindow.Size = new Size(936, 527));
            WaitForGraphs();

            PauseForScreenShot("Heavy precursor chromatogram", 13);

            RunUI(() =>
            {
                var pathHeavy = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 1);

                var graphChrom = SkylineWindow.GetGraphChrom(unknownReplicate);
                Assert.IsNotNull(graphChrom);
                Assert.AreEqual(unknownReplicate, graphChrom.NameSet);

                var firstGroupInfo = graphChrom.ChromGroupInfos.FirstOrDefault();
                Assert.IsNotNull(firstGroupInfo, "Missing group info");
                var firstChromItem = graphChrom.GraphItems.FirstOrDefault(gci => gci.TransitionChromInfo != null);
                Assert.IsNotNull(firstChromItem, "Missing graph item");

                var listChanges = new List <ChangedPeakBoundsEventArgs>
                {
                    new ChangedPeakBoundsEventArgs(pathHeavy,
                                                   null,
                                                   graphChrom.NameSet,
                                                   firstGroupInfo.FilePath,
                                                   firstChromItem.GetValidPeakBoundaryTime(20.65),
                                                   firstChromItem.GetValidPeakBoundaryTime(21.15),
                                                   PeakIdentification.FALSE,
                                                   PeakBoundsChangeType.both)
                };
                graphChrom.SimulateChangedPeakBounds(listChanges);
            });

            ShowAndPositionAuditLog(true, 50, 200);
            WaitForConditionUI(500, () => SkylineWindow.AuditLogForm.DataGridView.Rows.Count > 0);

            PauseForScreenShot <AuditLogForm>("Audit Log form with changed integration boundary.", 14);
            int reasonIndex = 2;

            using (new WaitDocumentChange())
            {
                RunUI(() =>
                {
                    var pathReason = PropertyPath.Root.Property("Reason");
                    var colReason  = SkylineWindow.AuditLogForm.FindColumn(pathReason);
                    reasonIndex    = colReason.Index;
                    SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex,
                                 "Changed peak integration as instructed by the tutorial");
                });
            }
            RunUI(() => SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex));
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            PauseForScreenShot <AuditLogForm>("Audit Log form with updated reason.", 14);

            // View the calibration curve p. 15
            RunUI(() => SkylineWindow.ShowCalibrationForm());
            var calibrationForm = FindOpenForm <CalibrationForm>();
            var priorZoomState  = ZoomCalibrationCurve(calibrationForm, 0.52);

            RunUI(() =>
            {
                Assert.AreEqual(CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, quantUnits), calibrationForm.ZedGraphControl.GraphPane.XAxis.Title.Text);
                Assert.AreEqual(string.Format(QuantificationStrings.CalibrationCurveFitter_PeakAreaRatioText__0___1__Peak_Area_Ratio, IsotopeLabelType.light.Title, IsotopeLabelType.heavy.Title),
                                calibrationForm.ZedGraphControl.GraphPane.YAxis.Title.Text);

                VerifyCalibrationCurve(calibrationForm, 5.4065E-1, -2.9539E-1, 0.999);
            });

            PauseForScreenShot <CalibrationForm>("Calibration curve zoomed", 15);
            RunUI(() =>
            {
                priorZoomState?.ApplyState(calibrationForm.ZedGraphControl.GraphPane);

                var chromatograms = SkylineWindow.DocumentUI.Settings.MeasuredResults.Chromatograms;
                new [] { 5, 6, 7, 8 }.ForEach((index) =>
                {
                    int replicateIdx = chromatograms.IndexOf((ch) => ch.Name.Equals("Standard_" + index));
                    Assert.IsTrue(replicateIdx >= 0);
                    using (var excludeStandardMenu = calibrationForm.MakeExcludeStandardMenuItem(replicateIdx))
                    {
                        excludeStandardMenu?.PerformClick();
                    }
                });
            });
            WaitForGraphs();
            RunUI(() => VerifyCalibrationCurve(calibrationForm, 5.52E-1, -6.3678E-1, 1));
            OkDialog(calibrationForm, calibrationForm.Close);

            PauseForScreenShot <AuditLogForm>("Audit Log with excluded standard records", 16);

            PauseForScreenShot <AuditLogForm>("Audit Log Reports menu (manual)", 16);

            // TODO(nicksh): Audit log reason field does not currently support fill down
//            RunUI(() =>
//            {
//                SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex, "Excluded standard below LOD");
//                for (int i = 0; i < 4; i++)
//                    SkylineWindow.AuditLogForm.DataGridView.Rows[i].Cells[reasonIndex].Selected = true;
//            });
//            RunUI(() => SkylineWindow.AuditLogForm.DataboundGridControl.FillDown());
            RunUI(() =>
            {
                for (int i = 0; i < 4; i++)
                {
                    SetCellValue(SkylineWindow.AuditLogForm.DataGridView, i, reasonIndex, "Excluded standard below LOD");
                }
            });
            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.ChooseView(AuditLogStrings.AuditLogForm_MakeAuditLogForm_Undo_Redo);
            });
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            RunUI(() =>
            {
                var floatingWindow    = SkylineWindow.AuditLogForm.Parent.Parent;
                floatingWindow.Height = 334;
                floatingWindow.Width -= 15;
            });
            PauseForScreenShot <AuditLogForm>("Audit Log with UndoRedo view.", 17);
            if (IsCoverShotMode)
            {
                RunUI(() =>
                {
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                });

                RestoreCoverViewOnScreen();

                var calibrationCoverForm = WaitForOpenForm <CalibrationForm>();
                ZoomCalibrationCurve(calibrationCoverForm, 0.53);
                var floatingLogWindow = SkylineWindow.AuditLogForm.Parent.Parent;
                var floatingCalWindow = calibrationCoverForm.Parent.Parent;
                RunUI(() =>
                {
                    floatingLogWindow.Top  = SkylineWindow.Bottom - floatingLogWindow.Height - 8;
                    floatingLogWindow.Left =
                        (SkylineWindow.Left + SkylineWindow.Right) / 2 - floatingLogWindow.Width / 2;
                    floatingCalWindow.Top  = SkylineWindow.Top + 8;
                    floatingCalWindow.Left = SkylineWindow.Right - floatingCalWindow.Width - 8;
                    SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex);
                    SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex - 1);
                });
                TakeCoverShot();
            }

            var customizeDialog = ShowDialog <ViewEditor>(SkylineWindow.AuditLogForm.NavBar.CustomizeView);

            RunUI(() =>
            {
                customizeDialog.ViewName = "Custom Columns";
                var columnsToAdd         = new[]
                {
                    PropertyPath.Parse("SkylineVersion"),
                    PropertyPath.Parse("User"),
                };
                foreach (var id in columnsToAdd)
                {
                    Assert.IsTrue(customizeDialog.ChooseColumnsTab.TrySelect(id), "Unable to select {0}", id);
                    customizeDialog.ChooseColumnsTab.AddSelectedColumn();
                }

                customizeDialog.Height = 370;
            });
            PauseForScreenShot <ViewEditor.ChooseColumnsView>("Custom Columns report template", 17);
            OkDialog(customizeDialog, customizeDialog.OkDialog);
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            RunUI(() => SkylineWindow.AuditLogForm.Parent.Parent.Height += 10); // Extra for 2-line headers
            PauseForScreenShot <AuditLogForm>("Audit Log with custom view.", 18);

            var registrationDialog = ShowDialog <MultiButtonMsgDlg>(() => SkylineWindow.ShowPublishDlg(null));

            PauseForScreenShot <MultiButtonMsgDlg>("Upload confirmation dialog.", 19);

            var loginDialog = ShowDialog <EditServerDlg>(registrationDialog.ClickNo);

            PauseForScreenShot <EditServerDlg>("Login dialog.", 20);

            RunUI(() =>
            {
                loginDialog.URL      = SERVER_URL;
                loginDialog.Username = PANORAMA_USER_NAME;
            });

            if (!IsPauseForScreenShots)
            {
                OkDialog(loginDialog, loginDialog.CancelButton.PerformClick);
            }
            else
            {
                PauseTest("Enter password. (manual) No screen shot.");

                var publishDialog = ShowDialog <PublishDocumentDlg>(loginDialog.OkDialog);
                WaitForCondition(() => publishDialog.IsLoaded);
                RunUI(() =>
                {
                    publishDialog.SelectItem(testFolderName);
                });
                PauseForScreenShot <PublishDocumentDlg>("Folder selection dialog.", 21);
                var browserConfirmationDialog = ShowDialog <MultiButtonMsgDlg>(publishDialog.OkDialog);

                OkDialog(browserConfirmationDialog, browserConfirmationDialog.ClickYes);

                PauseForScreenShot("Uploaded document in Panorama (in browser).");

                Regex reDocId = new Regex(@"\?id=([0-9]+)");
                Assert.IsTrue(reDocId.IsMatch(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString()));

                string docId      = reDocId.Match(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString()).Groups[1].Captures[0].Value;
                Uri    serverUri  = new Uri(SERVER_URL);
                Uri    requestUri = PanoramaUtil.Call(serverUri, "targetedms", String.Format("{0}/{1}", PANORAMA_FOLDER, testFolderName),
                                                      "showSkylineAuditLog", "id=" + docId);
                Process.Start(requestUri.ToString());
                PauseForScreenShot("Uploaded document audit log in Panorama (in browser).");
            }
        }
예제 #12
0
        protected override void DoTest()
        {
            const double peakWidthZoomFactor = 2.0;

            RunUI(() =>
            {
                SkylineWindow.OpenFile(TestFilesDir.GetTestPath("NoQuantitativeTransitionsTest.sky"));
                SkylineWindow.AutoZoomBestPeak();
            });
            WaitForDocumentLoaded();
            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, dlg =>
            {
                dlg.TimeRange           = peakWidthZoomFactor;
                dlg.IsPeakWidthRelative = true;
                dlg.OkDialog();
            });

            // Do a rescore so that we can be sure that the way things are in the document and exactly
            // how the current version of Skyline calculates them
            var manageResultsDlg = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);

            RunDlg <RescoreResultsDlg>(manageResultsDlg.Rescore, dlg => dlg.Rescore(false));
            WaitForDocumentLoaded();

            var document = SkylineWindow.Document;

            // Make sure that the TransitionGroupChromInfo's have their values set based on the quantitative peaks, unless there
            // are no quantitative peaks
            foreach (var transitionGroupDocNode in document.MoleculeTransitionGroups)
            {
                for (int iReplicate = 0; iReplicate < transitionGroupDocNode.Results.Count; iReplicate++)
                {
                    var transitionGroupChromInfo = transitionGroupDocNode.Results[iReplicate][0];
                    var quanChromInfos           = new List <TransitionChromInfo>();
                    var nonQuanChromInfos        = new List <TransitionChromInfo>();
                    foreach (var t in transitionGroupDocNode.Transitions)
                    {
                        var chromInfo = t.Results[iReplicate][0];
                        if (chromInfo.IsEmpty)
                        {
                            continue;
                        }

                        if (t.IsQuantitative(document.Settings))
                        {
                            quanChromInfos.Add(chromInfo);
                        }
                        else
                        {
                            nonQuanChromInfos.Add(chromInfo);
                        }
                    }

                    if (quanChromInfos.Any())
                    {
                        AssertEx.AreEqual(transitionGroupChromInfo.StartRetentionTime, quanChromInfos.Min(c => c.StartRetentionTime));
                        AssertEx.AreEqual(transitionGroupChromInfo.EndRetentionTime, quanChromInfos.Max(c => c.EndRetentionTime));
                        AssertEx.AreEqual(transitionGroupChromInfo.Height, quanChromInfos.Max(c => c.Height));
                    }
                    else
                    {
                        AssertEx.AreEqual(transitionGroupChromInfo.StartRetentionTime, nonQuanChromInfos.Min(c => c.StartRetentionTime));
                        AssertEx.AreEqual(transitionGroupChromInfo.EndRetentionTime, nonQuanChromInfos.Max(c => c.EndRetentionTime));
                        AssertEx.IsNull(transitionGroupChromInfo.Height);
                    }
                }
            }

            // Verify that the chromatogram graph correctly zooms to the best quantitative peak, or,
            // if there are no quantitative peaks, falls back to the best non-quantitative peak,
            // or is zoomed out entirely
            foreach (var displayTypeChrom in new[]
                     { DisplayTypeChrom.all, DisplayTypeChrom.single, DisplayTypeChrom.total })
            {
                RunUI(() => SkylineWindow.SetDisplayTypeChrom(displayTypeChrom));
                for (int iReplicate = 0; iReplicate < document.Settings.MeasuredResults.Chromatograms.Count; iReplicate++)
                {
                    var chromatogramSet = document.Settings.MeasuredResults.Chromatograms[iReplicate];
                    var graphChrom      = SkylineWindow.GetGraphChrom(chromatogramSet.Name);
                    RunUI(() =>
                    {
                        graphChrom.Activate();
                        graphChrom.Focus();
                    });
                    foreach (var protein in SkylineWindow.Document.MoleculeGroups)
                    {
                        foreach (var peptide in protein.Molecules)
                        {
                            foreach (var precursor in peptide.TransitionGroups)
                            {
                                foreach (var transition in precursor.Transitions)
                                {
                                    RunUI(() =>
                                    {
                                        SkylineWindow.SelectedPath = new IdentityPath(protein.Id, peptide.Id,
                                                                                      precursor.Id, transition.Id);
                                        SkylineWindow.AutoZoomNone();
                                        SkylineWindow.AutoZoomBestPeak();
                                    });
                                    var transitionChromInfos = new List <TransitionChromInfo>();
                                    if (displayTypeChrom == DisplayTypeChrom.single)
                                    {
                                        var transitionChromInfo = transition.Results[iReplicate][0];
                                        if (!transitionChromInfo.IsEmpty)
                                        {
                                            transitionChromInfos.Add(transitionChromInfo);
                                        }
                                    }
                                    else
                                    {
                                        transitionChromInfos.AddRange(precursor.Transitions.Where(t => t.ExplicitQuantitative)
                                                                      .Select(t => t.Results[iReplicate][0]).Where(t => !t.IsEmpty));
                                        if (!transitionChromInfos.Any())
                                        {
                                            if (displayTypeChrom != DisplayTypeChrom.total ||
                                                precursor.Transitions.All(t => !t.ExplicitQuantitative))
                                            {
                                                transitionChromInfos.AddRange(precursor.Transitions
                                                                              .Select(t => t.Results[iReplicate][0]).Where(t => !t.IsEmpty));
                                            }
                                        }
                                    }

                                    var zoomState = graphChrom.ZoomState;
                                    if (transitionChromInfos.Any())
                                    {
                                        var          peakStartTime     = transitionChromInfos.Min(t => t.StartRetentionTime);
                                        var          peakEndTime       = transitionChromInfos.Max(t => t.EndRetentionTime);
                                        var          midPeak           = (peakStartTime + peakEndTime) / 2;
                                        var          halfPeakWidth     = (peakEndTime - peakStartTime) / 2;
                                        double       expectedZoomStart = midPeak - halfPeakWidth * peakWidthZoomFactor;
                                        double       expectedZoomEnd   = midPeak + halfPeakWidth * peakWidthZoomFactor;
                                        const double tolerance         = .001;
                                        AssertEx.AreEqual(expectedZoomStart, zoomState.XAxis.Min, tolerance);
                                        AssertEx.AreEqual(expectedZoomEnd, zoomState.XAxis.Max, tolerance);
                                    }
                                    else
                                    {
                                        var expectedStart = graphChrom.ChromGroupInfos[0].TimeIntensitiesGroup.MinTime;
                                        var expectedEnd   = graphChrom.ChromGroupInfos[0].TimeIntensitiesGroup.MaxTime;
                                        AssertEx.IsTrue(zoomState.XAxis.Min <= expectedStart);
                                        AssertEx.IsTrue(zoomState.XAxis.Max >= expectedEnd);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        protected override void DoTest()
        {
            // Clean-up before running the test
            RunUI(() => SkylineWindow.ModifyDocument("Set default settings",
                                                     d => d.ChangeSettings(SrmSettingsList.GetDefault())));

            SrmDocument doc = SkylineWindow.Document;

            const string documentBaseName = "Ms1FilterTutorial";
            string       documentFile     = GetTestPath(documentBaseName + SrmDocument.EXT);

            RunUI(() => SkylineWindow.SaveDocument(documentFile));

            // Launch the wizard
            var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg);

            // We're on the "Build Spectral Library" page of the wizard.
            // Add the test xml file to the search files list and try to
            // build the document library.
            string[] searchFiles =
            {
                GetTestPath("100803_0001_MCF7_TiB_L.group.xml"),      // Not L10N
                GetTestPath("100803_0005b_MCF7_TiTip3.group.xml")     // Not L10N
            };
            foreach (var searchFile in searchFiles)
            {
                Assert.IsTrue(File.Exists(searchFile), string.Format("File {0} does not exist.", searchFile));
            }

            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - Build Spectral Library empty page", 3);

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.spectra_page);
                importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(searchFiles);

                // Sanity check here, because of failure getting both files for results import below
                var searchNames = importPeptideSearchDlg.BuildPepSearchLibControl.SearchFilenames;
                Assert.AreEqual(searchFiles.Length, searchNames.Length,
                                PathsMessage("Unexpected search files found.", searchNames));
                var builder = importPeptideSearchDlg.BuildPepSearchLibControl.ImportPeptideSearch.GetLibBuilder(
                    SkylineWindow.DocumentUI, SkylineWindow.DocumentFilePath, false);
                Assert.IsTrue(ArrayUtil.EqualsDeep(searchFiles, builder.InputFiles),
                              PathsMessage("Unexpected BlibBuild input files.", builder.InputFiles));
                importPeptideSearchDlg.BuildPepSearchLibControl.DebugMode = true;
            });
            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - Build Spectral Library populated page", 4);

            WaitForConditionUI(() => importPeptideSearchDlg.IsNextButtonEnabled);
            var ambiguousDlg = ShowDialog <MessageDlg>(() => importPeptideSearchDlg.ClickNextButton());

            RunUI(() => AssertEx.Contains(ambiguousDlg.Message,
                                          Resources.BiblioSpecLiteBuilder_AmbiguousMatches_The_library_built_successfully__Spectra_matching_the_following_peptides_had_multiple_ambiguous_peptide_matches_and_were_excluded_));
            OkDialog(ambiguousDlg, ambiguousDlg.OkDialog);

            // Verify document library was built
            string docLibPath          = BiblioSpecLiteSpec.GetLibraryFileName(documentFile);
            string redundantDocLibPath = BiblioSpecLiteSpec.GetRedundantName(docLibPath);

            Assert.IsTrue(File.Exists(docLibPath) && File.Exists(redundantDocLibPath));
            var librarySettings = SkylineWindow.Document.Settings.PeptideSettings.Libraries;

            Assert.IsTrue(librarySettings.HasDocumentLibrary);
            // Verify input paths sent to BlibBuild
            string buildArgs   = importPeptideSearchDlg.BuildPepSearchLibControl.LastBuildCommandArgs;
            string buildOutput = importPeptideSearchDlg.BuildPepSearchLibControl.LastBuildOutput;
            var    argLines    = buildArgs.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var    dirCommon   = PathEx.GetCommonRoot(searchFiles);
            var    searchLines = searchFiles.Select(f => PathEx.RemovePrefix(f, dirCommon)).ToArray();

            Assert.IsTrue(ArrayUtil.EqualsDeep(searchLines, argLines.Skip(1).ToArray()), buildArgs);

            // Verify resulting .blib file contains the expected files
            var docLib                   = librarySettings.Libraries[0];
            int expectedFileCount        = searchFiles.Length;
            int expectedRedundantSpectra = 813; // 446 with TiTip only
            int expectedSpectra          = 552; // 428 with TiTip3 only

            if (expectedFileCount != docLib.FileCount)
            {
                var searchFileNames = searchFiles.Select(Path.GetFileName).ToArray();
                using (var blibDbRedundant = BlibDb.OpenBlibDb(redundantDocLibPath))
                {
                    VerifyLib(searchFileNames, expectedRedundantSpectra, blibDbRedundant.GetIdFilePaths(), blibDbRedundant.GetSpectraCount(),
                              "redundant library", buildArgs, buildOutput);
                }
                using (var blibDb = BlibDb.OpenBlibDb(docLibPath))
                {
                    VerifyLib(searchFileNames, expectedSpectra, blibDb.GetIdFilePaths(), blibDb.GetSpectraCount(),
                              "SQLite library", buildArgs, buildOutput);
                }
                VerifyLib(searchFileNames, expectedSpectra, docLib.LibraryDetails.DataFiles.Select(d => d.IdFilePath).ToArray(), docLib.SpectrumCount,
                          "in memory", buildArgs, buildOutput);
            }

            // We're on the "Extract Chromatograms" page of the wizard.
            // All the test results files are in the same directory as the
            // document file, so all the files should be found, and we should
            // just be able to move to the next page.
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page &&
                               importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles.Count > 0 &&
                               importPeptideSearchDlg.IsNextButtonEnabled);

            // Wait for extra for both source files in the list
            TryWaitForConditionUI(10 * 1000, () => importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles.Count == searchFiles.Length);

            RunUI(() =>
            {
                // Check for missing files
                var missingFiles = importPeptideSearchDlg.ImportResultsControl.MissingResultsFiles.ToArray();
                Assert.AreEqual(0, missingFiles.Length,
                                PathsMessage("Unexpected missing file found.", missingFiles));
                // Check for expected results files
                var resultsNames = importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles.Select(f => f.Name).ToArray();
                Assert.AreEqual(searchFiles.Length, importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles.Count,
                                PathsMessage("Unexpected results files found.", resultsNames));
                // Check for expected common prefix
                var commonPrefix = ImportResultsDlg.GetCommonPrefix(resultsNames);
                Assert.IsFalse(string.IsNullOrEmpty(commonPrefix),
                               PathsMessage("File names do not have a common prefix.", resultsNames));
                Assert.AreEqual("100803_000", commonPrefix);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.ChromatogramsPage>("Import Peptide Search - Extract Chromatograms page", 6);

            var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(() => importPeptideSearchDlg.ClickNextButton());

            PauseForScreenShot <ImportResultsNameDlg>("Import Results - Common prefix form", 7);

            OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);

            // Wait for the "Add Modifications" page of the wizard.
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.match_modifications_page);

            List <string> modsToCheck = new List <string> {
                "Phospho (ST)", "Phospho (Y)", "Oxidation (M)"
            };                                                                                              // Not L10N

            RunUI(() =>
            {
                importPeptideSearchDlg.MatchModificationsControl.CheckedModifications = modsToCheck;
            });
            PauseForScreenShot <ImportPeptideSearchDlg.MatchModsPage>("Import Peptide Search - Add Modifications page", 8);
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // We're on the "Configure MS1 Full-Scan Settings" page of the wizard.
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page);
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorCharges      = new[] { 2, 3, 4 };
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorMassAnalyzer = FullScanMassAnalyzerType.tof;
                importPeptideSearchDlg.FullScanSettingsControl.PrecursorRes          = 10 * 1000;

                Assert.AreEqual(importPeptideSearchDlg.FullScanSettingsControl.PrecursorIsotopesCurrent, FullScanPrecursorIsotopes.Count);
                Assert.AreEqual(FullScanMassAnalyzerType.tof, importPeptideSearchDlg.FullScanSettingsControl.PrecursorMassAnalyzer);
                Assert.AreEqual(10 * 1000, importPeptideSearchDlg.FullScanSettingsControl.PrecursorRes);
                Assert.AreEqual(3, importPeptideSearchDlg.FullScanSettingsControl.Peaks);
                Assert.AreEqual(RetentionTimeFilterType.ms2_ids, importPeptideSearchDlg.FullScanSettingsControl.RetentionTimeFilterType);
                Assert.AreEqual(5, importPeptideSearchDlg.FullScanSettingsControl.TimeAroundMs2Ids);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.Ms1FullScanPage>("Import Peptide Search - Configure MS1 Full-Scan Settings page", 9);

            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // Last page of wizard - Import Fasta.
            string fastaPath = GetTestPath("12_proteins.062011.fasta");

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.import_fasta_page);
                Assert.AreEqual("Trypsin [KR | P]", importPeptideSearchDlg.ImportFastaControl.Enzyme.GetKey());
                importPeptideSearchDlg.ImportFastaControl.MaxMissedCleavages = 2;
                importPeptideSearchDlg.ImportFastaControl.SetFastaContent(fastaPath);
                Assert.IsFalse(importPeptideSearchDlg.ImportFastaControl.DecoyGenerationEnabled);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.FastaPage>("Import Peptide Search - Import FASTA page", 12);

            var peptidesPerProteinDlg = ShowDialog <PeptidesPerProteinDlg>(() => importPeptideSearchDlg.ClickNextButton());

            WaitForCondition(() => peptidesPerProteinDlg.DocumentFinalCalculated);
            RunUI(() =>
            {
                int proteinCount, peptideCount, precursorCount, transitionCount;
                peptidesPerProteinDlg.NewTargetsAll(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                Assert.AreEqual(11, proteinCount);
                Assert.AreEqual(51, peptideCount);
                Assert.AreEqual(52, precursorCount);
                Assert.AreEqual(156, transitionCount);
                peptidesPerProteinDlg.NewTargetsFinal(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                Assert.AreEqual(11, proteinCount);
                Assert.AreEqual(51, peptideCount);
                Assert.AreEqual(52, precursorCount);
                Assert.AreEqual(156, transitionCount);
            });
            OkDialog(peptidesPerProteinDlg, peptidesPerProteinDlg.OkDialog);

            var allChromGraph = WaitForOpenForm <AllChromatogramsGraph>();

            RunUI(() =>
            {
                allChromGraph.Left = SkylineWindow.Right + 20;
                allChromGraph.Activate();
            });

            PauseForScreenShot <AllChromatogramsGraph>("Loading chromatograms window", 13);
            WaitForDocumentChangeLoaded(doc, 8 * 60 * 1000); // 10 minutes

            var libraryExplorer   = ShowDialog <ViewLibraryDlg>(() => SkylineWindow.OpenLibraryExplorer(documentBaseName));
            var matchedPepModsDlg = WaitForOpenForm <AddModificationsDlg>();

            PauseForScreenShot <AddModificationsDlg>("Add mods alert", 14);
            RunUI(() =>
            {
                Assert.AreEqual(13, matchedPepModsDlg.NumMatched);
                Assert.AreEqual(0, matchedPepModsDlg.NumUnmatched);
                matchedPepModsDlg.CancelDialog();
            });
            RunUI(() =>
            {
                libraryExplorer.GraphSettings.ShowBIons        = true;
                libraryExplorer.GraphSettings.ShowYIons        = true;
                libraryExplorer.GraphSettings.ShowCharge1      = true;
                libraryExplorer.GraphSettings.ShowCharge2      = true;
                libraryExplorer.GraphSettings.ShowPrecursorIon = true;
            });

            PauseForScreenShot <ViewLibraryDlg>("Spectral Library Explorer", 15);
            RunUI(() =>
            {
                const string sourceFirst = "100803_0005b_MCF7_TiTip3.wiff";
                const double timeFirst   = 35.2128;
                Assert.AreEqual(sourceFirst, libraryExplorer.SourceFile);
                Assert.AreEqual(timeFirst, libraryExplorer.RetentionTime, 0.01);
                libraryExplorer.SelectedIndex++;
                Assert.AreNotEqual(sourceFirst, libraryExplorer.SourceFile);
                Assert.AreNotEqual(timeFirst, libraryExplorer.RetentionTime, 0.01);
            });
            OkDialog(libraryExplorer, libraryExplorer.CancelDialog);

            const int TIB_L = 0; // index for Tib_L
            const int TIP3  = 1; // index for Tip3

            AssertEx.IsDocumentState(SkylineWindow.Document, null, 11, 51, 52, 156);
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, GetFileNameWithoutExtension(searchFiles[TIB_L]), 51, 52, 0, 156, 0);
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, GetFileNameWithoutExtension(searchFiles[TIP3]), 51, 52, 0, 156, 0);
            string Tib_LFilename = searchFiles[TIB_L].Replace(".group.xml", PreferedExtAbWiff);
            string Tip3Filename  = searchFiles[TIP3].Replace(".group.xml", PreferedExtAbWiff);

            // Select the first transition group.
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedPath =
                    SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                SkylineWindow.GraphSpectrumSettings.ShowAIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowBIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowYIons        = true;
                SkylineWindow.GraphSpectrumSettings.ShowPrecursorIon = true;
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
            });
            RunDlg <SpectrumChartPropertyDlg>(SkylineWindow.ShowSpectrumProperties, dlg =>
            {
                dlg.FontSize = GraphFontSize.NORMAL;
                dlg.OkDialog();
            });
            RunDlg <ChromChartPropertyDlg>(SkylineWindow.ShowChromatogramProperties, dlg =>
            {
                dlg.FontSize = GraphFontSize.NORMAL;
                dlg.OkDialog();
            });
            const int skylineWindowWidth  = 1160;
            const int skylineWindowHeight = 792;

            RunUI(() =>
            {
                // Make window screenshot size
                if (IsPauseForScreenShots && SkylineWindow.WindowState != FormWindowState.Maximized)
                {
                    SkylineWindow.Width  = skylineWindowWidth;
                    SkylineWindow.Height = skylineWindowHeight;
                }
            });
            RestoreViewOnScreen(13);
            PauseForScreenShot("Main window with imported data", 16);

//            RunUIWithDocumentWait(() =>
//            {
//                SkylineWindow.ToggleIntegrateAll(); // TODO: No longer necessary.  Change in tutorial
//            });
            RunUI(() =>
            {
                SkylineWindow.ShowGraphPeakArea(true);
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.NONE);
                Settings.Default.ShowDotProductPeakArea = true;
                Settings.Default.ShowLibraryPeakArea    = true;
            });
            RunUI(() =>
            {
                SkylineWindow.Width    = 500;
                var peakAreas          = SkylineWindow.GraphPeakArea;
                var peakAreasFloating  = peakAreas.Parent.Parent;
                peakAreasFloating.Left = SkylineWindow.Right + 20;
                peakAreasFloating.Top  = SkylineWindow.Top;
                peakAreasFloating.Size = new Size(504, 643);
            });

            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas view (show context menu)", 18);

            RunUI(() => SkylineWindow.Width = skylineWindowWidth);
            RestoreViewOnScreen(15);
            RunUI(() =>
            {
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.ShowChromatogramLegends(false);
            });
            PauseForScreenShot("Main window layout", 19);

            int atest = 0;

            CheckAnnotations(TIB_L, 0, atest++);
            int pepIndex = 3;

            RunUI(() => SkylineWindow.CollapsePeptides());
            RunUI(() => SkylineWindow.ShowAlignedPeptideIDTimes(true));
            ChangePeakBounds(TIB_L, pepIndex, 38.79, 39.385);
            PauseForScreenShot("Chromatogram graphs clipped from main window", 21);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            var       alignmentForm            = ShowDialog <AlignmentForm>(() => SkylineWindow.ShowRetentionTimeAlignmentForm());
            const int skylineWindowNarrowWidth = 788;

            RunUI(() =>
            {
                SkylineWindow.Width  = skylineWindowNarrowWidth;
                alignmentForm.Width  = 660;
                alignmentForm.Height = 561;
                alignmentForm.Left   = SkylineWindow.Right + 20;
                alignmentForm.Splitter.SplitterDistance       = 75;
                alignmentForm.ComboAlignAgainst.SelectedIndex = 0;     // to match what's in the tutorial doc
            });
            PauseForScreenShot <AlignmentForm>("Retention time alignment form", 22);

            OkDialog(alignmentForm, alignmentForm.Close);
            PauseForScreenShot("Status bar clipped from main window - 4/51 pep 4/52 prec 10/156 tran", 23);

            const string TIP_NAME = "5b_MCF7_TiTip3";

            if (IsCoverShotMode)
            {
                RestoreCoverViewOnScreen();
                ClickChromatogram(TIP_NAME, 34.5, 366);
                TreeNode selectedNode = null;
                RunUI(() => selectedNode = SkylineWindow.SequenceTree.SelectedNode);
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0]);
                WaitForGraphs();
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = selectedNode);
                TakeCoverShot();
                return;
            }

            pepIndex = JumpToPeptide("SSKASLGSLEGEAEAEASSPK");
            RunUI(() => SkylineWindow.ShowChromatogramLegends(true));
            Assert.IsTrue(8 == pepIndex);
            PauseForScreenShot("Chromatogram graph metafiles for 9th peptide", 24);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            ZoomSingle(TIP3, 31.8, 42.2, 280); // simulate the wheel scroll described in tutorial
            PauseForScreenShot("Chromatogram graph metafile showing all peaks for 1_MCF_TiB_L", 24);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            // current TIB_L peak should have idotp .87 and ppm -6.9
            Assert.AreEqual(0.87, GetTransitionGroupChromInfo(TIB_L, pepIndex).IsotopeDotProduct ?? -1, .005);
            Assert.AreEqual(-10.8, GetTransitionChromInfo(TIB_L, pepIndex, 0).MassError ?? -1, .05);

            ChangePeakBounds(TIB_L, pepIndex, 36.5, 38.0);

            // now current TIB_L peak should have idotp .9 and ppm -6.5
            Assert.AreEqual(0.9, GetTransitionGroupChromInfo(TIB_L, pepIndex).IsotopeDotProduct ?? -1, .005);
            Assert.AreEqual(-9.4, GetTransitionChromInfo(TIB_L, pepIndex, 0).MassError ?? -1, .05);
            CheckAnnotations(TIB_L, pepIndex, atest++);

            var undoIndex = SkylineWindow.Document.RevisionIndex; // preserve for simulating ctrl-z

            RunUI(() => SkylineWindow.Width = skylineWindowWidth);
            PickPeakBoth(pepIndex, 40.471035, 40.8134); // select peak for both chromatograms at these respective retention times
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 25);

            int[] m1Thru4 = { 1, 2, 3, 4, 5 };
            PickTransitions(pepIndex, m1Thru4, "Transition pick list filtered", 26, "Transition pick list unfiltered", 26); // turn on chromatograms
            PickPeakBoth(pepIndex, 36.992836, 37.3896027);                                                                  // select peak for both chromatograms at these respective retention times
            ZoomSingle(TIP3, 32.4, 42.2, 520);                                                                              // set the view for screenshot
            RunUI(() =>
            {
                SkylineWindow.Height = 550;
                SkylineWindow.ArrangeGraphsTabbed();
            });
            ActivateReplicate(TIP_NAME);
            PauseForScreenShot("Chromatogram graph metafile comparing 33 and 37 minute peaks", 27);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            RevertDoc(undoIndex); // undo changes

            ActivateReplicate(TIP_NAME);
            ClickChromatogram(TIP_NAME, 37.3, 142);
            PauseForScreenShot("MS1 spectrum graph 37.32 minutes", 28);
            ClickChromatogram(TIP_NAME, 33.2, 328.1);
            PauseForScreenShot("MS1 spectrum graph 33.19 minutes", 29);
            RunUI(() => SkylineWindow.HideFullScanGraph());

            RunUI(() =>
            {
                SkylineWindow.Width  = skylineWindowNarrowWidth;
                SkylineWindow.Height = skylineWindowHeight;
                SkylineWindow.ArrangeGraphs(DisplayGraphsType.Column);
            });
            pepIndex = JumpToPeptide("ASLGSLEGEAEAEASSPKGK"); // Not L10N
            Assert.IsTrue(10 == pepIndex);
            PauseForScreenShot("Chromatogram graph meta files for peptide ASLGSLEGEAEAEASSPKGK", 30);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            PickTransitions(pepIndex, m1Thru4);  // turn on M+3 and M+4
            ChangePeakBounds(TIP3, pepIndex, 37.35, 38.08);
            ZoomSingle(TIP3, 36.65, 39.11, 300); // simulate the wheel scroll described in tutorial
            PauseForScreenShot("upper - Chromatogram graph metafile for peptide ASLGSLEGEAEAEASSPKGK with adjusted integration", 31);
            CheckAnnotations(TIP3, pepIndex, atest++);

            RevertDoc(undoIndex);                              // undo changes
            pepIndex = JumpToPeptide("AEGEWEDQEALDYFSDKESGK"); // Not L10N
            PauseForScreenShot("lower - Chromatogram graph metafiles for peptide AEGEWEDQEALDYFSDKESGK", 31);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            int[] m1Thru5 = { 1, 2, 3, 4, 5, 6 };
            PickTransitions(pepIndex, m1Thru5); // turn on M+3 M+4 and M+5
            PauseForScreenShot("Chromatogram graph metafiles with M+3, M+4 and M+5 added", 32);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            JumpToPeptide("ALVEFESNPEETREPGSPPSVQR"); // Not L10N
            PauseForScreenShot("Chromatogram graph metafiles for peptide ALVEFESNPEETREPGSPPSVQR", 33);

            pepIndex = JumpToPeptide("YGPADVEDTTGSGATDSKDDDDIDLFGSDDEEESEEAKR"); // Not L10N
            if (IsPauseForScreenShots)
            {
                RestoreViewOnScreen(34);
                PauseForScreenShot("upper - Peak Areas graph metafile for peptide YGPADVEDTTGSGATDSKDDDDIDLFGSDDEEESEEAKR", 34);
            }

            int[] m1Thru7 = { 1, 2, 3, 4, 5, 6, 7, 8 };
            PickTransitions(pepIndex, m1Thru7); // enable [M+3] [M+4] [M+5] [M+6] [M+7]
            PauseForScreenShot("lower - Peak Areas graph metafile with M+3 through M+7 added", 34);
            CheckAnnotations(TIB_L, pepIndex, atest++);
            CheckAnnotations(TIP3, pepIndex, atest++);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));

            // page 36 zooming setup
            RunUI(() =>
            {
                SkylineWindow.SynchronizeZooming(true);
                SkylineWindow.LockYChrom(false);
                SkylineWindow.AlignToFile = GetGraphChromatogram(TIP3).GetChromFileInfoId(); // align to Tip3
            });
            ZoomBoth(36.5, 39.5, 1600);                                                      // simulate the wheel scroll described in tutorial
            RunUI(() =>
            {
                SkylineWindow.ShowChromatogramLegends(false);
                SkylineWindow.Width  = skylineWindowWidth;
                SkylineWindow.Height = 720;
            });
            PauseForScreenShot("Chromatogram graphs clipped from main window with synchronized zooming", 35);

            ClickChromatogram(TIP_NAME, 37.5, 1107.3);
            PauseForScreenShot("MS1 spectrum graph 37.50 minutes", 36);
            RunUI(() => SkylineWindow.HideFullScanGraph());

            RunUI(() =>
            {
                SkylineWindow.ShowChromatogramLegends(true);
                SkylineWindow.Width  = skylineWindowNarrowWidth;
                SkylineWindow.Height = skylineWindowHeight;
            });
            RestoreViewOnScreen(36);                                                                                                      // float the Library Match window
            RunUI(() => SkylineWindow.GraphSpectrum.SelectSpectrum(new SpectrumIdentifier(MsDataFileUri.Parse(Tip3Filename), 37.6076f))); // set the Library Match view
            PauseForScreenShot <GraphSpectrum>("Library Match graph metafile - 5b_MCF7_TiTip3 (37.61 Min)", 37);

            RunUI(() => SkylineWindow.GraphSpectrum.SelectSpectrum(new SpectrumIdentifier(MsDataFileUri.Parse(Tib_LFilename), 37.0335f))); // set the Library Match view
            PauseForScreenShot <GraphSpectrum>("Library Match graph metafile - 1_MCF_TiB_L (37.03 min)", 37);

            RestoreViewOnScreen(37);                       // back to normal view
            /* pepIndex = */ JumpToPeptide("DQVANSAFVER"); // Not L10N
            PauseForScreenShot("Chromatogram graph metafiles for peptide DQVANSAFVER", 38);

//            int[] m1 = {2};
//            PickTransitions(pepIndex, m1); // enable [M+1] only
//            // Measured times in TIB_L are different from displayed times, because of alignment
//            ChangePeakBounds(TIB_L, pepIndex, 23.99, 25.29);
//            ChangePeakBounds(TIP3, pepIndex, 23.81, 25.21);
//            // First transition selected for screenshot
//            RunUI(() =>
//            {
//                var pathPep = SkylineWindow.SelectedPath;
//                var nodePep = ((PeptideTreeNode)SkylineWindow.SelectedNode).DocNode;
//                var nodeGroup = nodePep.TransitionGroups.First();
//                var nodeTran = nodeGroup.Transitions.First();
//                SkylineWindow.SelectedPath = new IdentityPath(
//                    new IdentityPath(pathPep, nodeGroup.TransitionGroup), nodeTran.Transition);
//            });
//            PauseForScreenShot("page 36 - M+1 only, with adjusted integration");
//            CheckAnnotations(TIB_L, pepIndex, atest++);
//            CheckAnnotations(TIP3, pepIndex, EXPECTED_ANNOTATIONS[atest]);

            var docAfter = WaitForProteinMetadataBackgroundLoaderCompletedUI();

            // Minimizing a chromatogram cache file.
            RunUI(SkylineWindow.CollapsePeptides);
            for (int i = 0; i < 5; i++) // just do the first 5
            {
                int iPeptide = i;
                var path     = docAfter.GetPathTo((int)SrmDocument.Level.Molecules, iPeptide);
                RunUI(() =>
                {
                    SkylineWindow.SelectedPath = path;
                });
                WaitForGraphs();
            }

            // Eliminate extraneous chromatogram data.
            doc = WaitForProteinMetadataBackgroundLoaderCompletedUI();
            var minimizedFile = GetTestPath("Ms1FilteringTutorial-2min.sky"); // Not L10N
            var cacheFile     = Path.ChangeExtension(minimizedFile, ChromatogramCache.EXT);

            {
                // TODO: Figure out why the minimize fails to unlock the .skyd file, if not minimized to current file
                RunUI(() => SkylineWindow.SaveDocument(minimizedFile));

                var manageResultsDlg   = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);
                var minimizeResultsDlg = ShowDialog <MinimizeResultsDlg>(manageResultsDlg.MinimizeResults);
                RunUI(() =>
                {
                    minimizeResultsDlg.LimitNoiseTime = true;
                    minimizeResultsDlg.NoiseTimeRange = 2;                                                        // Not L10N
                });
                PauseForScreenShot <MinimizeResultsDlg>("Minimize Results form (percentages vary slightly)", 39); // old p. 23

                OkDialog(minimizeResultsDlg, () => minimizeResultsDlg.MinimizeToFile(minimizedFile));
                WaitForCondition(() => File.Exists(cacheFile));
                WaitForClosedForm(manageResultsDlg);
            }
            WaitForDocumentChange(doc);

            // Inclusion list method export for MS1 filtering
            doc = SkylineWindow.Document;
            RunDlg <PeptideSettingsUI>(() => SkylineWindow.ShowPeptideSettingsUI(PeptideSettingsUI.TABS.Prediction), dlg =>
            {
                dlg.IsUseMeasuredRT = true;
                dlg.TimeWindow      = 10;
                dlg.OkDialog();
            });
            doc = WaitForDocumentChangeLoaded(doc);

            // Now deviating from the tutorial script for a moment to make sure we can choose a Scheduled export method.
            // CONSIDER: This refinement seems to be a no-op. Not sure why it is here.
            RunDlg <RefineDlg>(SkylineWindow.ShowRefineDlg, dlg =>
            {
                dlg.MinPeptides = 1;                                // This would get rid of proteins with no peptides (none exist)
                const double minPeakFoundRatio = 0.1;
                dlg.MinPeakFoundRatio          = minPeakFoundRatio; // This would get rid of undetected transitions (none exist)
                dlg.OkDialog();                                     // Will not change the document or add an Undo entry
            });
            // Nothing should have changed on the UI thread
            RunUI(() => Assert.AreSame(doc, SkylineWindow.DocumentUI));

            // Ready to export, although we will just cancel out of the dialog.
            var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.Method));

            RunUI(() =>
            {
                exportMethodDlg.InstrumentType = ExportInstrumentType.ABI_TOF; // Not L10N
                exportMethodDlg.MethodType     = ExportMethodType.Scheduled;
                exportMethodDlg.CancelButton.PerformClick();
            });
            WaitForClosedForm(exportMethodDlg);

            // Because this was showing up in the nightly test failures
            WaitForConditionUI(() => exportMethodDlg.IsDisposed);

            RunUI(() => SkylineWindow.SaveDocument());
            RunUI(SkylineWindow.NewDocument);
        }
예제 #14
0
        private void LowResTest()
        {
            string documentFile = GetTestPath(@"Low Res\BSA_Protea_label_free_meth3.sky");

            WaitForCondition(() => File.Exists(documentFile));
            RunUI(() => SkylineWindow.OpenFile(documentFile));
            bool AsSmallMolecules = AsSmallMoleculesTestMode != RefinementSettings.ConvertToSmallMoleculesMode.none;

            const int expectedMoleculeCount        = 9;
            int       expectedTransitionGroupCount = 10;
            int       expectedTransitionCount      = 78;
            var       document = SkylineWindow.Document;

            if (AsSmallMolecules)
            {
                ConvertDocumentToSmallMolecules(AsSmallMoleculesTestMode);
                document = SkylineWindow.Document;
                Assert.AreEqual(document.PeptideTransitionGroupCount, 0);
                Assert.AreEqual(document.MoleculeTransitionGroupCount, expectedTransitionGroupCount);
                Assert.AreEqual(document.PeptideTransitionCount, 0);
                Assert.AreEqual(document.MoleculeTransitionCount, expectedTransitionCount);
            }
            AssertEx.IsDocumentState(document, null, 3, expectedMoleculeCount, expectedTransitionGroupCount, expectedTransitionCount);

            // p. 3 Select first peptide
            RunUI(() => SkylineWindow.SelectedPath = document.GetPathTo((int)SrmDocument.Level.Molecules, 0));
            PauseForScreenShot("Main window", 3);

            // p. 4 Configure Document for Thermo raw files
            {
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() => transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.FullScan);
                PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Peptide Settings - Full-Scan tab blank", 5);

                RunUI(() =>
                {
                    transitionSettingsUI.PrecursorIsotopesCurrent = FullScanPrecursorIsotopes.Count;
                    transitionSettingsUI.PrecursorMassAnalyzer    = FullScanMassAnalyzerType.qit;
                    transitionSettingsUI.AcquisitionMethod        = FullScanAcquisitionMethod.Targeted;
                });
                PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Peptide Settings - Full-Scan tab low res", 6);

                RunUI(() =>
                {
                    transitionSettingsUI.SetRetentionTimeFilter(RetentionTimeFilterType.ms2_ids, 2);

                    // p.6 - library ion match tolerance same as extraction window
                    transitionSettingsUI.SelectedTab       = TransitionSettingsUI.TABS.Library;
                    transitionSettingsUI.IonMatchTolerance = 0.7;
                });
                PauseForScreenShot <TransitionSettingsUI.LibraryTab>("Transition Settings - Library tab match tolerance same as MS/MS resolution", 8);

                RunUI(() =>
                {
                    // p.6
                    transitionSettingsUI.SelectedTab    = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.FragmentTypes += ", p";
                });
                PauseForScreenShot <TransitionSettingsUI.FilterTab>("Transition Settings - Filter tab", 9);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);

                var docFullScan          = WaitForDocumentChange(document);
                var tranSettingsFullScan = docFullScan.Settings.TransitionSettings;
                Assert.AreEqual(FullScanPrecursorIsotopes.Count, tranSettingsFullScan.FullScan.PrecursorIsotopes);
                Assert.AreEqual(FullScanMassAnalyzerType.qit, tranSettingsFullScan.FullScan.PrecursorMassAnalyzer);
                Assert.AreEqual(FullScanAcquisitionMethod.Targeted, tranSettingsFullScan.FullScan.AcquisitionMethod);
                Assert.IsTrue(ArrayUtil.EqualsDeep(new[] { IonType.y, IonType.b, IonType.precursor },
                                                   tranSettingsFullScan.Filter.IonTypes));
            }

            RunUI(() => SkylineWindow.ExpandPrecursors());

            // Check all the precursors on picklists
            bool pausedForScreenShot = false;

            foreach (PeptideGroupTreeNode node in SkylineWindow.SequenceTree.GetSequenceNodes())
            {
                foreach (TreeNode child in node.Nodes)
                {
                    foreach (SrmTreeNodeParent grandChild in child.Nodes)
                    {
                        // Because of RunUI must copy to local variable first.
                        SrmTreeNodeParent child1 = grandChild;
                        RunUI(() => SkylineWindow.SequenceTree.SelectedNode = child1);
                        var picklist = ShowDialog <PopupPickList>(() => SkylineWindow.SequenceTree.ShowPickList(false));
                        RunUI(() =>
                        {
                            picklist.SetItemChecked(0, true);
                            Assert.IsTrue(picklist.GetItemLabel(0).Contains(IonType.precursor.GetLocalizedString()));
                            Assert.IsTrue(picklist.GetItemChecked(0));
                        });
                        if (!pausedForScreenShot)
                        {
                            PauseForScreenShot <PopupPickList>("Transitions popup pick-list", 10);
                            pausedForScreenShot = true;
                        }
                        OkDialog(picklist, picklist.OnOk);
                    }
                }
            }
            WaitForDocumentLoaded();
            if (!AsSmallMolecules)  // No libraries for small molecules, yet
            {
                foreach (var nodeGroup in SkylineWindow.Document.MoleculeTransitionGroups)
                {
                    Assert.IsFalse(nodeGroup.HasLibInfo && nodeGroup.Transitions.All(nodeTran => !nodeTran.HasLibInfo));
                }
            }
            // All transition groups should now have a precursor transition
            foreach (var nodeGroup in SkylineWindow.Document.MoleculeTransitionGroups)
            {
                Assert.AreEqual(IonType.precursor, nodeGroup.Transitions.First().Transition.IonType);
            }

            // p.8
            ExportMethodDlg exportMethodDlg =
                ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.Method));

            RunUI(() =>
            {
                exportMethodDlg.SetInstrument("Thermo LTQ");
                Assert.AreEqual("Thermo LTQ", exportMethodDlg.InstrumentType);
                exportMethodDlg.SetMethodType(ExportMethodType.Standard);
                exportMethodDlg.SetTemplateFile(GetTestPath(@"Low Res\TargetedMSMS_template.meth"));
            });
            PauseForScreenShot <ExportMethodDlg.MethodView>("Export Method form", 11);

            // p. 10 Ok the error box.
            {
                var messageDlg = ShowDialog <MessageDlg>(() => exportMethodDlg.OkDialog(GetTestPath(@"Low Res\TargetedMSMS_BSA_Protea.meth")));
                PauseForScreenShot <MessageDlg>("Error message (expected)", 12);

                OkDialog(messageDlg, messageDlg.OkDialog);
            }

            // Making a report by hand p.11
            ExportLiveReportDlg exportReportDlg = ShowDialog <ExportLiveReportDlg>(() => SkylineWindow.ShowExportReportDialog());
            var editReportListDlg = ShowDialog <ManageViewsForm>(exportReportDlg.EditList);
            var viewEditor        = ShowDialog <ViewEditor>(editReportListDlg.AddView);

            RunUI(() =>
            {
                Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Parse("Proteins!*.Name")));
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
                Assert.AreEqual(1, viewEditor.ChooseColumnsTab.ColumnCount);
                var columnsToAdd = new[]
                {
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.ModifiedSequence"),
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Charge"),
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Mz"),
                };
                foreach (var id in columnsToAdd)
                {
                    Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(id), "Unable to select {0}", id);
                    viewEditor.ChooseColumnsTab.AddSelectedColumn();
                }
                Assert.AreEqual(4, viewEditor.ChooseColumnsTab.ColumnCount);
            });
            PauseForScreenShot <ViewEditor>("Edit Report form", 13);

            {
                var previewReportDlg = ShowDialog <DocumentGridForm>(viewEditor.ShowPreview);
                var expectedRows     = 10 + (TestSmallMolecules ? 1 : 0);
                WaitForConditionUI(() => previewReportDlg.IsComplete && previewReportDlg.RowCount == expectedRows);
                RunUI(() =>
                {
                    Assert.AreEqual(4, previewReportDlg.ColumnCount);
                    var precursors =
                        SkylineWindow.Document.MoleculeTransitionGroups.ToArray();
                    const int precursorIndex = 3;
                    for (int i = 0; i < expectedRows; i++)
                    {
                        Assert.AreEqual(precursors[i].PrecursorMz, double.Parse(previewReportDlg.DataGridView.Rows[i].Cells[precursorIndex].Value.ToString()), 0.000001);
                    }
                    var precursorMzCol = previewReportDlg.DataGridView.Columns[precursorIndex];
                    Assert.IsNotNull(precursorMzCol);
                    previewReportDlg.DataGridView.Sort(precursorMzCol, ListSortDirection.Ascending);
                });
                PauseForScreenShot <DocumentGridForm>("Preview New Report window", 14);

                OkDialog(previewReportDlg, previewReportDlg.Close);
            }

            // Press the Esc key until all forms have been dismissed.
            RunUI(() =>
            {
                viewEditor.Close();
                editReportListDlg.Close();
                exportReportDlg.CancelClick();
            });
            WaitForClosedForm(viewEditor);
            WaitForClosedForm(editReportListDlg);
            WaitForClosedForm(exportReportDlg);

            //p. 12 Import Full-Scan Data
            // Launch import peptide search wizard
            var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg);

            RunUI(() => importPeptideSearchDlg.BuildPepSearchLibControl.WorkflowType = ImportPeptideSearchDlg.Workflow.prm);

            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search Build Spectral Library blank page", 15);

            const int    prefixLen             = 35;
            const string lowResDir             = "Low Res";
            const string searchDir             = "search";
            const string lowRes20Base          = "klc_20100329v_Protea_Peptide_Curve_20fmol_uL_tech1";
            string       lowRes20File          = GetTestPath(Path.Combine(lowResDir, lowRes20Base + ExtThermoRaw));
            string       lowRes20FileRaw       = Path.ChangeExtension(lowRes20File, ExtThermoRaw);
            string       lowRes20Search        = GetTestPath(Path.Combine(lowResDir, Path.Combine(searchDir, lowRes20Base + BiblioSpecLiteBuilder.EXT_PERCOLATOR)));
            string       shortLowRes20FileName = (Path.GetFileNameWithoutExtension(lowRes20File) ?? "").Substring(prefixLen);
            const string lowRes80Base          = "klc_20100329v_Protea_Peptide_Curve_80fmol_uL_tech1";
            string       lowRes80File          = GetTestPath(Path.Combine(lowResDir, lowRes80Base + ExtThermoRaw));
            string       lowRes80Search        = GetTestPath(Path.Combine(lowResDir, Path.Combine(searchDir, lowRes80Base + BiblioSpecLiteBuilder.EXT_PERCOLATOR)));
            string       shortLowRes80FileName = (Path.GetFileNameWithoutExtension(lowRes80File) ?? "").Substring(prefixLen);

            string[] searchFiles = { lowRes20Search, lowRes80Search };
            var      doc         = SkylineWindow.Document;

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage ==
                              ImportPeptideSearchDlg.Pages.spectra_page);
                importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(searchFiles);
                importPeptideSearchDlg.BuildPepSearchLibControl.CutOffScore = 0.99;
                importPeptideSearchDlg.BuildPepSearchLibControl.FilterForDocumentPeptides = true;
            });
            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search Build Spectral Library with files page", 16);

            RunDlg <MessageDlg>(importPeptideSearchDlg.ClickNextButtonNoCheck, dlg => dlg.OkDialog());
            doc = WaitForDocumentChangeLoaded(doc);

            // Verify document library was built
            string docLibPath          = BiblioSpecLiteSpec.GetLibraryFileName(documentFile);
            string redundantDocLibPath = BiblioSpecLiteSpec.GetRedundantName(docLibPath);

            Assert.IsTrue(File.Exists(docLibPath) && File.Exists(redundantDocLibPath));
            var librarySettings = SkylineWindow.Document.Settings.PeptideSettings.Libraries;

            Assert.IsTrue(librarySettings.HasDocumentLibrary);

            PauseForScreenShot <ImportPeptideSearchDlg.ChromatogramsPage>("Import Peptide Search Extract Chromatograms page", 17);

            // We're on the "Extract Chromatograms" page of the wizard.
            // All the test results files are in the same directory as the
            // document file, so all the files should be found, and we should
            // just be able to move to the next page.
            TryWaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page);
            var correctPage = false;

            ImportPeptideSearchDlg.Pages currentPage = 0;
            RunUI(() => correctPage = ImportPeptideSearchDlg.Pages.chromatograms_page == (currentPage = importPeptideSearchDlg.CurrentPage));
            if (!correctPage)
            {
                WaitForConditionUI(1, // Immediate timeout - just want the richer error message that WaitForConditionUI provides
                                   () => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page,
                                   string.Format("Expected to be on chromatograms_page, on {0} instead", currentPage));
            }
            var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(() => importPeptideSearchDlg.ClickNextButton());

            OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);

            // Modifications are already set up, so that page should get skipped.

            // We're on the "Configure Transition Settings" page of the wizard.
            // We've already set up these settings, so just click next.
            WaitForConditionUI(() => importPeptideSearchDlg.IsNextButtonEnabled);
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.transition_settings_page);
                Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
            });

            // We're on the "Configure Full-Scan Settings" page of the wizard.
            // We've already set up these settings, so just click next.
            WaitForConditionUI(() => importPeptideSearchDlg.IsNextButtonEnabled);
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page);
                Assert.IsTrue(importPeptideSearchDlg.ClickNextButton());
            });
            doc = WaitForDocumentChange(doc);

            // Add FASTA also skipped because filter for document peptides was chosen.

            WaitForClosedForm(importPeptideSearchDlg);
            PauseForScreenShot <AllChromatogramsGraph>("Loading chromatograms window", 18);
            WaitForDocumentChangeLoaded(doc, 15 * 60 * 1000); // 15 minutes
            WaitForClosedAllChromatogramsGraph();

            expectedTransitionGroupCount = 10; // Expect this many with results
            expectedTransitionCount      = 87; // Expect this many with results
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, shortLowRes20FileName, expectedMoleculeCount, expectedTransitionGroupCount, 0, expectedTransitionCount, 0);
            AssertResult.IsDocumentResultsState(SkylineWindow.Document, shortLowRes80FileName, expectedMoleculeCount, expectedTransitionGroupCount, 0, expectedTransitionCount, 0);

            RunUI(() =>
            {
                Assert.IsTrue(SkylineWindow.IsGraphSpectrumVisible);
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.CollapsePrecursors();
                SkylineWindow.Width = 1070;
            });

            // Select the first precursor.
            if (AsSmallMoleculesTestMode != RefinementSettings.ConvertToSmallMoleculesMode.masses_only)
            {
                FindNode(AsSmallMolecules ? "LVNELTEFAK" : "K.LVNELTEFAK.T [65, 74]");
            }
            else
            {
                FindNode(document.MoleculeTransitionGroups.First().CustomIon.DisplayName);
            }
            // Ensure Graphs look like p17. (checked)
            WaitForGraphs();
            RestoreViewOnScreen(18);
            PauseForScreenShot("Main window with data imported", 19);

            const double minDotp = 0.9;

            foreach (var nodeGroup in SkylineWindow.Document.PeptideTransitionGroups)
            {
                double dotp = nodeGroup.Results[0][0].LibraryDotProduct ?? 0;
                Assert.IsTrue(Math.Round(dotp, 2) >= minDotp, string.Format("Library dot-product {0} found below {1}", dotp, minDotp));
            }

            RunUI(() => SkylineWindow.AutoZoomBestPeak());
            // Ensure Graphs look like p18. (checked)
            WaitForGraphs();
            PauseForScreenShot("Chromatogram graphs clipped from main window with zoomed peaks", 20);

            RestoreViewOnScreen(21);
            RunUI(() => SkylineWindow.GraphSpectrum.SelectSpectrum(new SpectrumIdentifier(lowRes20FileRaw, 77.7722)));
            PauseForScreenShot <GraphSpectrum>("Library Match view clipped from main window with noisy spectrum", 21);

            RunUI(() =>
            {
                SkylineWindow.ShowGraphSpectrum(false);
                Assert.IsFalse(SkylineWindow.IsGraphSpectrumVisible);
                SkylineWindow.ShowPeptideIDTimes(false);
            });

            RunUI(() =>
            {
                var chromGraphs = SkylineWindow.GraphChromatograms.ToArray();
                Assert.AreEqual(2, chromGraphs.Length);
                Assert.AreEqual(46.8, chromGraphs[0].GraphItems.First().BestPeakTime, 0.05);
                Assert.AreEqual(46.8, chromGraphs[1].GraphItems.First().BestPeakTime, 0.05);

                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.ShowProductTransitions();
            });
            WaitForCondition(() => !SkylineWindow.GraphPeakArea.IsHidden);
            if (!AsSmallMolecules)  // No libraries (yet?)
            {
                WaitForDotProducts();
            }
            RunUI(() =>
            {
                // Graph p.15
                Assert.AreEqual(AsSmallMolecules ? 2 : 3, SkylineWindow.GraphPeakArea.Categories.Count());
                Assert.AreEqual(6, SkylineWindow.GraphPeakArea.CurveCount);
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Replicate Comparison graph metafile", 22);
            if (!AsSmallMolecules)  // No libraries (yet?)
            {
                VerifyDotProducts(0.99, 0.98);
            }

            // Check graph p15. (checked)
            RunUI(() =>
            {
                SkylineWindow.ShowAllTransitions();
                SkylineWindow.ShowSplitChromatogramGraph(true);
            });

            // p. 16 screenshot of full 5-point dilution curve

            // Select precursor
            if (AsSmallMoleculesTestMode != RefinementSettings.ConvertToSmallMoleculesMode.masses_only)
            {
                FindNode(AsSmallMolecules ? "DRVYIHPF" : "R.DRVYIHPF.- [34, 41]");  // May be localized " (missed 1)"
            }
            else
            {
                FindNode(Resources.CustomIon_DisplayName_Ion + " [1047");
            }
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Replicate Comparison graph metafile with split graphs", 24);
            RunUI(() =>
            {
                SkylineWindow.Size = new Size(990, 620);
                SkylineWindow.ShowGraphPeakArea(false);
            });
            PauseForScreenShot("Chromatogram graphs clipped from main window with split graphs", 25);

            // PeakAreaGraph Normalize to total p.20.
            RunUI(() =>
            {
                SkylineWindow.ShowGraphPeakArea(true);
                SkylineWindow.ShowProductTransitions();
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view);
            });

            // Ensure graph looks like p20.
            if (AsSmallMoleculesTestMode != RefinementSettings.ConvertToSmallMoleculesMode.masses_only)
            {
                FindNode(AsSmallMolecules ? "KNLQSLDPSH" : "R.IKNLQSLDPSH.- [80, 90]");
                FindNode(AsSmallMolecules ? "KNLQSLDPSH" : "R.IKNLQSLDPSH.- [80, 90]"); // Phosphorylated
            }
            else
            {
                FindNode(Resources.CustomIon_DisplayName_Ion + " [1333");
            }
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("figure 1a - Area Replicate graph metafile for IKNLQSLDPSH", 26);
            RunUI(() =>
            {
                Assert.AreEqual(AsSmallMolecules ? 2 : 3, SkylineWindow.GraphPeakArea.Categories.Count());
                Assert.AreEqual(9, SkylineWindow.GraphPeakArea.CurveCount);
            });

            if (AsSmallMoleculesTestMode != RefinementSettings.ConvertToSmallMoleculesMode.masses_only)
            {
                FindNode(AsSmallMolecules ? "HLVDEPQNLIK" : "K.HLVDEPQNLIK.Q [401, 411]");
            }
            else
            {
                FindNode(Resources.CustomIon_DisplayName_Ion + " [1306");
            }
            WaitForGraphs();
            PauseForScreenShot("figure 1b - Area replicate graph metafile for HLVDEPQNLIK", 26);
            RunUI(() =>
            {
                Assert.AreEqual(AsSmallMolecules ? 2 : 3, SkylineWindow.GraphPeakArea.Categories.Count());
                Assert.AreEqual(7, SkylineWindow.GraphPeakArea.CurveCount);
            });

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            WaitForCondition(() => SkylineWindow.GraphPeakArea.IsHidden);
            RunUI(() => SkylineWindow.SaveDocument());
        }
예제 #15
0
        protected override void DoTest()
        {
            // Check backward compatibility with 19.1.9.338 and 350 when combined IMS got written to MsDataFilePath
            string legacyFile_19_1_9 = TestFilesDirs[1].GetTestPath(@"BSA-Training.sky");

            RunUI(() => SkylineWindow.OpenFile(legacyFile_19_1_9));
            VerifyCombinedIonMobility(WaitForDocumentLoaded());
            RunUI(() =>
            {
                SkylineWindow.SaveDocument();
                SkylineWindow.NewDocument();
                SkylineWindow.OpenFile(legacyFile_19_1_9);
            });
            VerifyCombinedIonMobility(WaitForDocumentLoaded());
            var    oldDoc  = SkylineWindow.Document;
            string skyFile = TestFilesDirs[0].GetTestPath(@"IMSFiltering\BSA-Training.sky");

            RunUI(() => SkylineWindow.OpenFile(skyFile));

            var document = WaitForDocumentChangeLoaded(oldDoc, 240 * 1000); // 4 minutes

            RunUI(() => SkylineWindow.Size = new Size(880, 560));
            RestoreViewOnScreen(2);
            PauseForScreenShot("Document open - full window", 2);
            AssertEx.IsDocumentState(document, null, 1, 34, 38, 404);

            {
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(() =>
                                                                             SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.FullScan));

                PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Full-scan settings", 3);

                RunUI(() =>
                {
                    Assert.AreEqual(FullScanPrecursorIsotopes.Count, transitionSettingsUI.PrecursorIsotopesCurrent);
                    Assert.AreEqual(20 * 1000, transitionSettingsUI.PrecursorRes);
                    Assert.AreEqual(FullScanMassAnalyzerType.tof, transitionSettingsUI.PrecursorMassAnalyzer);
                    Assert.AreEqual(IsolationScheme.SpecialHandlingType.ALL_IONS, transitionSettingsUI.IsolationSchemeName);
                    Assert.AreEqual(20 * 1000, transitionSettingsUI.ProductRes);
                    Assert.AreEqual(FullScanMassAnalyzerType.tof, transitionSettingsUI.ProductMassAnalyzer);
                });

                OkDialog(transitionSettingsUI, transitionSettingsUI.CancelDialog);
            }

            {
                var importResults = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                RunUI(() => importResults.ImportSimultaneousIndex = 2);

                PauseForScreenShot <ImportResultsDlg>("Import results form", 4);

                // Importing raw data from a sample which is a mixture of yeast and BSA

                var openDataSourceDialog = ShowDialog <OpenDataSourceDialog>(importResults.OkDialog);

                RunUI(() =>
                {
                    openDataSourceDialog.CurrentDirectory = new MsDataFilePath(DataPath);
                    openDataSourceDialog.SelectAllFileType(".d");
                });
                PauseForScreenShot <OpenDataSourceDialog>("Import results files", 5);

                OkDialog(openDataSourceDialog, openDataSourceDialog.Open);
            }

            string yeastReplicateName = Path.GetFileNameWithoutExtension(Yeast_BSA);

            PauseForScreenShot <AllChromatogramsGraph>("Importing results form", 6);

            WaitForDocumentChangeLoaded(document, 1000 * 60 * 60 * 10); // 10 minutes

            // Arrange graphs tiled
            RunUI(() =>
            {
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ShowSplitChromatogramGraph(true);
            });
            FindNode("R.FKDLGEEHFK.G");

            RunUI(() => SkylineWindow.Size = new Size(1075, 799));
            RestoreViewOnScreen(7);
            PauseForScreenShot("Zoomed split graph panes only", 7);

            RunUI(() => SkylineWindow.AutoZoomNone());
            PauseForScreenShot("Unzoomed split graph panes only", 8);

            const int wideWidth = 1547;

            RunUI(() =>
            {
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.ShowGraphPeakArea(true);
                SkylineWindow.ShowChromatogramLegends(false);
                SkylineWindow.ShowPeakAreaLegend(false);
                SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.TOTAL);
                SkylineWindow.SynchronizeZooming(true);
                SkylineWindow.Size = new Size(wideWidth, 855);
            });
            RestoreViewOnScreen(9);
            PauseForScreenShot("Full window", 9);

            FindNode("TCVADESHAGCEK");
            var noteDlg = ShowDialog <EditNoteDlg>(SkylineWindow.EditNote);

            RunUI(() => noteDlg.NoteText = "Lost in yeast samples");

            PauseForScreenShot("Peptide note", 10);
            OkDialog(noteDlg, noteDlg.OkDialog);

            FindNode("NECFLSHKDDSPDLPK");
            RestoreViewOnScreen(11);
            const int narrowWidth = 1350;

            RunUI(() => SkylineWindow.Width = narrowWidth);
            PauseForScreenShot("Yeast chromatograms and RT only - prtsc-paste-edit", 11);
            PauseForScreenShot("Hover over BSA in water chromatogram - prtsc-paste-edit", 12);
            RunUI(() => SkylineWindow.Width = wideWidth);
            RestoreViewOnScreen(13);
            {
                const double clickTime1 = 41.06;
                ClickChromatogram(clickTime1, 1.62E+6, PaneKey.PRECURSORS);
                PauseForScreenShot("Full scan 2D MS1 graph", 13);
                var fullScanGraph = FindOpenForm <GraphFullScan>();
                RunUI(() => fullScanGraph.SetSpectrum(false));
                PauseForScreenShot("Full scan 3D MS1 graph", 13);
                ValidateClickTime(fullScanGraph, clickTime1);

                RunUI(() => fullScanGraph.SetZoom(false));
                PauseForScreenShot("Full scan unzoomed 3D MS1 graph", 14);

                const double clickTime2 = 41.02;
                RunUI(() => fullScanGraph.SetZoom(true));
                ClickChromatogram(clickTime2, 5.8E+4, PaneKey.PRODUCTS);
                PauseForScreenShot("Full scan 3D MS/MS graph", 15);
                ValidateClickTime(fullScanGraph, clickTime2);

                RunUI(() => fullScanGraph.SetZoom(false));
                PauseForScreenShot("Full scan unzoomed 3D MS/MS graph", 15);

                if (IsCoverShotMode)
                {
                    RunUI(() =>
                    {
                        Settings.Default.ChromatogramFontSize = 14;
                        Settings.Default.AreaFontSize         = 14;
                        SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                    });

                    RestoreCoverViewOnScreen();

                    ClickChromatogram(clickTime2, 5.8E+4, PaneKey.PRODUCTS);

                    var manageResultsDlg = ShowDialog <ManageResultsDlg>(SkylineWindow.ManageResults);
                    RenameReplicate(manageResultsDlg, 0, "BSA");
                    RenameReplicate(manageResultsDlg, 1, "Yeast_BSA");
                    OkDialog(manageResultsDlg, manageResultsDlg.OkDialog);

                    RunUI(SkylineWindow.FocusDocument);

                    TakeCoverShot();
                    return;
                }

                const double clickTime3 = 41.48;
                ClickChromatogram(yeastReplicateName, clickTime3, 3.14E+4, PaneKey.PRODUCTS);
                PauseForScreenShot("Interference full scan unzoomed 3D MS/MS graph", 16);
                ValidateClickTime(fullScanGraph, clickTime3);

                RunUI(SkylineWindow.HideFullScanGraph);
            }

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, dlg =>
            {
                dlg.SelectedChromatograms = SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Skip(1);
                dlg.RemoveReplicates();
                dlg.OkDialog();
            });
            RunUI(() => SkylineWindow.SaveDocument());

            {
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() =>
                {
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.IonMobility;
                    transitionSettingsUI.IonMobilityControl.WindowWidthType = IonMobilityWindowWidthCalculator
                                                                              .IonMobilityWindowWidthType.resolving_power;
                    transitionSettingsUI.IonMobilityControl.IonMobilityFilterResolvingPower = 50;
                });
                PauseForScreenShot("Setting ion mobility filter width calculation values", 17);


                var          editIonMobilityLibraryDlg = ShowDialog <EditIonMobilityLibraryDlg>(transitionSettingsUI.IonMobilityControl.AddIonMobilityLibrary);
                const string libraryName  = "BSA";
                var          databasePath = TestFilesDirs[1].GetTestPath(libraryName + IonMobilityDb.EXT);

                RunUI(() =>
                {
                    editIonMobilityLibraryDlg.LibraryName = libraryName;
                    editIonMobilityLibraryDlg.CreateDatabaseFile(databasePath); // Simulate user click on Create button
                    editIonMobilityLibraryDlg.SetOffsetHighEnergySpectraCheckbox(true);
                    editIonMobilityLibraryDlg.GetIonMobilitiesFromResults();
                });
                PauseForScreenShot("Edit ion mobility library form", 18);

                // Check that a new value was calculated for all precursors
                RunUI(() => Assert.AreEqual(SkylineWindow.Document.MoleculeTransitionGroupCount, editIonMobilityLibraryDlg.LibraryMobilitiesFlatCount));

                OkDialog(editIonMobilityLibraryDlg, () => editIonMobilityLibraryDlg.OkDialog());

                PauseForScreenShot <TransitionSettingsUI.IonMobilityTab>("Transition Settings - Ion Mobility", 19);

                RunUI(() =>
                {
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.FullScan;
                    transitionSettingsUI.SetRetentionTimeFilter(RetentionTimeFilterType.scheduling_windows, 3);
                });

                PauseForScreenShot("Transition Settings - Full-Scan", 20);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Prediction);
                PauseForScreenShot("Peptide Settings - Prediction", 21);
                RunUI(() =>
                {
                    Assert.IsTrue(peptideSettingsUI.IsUseMeasuredRT);
                    Assert.AreEqual(6, peptideSettingsUI.TimeWindow);
                });

                OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
            }

            using (new WaitDocumentChange(1, true, 1000 * 60 * 60 * 5))
            {
                var choosePredictionReplicates = ShowDialog <ChooseSchedulingReplicatesDlg>(SkylineWindow.ImportResults);
                PauseForScreenShot("Choose Replicates form", 22);

                RunUI(() => choosePredictionReplicates.SelectOrDeselectAll(true));
                var importResults = ShowDialog <ImportResultsDlg>(choosePredictionReplicates.OkDialog);
                RunDlg <OpenDataSourceDialog>(importResults.OkDialog, openDataSourceDialog =>
                {
                    openDataSourceDialog.CurrentDirectory = new MsDataFilePath(DataPath);
                    openDataSourceDialog.SelectAllFileType(Yeast_BSA);
                    openDataSourceDialog.Open();
                });
            }
            WaitForGraphs();

            // Test to ensure the filtering happened
            if (!IsPauseForScreenShots) // Don't bring up unexpected UI in a screenshot run
            {
                TestReports();
            }

            RestoreViewOnScreen(11);
            RunUI(() => SkylineWindow.Width = narrowWidth);
            PauseForScreenShot("Yeast chromatogram and RTs - prtsc-paste-edit", 23);
            RunUI(() => SkylineWindow.Width = wideWidth);
            RestoreViewOnScreen(13);
            {
                const double clickTime = 42.20;
                ClickChromatogram(yeastReplicateName, clickTime, 2.904E+4, PaneKey.PRODUCTS);
                var fullScanGraph = FindOpenForm <GraphFullScan>();
                RunUI(() => fullScanGraph.SetZoom(true));
                RunUI(() => fullScanGraph.Parent.Parent.Size = new Size(671, 332));
                PauseForScreenShot("Full-scan graph zoomed", 24);
                RunUI(() => Assert.IsTrue(fullScanGraph.TitleText.Contains(clickTime.ToString(CultureInfo.CurrentCulture))));
                RunUI(SkylineWindow.HideFullScanGraph);
            }

            FindNode("FKDLGEEHFK");

            RunUI(() =>
            {
                SkylineWindow.Size = new Size(1547, 689);
                SkylineWindow.ShowProductTransitions();
                SkylineWindow.ShowPeakAreaLegend(true);
            });
            RestoreViewOnScreen(25);
            PauseForScreenShot("Chromatograms and Peak Areas - prtsc-paste-edit", 25);

            var docFiltered = SkylineWindow.Document;

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageDlg =>
            {
                manageDlg.SelectedChromatograms = SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Take(1);
                manageDlg.ReimportResults();
                manageDlg.OkDialog();
            });

            WaitForDocumentChangeLoaded(docFiltered, 1000 * 60 * 60 * 5); // 5 minutes

            // TODO: Check peak ranks before and after

            AssertEx.IsFalse(IsRecordMode); // Make sure we turn this off before commit!
        }
예제 #16
0
        protected override void DoTest()
        {
            if (IsPauseForScreenShots)
            {
                RunUI(() => SkylineWindow.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));
            }
            else // old way of doing things
            {
                // Setting the UI mode, p 2
                var startPage = WaitForOpenForm <StartPage>();
                RunUI(() => startPage.SetUIMode(SrmDocument.DOCUMENT_TYPE.proteomic));
//                PauseForScreenShot<StartPage>("Start Window proteomic", 2);
                RunUI(() => startPage.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));
//                PauseForScreenShot<StartPage>("Start Window small molecule", 3);
                ShowSkyline(() => startPage.DoAction(skylineWindow => true));
            }

            // Inserting a Transition List, p. 3
            {
                var doc = SkylineWindow.Document;

                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);
                RunUI(() =>
                {
                    pasteDlg.IsMolecule = true;
                    pasteDlg.SetSmallMoleculeColumns(null);  // Default columns
                    pasteDlg.Height = 290;
                });
                PauseForScreenShot <PasteDlg>("Paste Dialog in molecule mode", 3);

                var columnsOrdered = new[]
                {
                    // Molecule List Name,Precursor Name,Precursor Formula,Precursor Charge,Precursor RT,Precursor CE,Product m/z,Product Charge, label type
                    SmallMoleculeTransitionListColumnHeaders.moleculeGroup,
                    SmallMoleculeTransitionListColumnHeaders.namePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.formulaPrecursor,
                    SmallMoleculeTransitionListColumnHeaders.adductPrecursor,
                    SmallMoleculeTransitionListColumnHeaders.chargePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.rtPrecursor,
                    SmallMoleculeTransitionListColumnHeaders.cePrecursor,
                    SmallMoleculeTransitionListColumnHeaders.mzProduct,
                    SmallMoleculeTransitionListColumnHeaders.chargeProduct,
                    SmallMoleculeTransitionListColumnHeaders.labelType
                }.ToList();
                if (_inferredLabels)
                {
                    columnsOrdered.Remove(SmallMoleculeTransitionListColumnHeaders.labelType);
                }
                RunUI(() => { pasteDlg.SetSmallMoleculeColumns(columnsOrdered); });
                WaitForConditionUI(() => pasteDlg.GetUsableColumnCount() == columnsOrdered.Count);
                PauseForScreenShot <PasteDlg>("Paste Dialog with selected and ordered columns - show columns checklist", 5);

                SetCsvFileClipboardText(GetTestPath("SMTutorial_TransitionList.csv"), true);
                RunUI(pasteDlg.PasteTransitions);
                RunUI(pasteDlg.ValidateCells);
                RunUI(() => pasteDlg.Height = 428);
                PauseForScreenShot <PasteDlg>("Paste Dialog with validated contents", 6);

                OkDialog(pasteDlg, pasteDlg.OkDialog);
                var docTargets = WaitForDocumentChange(doc);

                AssertEx.IsDocumentState(docTargets, null, 6, 12, 19, 21);
                Assert.IsFalse(docTargets.MoleculeTransitions.Any(t => t.Transition.IsPrecursor()));

                RunUI(() =>
                {
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                    SkylineWindow.Size = new Size(957, 654);
                });
                RestoreViewOnScreen(5);
                PauseForScreenShot <SkylineWindow>("Skyline with small molecule targets", 5);

                RunUI(() => SkylineWindow.SaveDocument(GetTestPath("Amino Acid Metabolism.sky")));

                using (new WaitDocumentChange(null, true))
                {
                    var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                    var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                                      importResultsDlg1.GetDataSourcePathsFile(null));
                    RunUI(() =>
                    {
                        openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath());
                        openDataSourceDialog1.SelectAllFileType(ExtWatersRaw);
                    });
                    PauseForScreenShot <ImportResultsDlg>("Import Results Files form", 6);
                    OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);

                    var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                    OkDialog(importResultsNameDlg, importResultsNameDlg.NoDialog);
                }

                SelectNode(SrmDocument.Level.MoleculeGroups, 0);

                PauseForScreenShot <SkylineWindow>("Skyline window multi-target graph", 8);

                var docResults = SkylineWindow.Document;

                var expectedTransCount = new Dictionary <string, int[]>
                {
                    // transition groups, heavy transition groups, tranistions, heavy transitions
                    { "ID15656_01_WAA263_3976_020415", new[] { 12, 7, 13, 8 } },
                    { "ID15658_01_WAA263_3976_020415", new[] { 12, 6, 13, 7 } },
                    { "ID15659_01_WAA263_3976_020415", new[] { 12, 7, 13, 8 } },
                    { "ID15661_01_WAA263_3976_020415", new[] { 12, 7, 13, 8 } },
                    { "ID15662_01_WAA263_3976_020415", new[] { 12, 7, 13, 8 } },
                    { "ID15663_01_WAA263_3976_020415", new[] { 11, 7, 12, 8 } },
                    { "ID15664_01_WAA263_3976_020415", new[] { 11, 6, 12, 7 } },
                    { "ID15739_01_WAA263_3976_020415", new[] { 10, 6, 10, 7 } },
                    { "ID15740_01_WAA263_3976_020415", new[] { 12, 6, 12, 7 } },
                    { "ID15740_02_WAA263_3976_020415", new[] { 11, 5, 11, 6 } },
                    { "ID15740_04_WAA263_3976_020415", new[] { 12, 6, 12, 7 } },
                    { "ID15741_01_WAA263_3976_020415", new[] { 12, 7, 13, 8 } },
                    { "ID15741_02_WAA263_3976_020415", new[] { 12, 6, 13, 7 } }
                };
                var msg = "";
                foreach (var chromatogramSet in docResults.Settings.MeasuredResults.Chromatograms)
                {
                    int[] transitions;
                    if (!expectedTransCount.TryGetValue(chromatogramSet.Name, out transitions))
                    {
                        transitions = new[] { 12, 7, 13, 8 }
                    }
                    ;                                       // Most have this value
                    try
                    {
                        AssertResult.IsDocumentResultsState(docResults, chromatogramSet.Name, 12, transitions[0], transitions[1], transitions[2], transitions[3]);
                    }
                    catch (Exception x)
                    {
                        msg = TextUtil.LineSeparate(msg, x.Message);
                    }
                }
                if (!string.IsNullOrEmpty(msg))
                {
                    Assert.IsTrue(string.IsNullOrEmpty(msg), msg);
                }
                RestoreViewOnScreen(9);
                PauseForScreenShot <SkylineWindow>("Skyline window multi-replicate layout", 9);

                if (IsCoverShotMode)
                {
                    RunUI(() =>
                    {
                        Settings.Default.ChromatogramFontSize = 14;
                        Settings.Default.AreaFontSize         = 14;
                        SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                        SkylineWindow.AutoZoomBestPeak();
                    });

                    RestoreCoverViewOnScreen();

                    var pasteCoverDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);
                    SetCsvFileClipboardText(GetTestPath("SMTutorial_TransitionList.csv"), true);
                    RunUI(() =>
                    {
                        pasteCoverDlg.Size = new Size(810, 375);
                        pasteCoverDlg.Left = SkylineWindow.Left + 8;
                        pasteCoverDlg.Top  = SkylineWindow.Bottom - pasteCoverDlg.Height - 8;
                        pasteCoverDlg.PasteTransitions();
                        pasteCoverDlg.ValidateCells();
                        columnsOrdered.Remove(SmallMoleculeTransitionListColumnHeaders.labelType);
                        pasteCoverDlg.SetSmallMoleculeColumns(columnsOrdered);
                    });
                    TakeCoverShot();

                    OkDialog(pasteCoverDlg, pasteCoverDlg.CancelDialog);
                }
            }
        }
    }
예제 #17
0
        protected override void DoTest()
        {
            // iRT Retention Time Prediction
            string standardDocumentFile = GetTestPath("iRT-C18 Standard.sky"); // Not L10N

            RunUI(() => SkylineWindow.OpenFile(standardDocumentFile));
            WaitForDocumentLoaded();                                                       // might have some updating to do for protein metadata
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath("iRT-C18 Calibrate.sky"))); // Not L10N

            // Load raw files for iRT calculator calibration p. 2
            const string unschedHuman1Fileroot = "A_D110907_SiRT_HELA_11_nsMRM_150selected_1_30min-5-35"; // Not L10N
            string       unschedHuman1Name     = unschedHuman1Fileroot.Substring(41);
            const string unschedHuman2Fileroot = "A_D110907_SiRT_HELA_11_nsMRM_150selected_2_30min-5-35"; // Not L10N
            string       unschedHuman2Name     = unschedHuman2Fileroot.Substring(41);

            ImportNewResults(new[] { unschedHuman1Fileroot, unschedHuman2Fileroot }, 41, false, false);
            var       docCalibrate = WaitForProteinMetadataBackgroundLoaderCompletedUI();
            const int pepCount = 11, tranCount = 33;

            AssertEx.IsDocumentState(docCalibrate, null, 1, pepCount, pepCount, tranCount);
            AssertResult.IsDocumentResultsState(docCalibrate, unschedHuman1Name, pepCount, pepCount, 0, tranCount, 0);
            AssertResult.IsDocumentResultsState(docCalibrate, unschedHuman2Name, pepCount, pepCount, 0, tranCount, 0);

            RunUI(() =>
            {
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.ShowRTPeptideGraph();
                using (var enumLabels = SkylineWindow.RTGraphController.GraphSummary.Categories.GetEnumerator())
                {
                    foreach (var nodePep in docCalibrate.Peptides)
                    {
                        Assert.IsTrue(enumLabels.MoveNext() && enumLabels.Current != null);
                        Assert.IsTrue(nodePep.Peptide.Sequence.StartsWith(enumLabels.Current.Substring(0, 3)));
                    }
                }
            });

            // Page 3.
            PauseForScreenShot <GraphSummary.RTGraphView>("RT graph metafile", 3);   // Peptide RT graph

            RunUI(() =>
            {
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.SelectedPath = docCalibrate.GetPathTo((int)SrmDocument.Level.Molecules, 0);
            });
            // Ensure graphs look like p. 3 and 4
            WaitForGraphs();

            RestoreViewOnScreen(04);
            PauseForScreenShot("Main window showing chromatograms and RT graph", 4);   // Skyline window with docked RT replicate comparison graph

            RunUI(() =>
            {
                Assert.AreEqual(3, SkylineWindow.RTGraphController.GraphSummary.CurveCount);
                Assert.AreEqual(2, SkylineWindow.RTGraphController.GraphSummary.Categories.Count());
                var chromGraphs = SkylineWindow.GraphChromatograms.ToArray();
                Assert.AreEqual(2, chromGraphs.Length);
                Assert.AreEqual(11.3, chromGraphs[0].GraphItems.First().BestPeakTime, 0.05);
                Assert.AreEqual(11.2, chromGraphs[1].GraphItems.First().BestPeakTime, 0.05);
            });

            var listTimes = new List <double>();

            for (int i = 0; i < docCalibrate.PeptideCount; i++)
            {
                int iPeptide = i;
                RunUI(() =>
                {
                    SkylineWindow.SelectedPath = docCalibrate.GetPathTo((int)SrmDocument.Level.Molecules, iPeptide);
                });
                WaitForGraphs();
                RunUI(() =>
                {
                    var chromGraphs = SkylineWindow.GraphChromatograms.ToArray();
                    double time1    = chromGraphs[0].GraphItems.First(g => g.BestPeakTime > 0).BestPeakTime;
                    double time2    = chromGraphs[1].GraphItems.First(g => g.BestPeakTime > 0).BestPeakTime;
                    listTimes.Add((time1 + time2) / 2);
                    Assert.AreEqual(time1, time2, 0.2);
                });
            }

            // Calibrate a calculator p. 4-5
            const string irtCalcName        = "iRT-C18";
            var          peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            var          editIrtCalc1       = ShowDialog <EditIrtCalcDlg>(peptideSettingsUI1.AddCalculator);

            RunUI(() =>
            {
                editIrtCalc1.CalcName = irtCalcName;
                editIrtCalc1.CreateDatabase(GetTestPath("iRT-C18.irtdb"));           // Not L10N
            });
            {
                var calibrateDlg = ShowDialog <CalibrateIrtDlg>(editIrtCalc1.Calibrate);
                RunUI(() =>
                {
                    calibrateDlg.UseResults();
                    Assert.AreEqual(11, calibrateDlg.StandardPeptideCount);
                    calibrateDlg.SetFixedPoints(1, 10);
                    for (int i = 0; i < calibrateDlg.StandardPeptideCount; i++)
                    {
                        Assert.AreEqual(listTimes[i], calibrateDlg.StandardPeptideList[i].RetentionTime, 0.2);
                    }
                });

                PauseForScreenShot <CalibrateIrtDlg>("Calibrate iRT Calculator form", 5);   // Calibrate iRT Calculator form

                RunUI(calibrateDlg.OkDialog);
            }
            Assert.IsTrue(WaitForConditionUI(() => editIrtCalc1.StandardPeptideCount == 11));

            PauseForScreenShot <EditIrtCalcDlg>("Edit iRT Calculater form", 6);   // Edit iRT Caclulator form

            // Check iRT values and update to defined values p. 6-7
            var    irtDefinitionPath = GetTestPath("iRT definition.xlsx");                      // Not L10N
            string irtDefText        = GetExcelFileText(irtDefinitionPath, "iRT-C18", 2, true); // Not L10N

            RunUI(() =>
            {
                var standardPeptidesArray = editIrtCalc1.StandardPeptides.ToArray();
                Assert.AreEqual(11, standardPeptidesArray.Length);
                Assert.AreEqual(0, standardPeptidesArray[1].Irt, 0.00001);
                Assert.AreEqual(100, standardPeptidesArray[10].Irt, 0.00001);
                CheckIrtStandardPeptides(standardPeptidesArray, irtDefText, 6);

                SetClipboardText(irtDefText);
                editIrtCalc1.DoPasteStandard();

                standardPeptidesArray = editIrtCalc1.StandardPeptides.ToArray();
                Assert.AreEqual(11, standardPeptidesArray.Length);
                Assert.AreEqual(0, standardPeptidesArray[1].Irt, 0.001);
                Assert.AreEqual(100, standardPeptidesArray[10].Irt, 0.005);
                CheckIrtStandardPeptides(standardPeptidesArray, irtDefText, 0.00001);
            });
            OkDialog(editIrtCalc1, editIrtCalc1.OkDialog);
            OkDialog(peptideSettingsUI1, peptideSettingsUI1.OkDialog);

            // Inspect RT regression graph p. 8
            RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun);
            WaitForRegression();

            RestoreViewOnScreen(08);
            PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times Regression graph metafile", 8);   // RT Regression graph

            RunUI(() =>
            {
                VerifyRTRegression(0.15, 15.09, 0.9991);

                SkylineWindow.ShowSingleReplicate();
                SkylineWindow.SequenceTree.Focus();             // If the focus is left on the results tab, then the next line does nothing
                SkylineWindow.SelectedResultsIndex = 0;
            });

            WaitForRegression();

            RunUI(() =>
            {
                VerifyRTRegression(0.15, 15.15, 0.9991);

                SkylineWindow.SelectedResultsIndex = 1;
            });

            WaitForRegression();

            RunUI(() => VerifyRTRegression(0.15, 15.04, 0.9991));
            RunUI(() => SkylineWindow.ShowAverageReplicates());
            RunUI(() => SkylineWindow.SaveDocument());

            // Create a document containing human and standard peptides, p. 9
            RunUI(() => SkylineWindow.OpenFile(GetTestPath("iRT Human.sky")));
            WaitForProteinMetadataBackgroundLoaderCompletedUI(); // let peptide metadata background loader do its work
            RunUI(() =>
            {
                SkylineWindow.SelectedPath = new IdentityPath(SequenceTree.NODE_INSERT_ID);
                SkylineWindow.ImportFiles(standardDocumentFile);
            });
            WaitForProteinMetadataBackgroundLoaderCompletedUI(); // let peptide metadata background loader do its work

            RestoreViewOnScreen(09);
            PauseForScreenShot("Targets tree clipped out of main winodw", 9);   // Target tree

            RunUI(() =>
            {
                Assert.AreEqual("iRT-C18 Standard Peptides", SkylineWindow.SelectedNode.Text);           // Not L10N
                Assert.AreEqual(1231, SkylineWindow.DocumentUI.PeptideTransitionCount);

                SkylineWindow.SaveDocument(GetTestPath("iRT Human+Standard.sky"));           // Not L10N
                SkylineWindow.SaveDocument(GetTestPath("iRT Human+Standard Calibrate.sky")); // Not L10N
            });

            // Remove heavy precursors, p. 10
            var docHumanAndStandard = SkylineWindow.Document;

            RunDlg <RefineDlg>(SkylineWindow.ShowRefineDlg, refineDlg =>
            {
                refineDlg.RefineLabelType = IsotopeLabelType.heavy;
                refineDlg.OkDialog();
            });
            var docLightOnly = WaitForDocumentChange(docHumanAndStandard);

            Assert.AreEqual(632, docLightOnly.PeptideTransitionCount);

            // Create auto-calculate regression RT predictor, p. 10
            const string irtPredictorName = "iRT-C18"; // Not L10N

            {
                var docPre             = SkylineWindow.Document;
                var peptideSettingsUI2 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() => peptideSettingsUI2.ChooseRegression(irtPredictorName));
                var regressionDlg = ShowDialog <EditRTDlg>(peptideSettingsUI2.EditRegression);
                RunUI(() =>
                {
                    Assert.AreEqual(irtPredictorName, regressionDlg.Regression.Name);
                    Assert.AreEqual(irtCalcName, regressionDlg.Regression.Calculator.Name);
                    regressionDlg.SetAutoCalcRegression(true);
                    regressionDlg.SetTimeWindow(5);
                });

                PauseForScreenShot("Edit Retention Time Predictor form", 10);   // Edit retention time predictor form

                OkDialog(regressionDlg, regressionDlg.OkDialog);
                OkDialog(peptideSettingsUI1, peptideSettingsUI2.OkDialog);
                // Make sure iRT calculator is loaded
                WaitForDocumentChangeLoaded(docPre);
            }

            // Export unscheduled transition list, p. 11
            {
                const string calibrateBasename = "iRT Human+Standard Calibrate"; // Not L10N
                var          exportMethodDlg   = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.ExportStrategy = ExportStrategy.Buckets;
                    exportMethodDlg.IgnoreProteins = true;
                    exportMethodDlg.MaxTransitions = 335;
                });

                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List form", 11);

                RunUI(() => exportMethodDlg.OkDialog(GetTestPath(calibrateBasename + TextUtil.EXT_CSV)));
                WaitForClosedForm(exportMethodDlg);

                Assert.AreEqual(332, File.ReadAllLines(GetTestPath(calibrateBasename + "_0001.csv")).Length);                                // Not L10N
                Assert.AreEqual(333 + (TestSmallMolecules ? 2 : 0), File.ReadAllLines(GetTestPath(calibrateBasename + "_0002.csv")).Length); // Not L10N
            }

            // Import human peptide calibration results p. 12
            ImportNewResults(new[] { unschedHuman1Fileroot, unschedHuman2Fileroot }, -1, true);

            // Review iRT-C18 graph p. 12-13
            RunUI(() => SkylineWindow.ChooseCalculator(irtCalcName));
            RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun);
            WaitForRegression();

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 13);

            RunUI(() =>
            {
                VerifyRTRegression(0.15, 15.09, 0.9991);
                Assert.AreEqual(11, SkylineWindow.DocumentUI.PeptideCount -
                                SkylineWindow.RTGraphController.Outliers.Length);
            });

            // Find all unintegrated transitions, p. 13-14
            {
                var findDlg = ShowDialog <FindNodeDlg>(SkylineWindow.ShowFindNodeDlg);
                RunUI(() =>
                {
                    findDlg.FindOptions = new FindOptions().ChangeText(string.Empty)
                                          .ChangeCustomFinders(Finders.ListAllFinders().Where(f => f is UnintegratedTransitionFinder));
                });

                PauseForScreenShot <FindNodeDlg>("Find form", 14);

                RestoreViewOnScreen(15);

                RunUI(() =>
                {
                    findDlg.FindAll();
                    findDlg.Close();
                });
                WaitForClosedForm(findDlg);
            }

            PauseForScreenShot <FindResultsForm>("Find Results pane", 14);

            var findAllForm = WaitForOpenForm <FindResultsForm>();

            Assert.IsNotNull(findAllForm);
            const int expectedItems = 6;

            RunUI(() =>
            {
                Assert.AreEqual(expectedItems, findAllForm.ItemCount);

                SkylineWindow.ShowAllTransitions();
                SkylineWindow.AutoZoomBestPeak();
            });

            // Review peaks with missing transitions, p. 15
            for (int i = 0; i < expectedItems; i++)
            {
                int iItem = i;
                RunUI(() => findAllForm.ActivateItem(iItem));
                WaitForGraphs();
                RunUI(() => Assert.AreEqual((int)SequenceTree.StateImageId.no_peak,
                                            SkylineWindow.SelectedNode.StateImageIndex));

                if (i == 2)
                {
                    PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile (1 of 2)", 15);
                }
                if (i == 3)
                {
                    RunUI(() =>
                    {
                        var document  = SkylineWindow.DocumentUI;
                        var nodeGroup = document.FindNode(SkylineWindow.SelectedPath.Parent) as TransitionGroupDocNode;
                        Assert.IsNotNull(nodeGroup);
                        var nodeTran = document.FindNode(SkylineWindow.SelectedPath) as TransitionDocNode;
                        Assert.IsNotNull(nodeTran);
                        var graph = SkylineWindow.GetGraphChrom(Resources.ImportResultsDlg_DefaultNewName_Default_Name);
                        // New peak picking picks correct peak
                        Assert.AreEqual(19.8, graph.BestPeakTime.Value, 0.05);
//                        TransitionGroupDocNode nodeGroupGraph;
//                        TransitionDocNode nodeTranGraph;
//                        var scaledRT = graph.FindAnnotatedPeakRetentionTime(19.8, out nodeGroupGraph, out nodeTranGraph);
//                        Assert.AreSame(nodeGroup, nodeGroupGraph);
//                        Assert.AreNotSame(nodeTran, nodeTranGraph);
//                        Assert.AreEqual(7, nodeTranGraph.Transition.Ordinal);   // y7
//                        graph.FirePickedPeak(nodeGroupGraph, nodeTranGraph, scaledRT);
                    });
                }
                if (i == 4)
                {
                    PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile (2 of 2)", 15);   // Chromatogram graph
                }
            }

            // New peak picking picks correct peak
//            RunUI(() => findAllForm.ActivateItem(3));
//            PauseForScreenShot<GraphChromatogram>("Chromatogram graph metafile (3 of 3)", 15);

            RunUI(SkylineWindow.ToggleIntegrateAll);
            RunUI(findAllForm.Close);
            WaitForClosedForm(findAllForm);

            RestoreViewOnScreen(17);

            // Calculate new iRT values for human peptides, p. 16
            {
                var editIrtCalc2 = ShowDialog <EditIrtCalcDlg>(SkylineWindow.ShowEditCalculatorDlg);
                RunUI(() => Assert.AreEqual(0, editIrtCalc2.LibraryPeptideCount));
                var addPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(editIrtCalc2.AddResults);

                PauseForScreenShot <AddIrtPeptidesDlg>("Add Peptides form", 15);

                RunUI(() =>
                {
                    Assert.AreEqual(148, addPeptidesDlg.PeptidesCount);
                    Assert.AreEqual(2, addPeptidesDlg.RunsConvertedCount);
                    Assert.AreEqual(0, addPeptidesDlg.RunsFailedCount);
                });
                var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addPeptidesDlg.OkDialog);
                OkDialog(recalibrateDlg, recalibrateDlg.Btn1Click);

                PauseForScreenShot <EditIrtCalcDlg>("Edit iRT Calculator form", 16);

                RunUI(() => Assert.AreEqual(148, editIrtCalc2.LibraryPeptideCount));
                RunUI(editIrtCalc2.OkDialog);
                WaitForClosedForm(editIrtCalc2);
            }

            // Check the RT regression, p. 17
            WaitForRegression();

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 17);

            RunUI(() =>
            {
                VerifyRTRegression(0.15, 15.09, 0.99985);
                Assert.AreEqual(0, SkylineWindow.RTGraphController.Outliers.Length);

                SkylineWindow.SaveDocument();
                SkylineWindow.HideFindResults();
            });

            // Recalibrate method to 90-minute gradient, p. 18
            RunUI(() => SkylineWindow.OpenFile(GetTestPath("iRT Human+Standard.sky"))); // Not L10N
            RunDlg <FindNodeDlg>(SkylineWindow.ShowFindNodeDlg, findDlg =>
            {
                findDlg.FindOptions = new FindOptions().ChangeText("NSAQ");         // Not L10N
                findDlg.FindNext();
                findDlg.Close();
            });
            RunUI(SkylineWindow.EditDelete);

            {
                var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() =>
                {
                    peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Prediction;
                    peptideSettingsUI.ChooseRegression(irtPredictorName);
                    peptideSettingsUI.IsUseMeasuredRT = true;
                    peptideSettingsUI.TimeWindow      = 5;
                });

                PauseForScreenShot <PeptideSettingsUI.PredictionTab>("Peptide Settings - Prediction tab", 18);

                RunUI(peptideSettingsUI.OkDialog);
                WaitForClosedForm(peptideSettingsUI);
            }

            // Import 90-minute standard mix run, p. 19
            const string unsched90MinFileroot = "A_D110913_SiRT_HELA_11_nsMRM_150selected_90min-5-40_TRID2215_01"; // Not L10N

            ImportNewResults(new[] { unsched90MinFileroot }, -1, false);
            WaitForGraphs();

            // Verify regression graph, p. 19
            RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun);
            WaitForRegression();
            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 19);
            RunUI(() =>
            {
                VerifyRTRegression(0.40, 24.77, 0.9998);
                Assert.AreEqual(147, SkylineWindow.RTGraphController.Outliers.Length);
            });

            // Check scheduling graph, p. 20
            RunUI(SkylineWindow.ShowRTSchedulingGraph);
            RunDlg <SchedulingGraphPropertyDlg>(() => SkylineWindow.ShowRTPropertyDlg(SkylineWindow.GraphRetentionTime), propertyDlg =>
            {
                propertyDlg.TimeWindows = new[] { 2.0, 5.0, 10.0 };
                propertyDlg.OkDialog();
            });
            WaitForGraphs();

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Scheduling graph metafile", 20);

            // Export new 90-minute scheduled transition list, p. 22
            const string scheduledBasename = "iRT Human+Standard"; // Not L10N

            {
                var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.ExportStrategy = ExportStrategy.Buckets;
                    exportMethodDlg.MaxTransitions = 265;
                    exportMethodDlg.MethodType     = ExportMethodType.Scheduled;
                });

                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List form", 21);

                RunUI(() => exportMethodDlg.OkDialog(GetTestPath(scheduledBasename + TextUtil.EXT_CSV)));
                WaitForClosedForm(exportMethodDlg);
            }

            Assert.AreEqual(1223 + (TestSmallMolecules ? 4 : 0), File.ReadAllLines(GetTestPath(scheduledBasename + "_0001.csv")).Length); // Not L10N
            Assert.IsFalse(File.Exists(GetTestPath("iRT Human+Standard_0002.csv")));                                                      // Not L10N

            // Import scheduled data, p. 23
            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageResultsDlg =>
            {
                manageResultsDlg.RemoveAllReplicates();
                manageResultsDlg.OkDialog();
            });

            RunUI(() => SkylineWindow.SaveDocument());
            const string sched90MinFileroot = "A_D110913_SiRT_HELA_11_sMRM_150selected_90min-5-40_SIMPLE"; // Not L10N

            ImportNewResults(new[] { sched90MinFileroot }, -1, false);

            RunUI(SkylineWindow.ShowRTRegressionGraphScoreToRun);
            WaitForRegression();

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 23);

            // Review regression and outliers, p. 24
            RunUI(() =>
            {
                VerifyRTRegression(0.358, 25.920, 0.91606);
                Assert.AreEqual(0, SkylineWindow.RTGraphController.Outliers.Length);
            });

            RunDlg <RegressionRTThresholdDlg>(SkylineWindow.ShowRegressionRTThresholdDlg, thresholdDlg =>
            {
                thresholdDlg.Threshold = 0.998;
                thresholdDlg.OkDialog();
            });

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 24);

            // Verify 2 outliers highlighed and removed, p. 25
            WaitForConditionUI(() => SkylineWindow.RTGraphController.Outliers.Length == 2);
            RunUI(() =>
            {
                VerifyRTRegression(0.393, 24.85, 0.9989);

                SkylineWindow.RemoveRTOutliers();
            });
            WaitForRegression();

            PauseForScreenShot <GraphSummary.RTGraphView>("RT Regression graph metafile", 25);

            // Check outlier removal, p. 25
            RunUI(() =>
            {
                VerifyRTRegression(0.393, 24.85, 0.9989);
                Assert.AreEqual(0, SkylineWindow.RTGraphController.Outliers.Length);
            });

            // Review a peak and its predicted retention time, p. 26
            RunDlg <FindNodeDlg>(SkylineWindow.ShowFindNodeDlg, findDlg =>
            {
                findDlg.FindOptions = new FindOptions().ChangeText("DATNVG");         // Not L10N
                findDlg.FindNext();
                findDlg.Close();
            });
            WaitForGraphs();

            RestoreViewOnScreen(27);
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile", 26);   // Chromatogram graph

            RunUI(() =>
            {
                var graphChrom = SkylineWindow.GetGraphChrom(sched90MinFileroot);
                Assert.IsTrue(graphChrom.BestPeakTime.HasValue);
                Assert.AreEqual(47.3, graphChrom.BestPeakTime.Value, 0.05);
                Assert.IsTrue(graphChrom.PredictedRT.HasValue);
                Assert.AreEqual(47.6, graphChrom.PredictedRT.Value, 0.05);
            });

            // Import retention times from a spectral library, p. 27
            RestoreViewOnScreen(17); // get regression graph back
            {
                var editIrtCalc  = ShowDialog <EditIrtCalcDlg>(SkylineWindow.ShowEditCalculatorDlg);
                var addLibrayDlg = ShowDialog <AddIrtSpectralLibrary>(editIrtCalc.AddLibrary);
                RunUI(() =>
                {
                    addLibrayDlg.Source   = SpectralLibrarySource.file;
                    addLibrayDlg.FilePath = GetTestPath(Path.Combine("Yeast+Standard",               // Not L10N
                                                                     "Yeast_iRT_C18_0_00001.blib")); // Not L10N
                });

                PauseForScreenShot <AddIrtSpectralLibrary>("Add Spectral Library form", 27);

                // Verify converted peptide iRT values and OK dialogs, p. 28
                var addPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(addLibrayDlg.OkDialog);
                RunUI(() =>
                {
                    Assert.AreEqual(558, addPeptidesDlg.PeptidesCount);
                    Assert.AreEqual(1, addPeptidesDlg.RunsConvertedCount);  // Libraries now convert through internal alignment to single RT scale
                    Assert.AreEqual(3, addPeptidesDlg.KeepPeptidesCount);
                });

                PauseForScreenShot <AddIrtPeptidesDlg>("Add Peptides form", 28);

                var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addPeptidesDlg.OkDialog);
                OkDialog(recalibrateDlg, recalibrateDlg.Btn1Click);

                Assert.IsTrue(WaitForConditionUI(() => editIrtCalc.LibraryPeptideCount == 706));
                RunUI(editIrtCalc.OkDialog);
                WaitForClosedForm(editIrtCalc);
            }

            // Inspect MS1 filtered Skyline file created from library DDA data, p. 29
            RunUI(() => SkylineWindow.OpenFile(GetTestPath(Path.Combine("Yeast+Standard", // Not L10N
                                                                        "Yeast+Standard (refined) - 2min.sky"))));
            WaitForDocumentLoaded();
            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.Molecules, 0));
            WaitForRegression();

            // Verify numbers that show up in the screenshot
            RunUI(() =>
            {
                // If the cache gets rebuilt, then because the chromatograms
                // were minimized, the peak picking is not exactly the same
                // using the minimized chromatograms.
                VerifyRTRegression(0.3, 19.37, 0.9998);
                var graphChrom = SkylineWindow.GetGraphChrom("Velos_2011_1110_RJ_16");           // Not L10N
                Assert.AreEqual(37.6, graphChrom.RetentionMsMs[0], 0.05);
                Assert.IsTrue(graphChrom.BestPeakTime.HasValue);
                Assert.AreEqual(37.6, graphChrom.BestPeakTime.Value, 0.05);
                graphChrom = SkylineWindow.GetGraphChrom("Velos_2011_1110_RJ_14");           // Not L10N
                Assert.AreEqual(37.3, graphChrom.RetentionMsMs[0], 0.05);
                Assert.AreEqual(37.6, graphChrom.RetentionMsMs[1], 0.05);
                Assert.IsTrue(graphChrom.BestPeakTime.HasValue);
                Assert.AreEqual(37.4, graphChrom.BestPeakTime.Value, 0.05);
            });

            PauseForScreenShot("Main window", 29);

            // Add results and verify add dialog counts, p. 29-30
            {
                var editIrtCalc    = ShowDialog <EditIrtCalcDlg>(SkylineWindow.ShowEditCalculatorDlg);
                var addPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(editIrtCalc.AddResults);
                RunUI(() =>
                {
                    Assert.AreEqual(0, addPeptidesDlg.PeptidesCount);
                    Assert.AreEqual(2, addPeptidesDlg.RunsConvertedCount);
                    Assert.AreEqual(558, addPeptidesDlg.OverwritePeptidesCount);
                    Assert.AreEqual(3, addPeptidesDlg.ExistingPeptidesCount);
                });

                PauseForScreenShot <AddIrtPeptidesDlg>("Add Peptides form", 30);

                var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addPeptidesDlg.OkDialog);
                OkDialog(recalibrateDlg, recalibrateDlg.Btn1Click);
                RunUI(editIrtCalc.OkDialog);
                WaitForClosedForm(editIrtCalc);
            }

            RunUI(() => SkylineWindow.SaveDocument());
            RunUI(SkylineWindow.NewDocument);
        }
예제 #18
0
        /// <summary>
        /// Test that the "Match Modifications" page of the Import Peptide Search wizard gets skipped.
        /// </summary>
        private void TestAmandaSearch()
        {
            PrepareDocument("TestDdaTutorial.sky");

            int tutorialPage = 3;

            // Set standard type to None
            var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Modifications);
            RunUI(() => peptideSettingsUI.SelectedInternalStandardTypeName = Resources.LabelTypeComboDriver_LoadList_none);
            PauseForScreenShot <PeptideSettingsUI.ModificationsTab>("Peptide Settings - Modifications tab", tutorialPage++);

            var docBeforePeptideSettings = SkylineWindow.Document;

            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
            WaitForDocumentChangeLoaded(docBeforePeptideSettings);

            // Launch the wizard
            var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg);

            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - Select DDA Files to Search page", tutorialPage++);

            // We're on the "Build Spectral Library" page of the wizard.
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.spectra_page);
                importPeptideSearchDlg.BuildPepSearchLibControl.PerformDDASearch        = true;
                importPeptideSearchDlg.BuildPepSearchLibControl.DdaSearchDataSources    = SearchFiles.Select(o => new MsDataFilePath(o)).ToArray();
                importPeptideSearchDlg.BuildPepSearchLibControl.IncludeAmbiguousMatches = false;
                Assert.AreEqual(ImportPeptideSearchDlg.Workflow.dda, importPeptideSearchDlg.BuildPepSearchLibControl.WorkflowType);
            });
            PauseForScreenShot <ImportPeptideSearchDlg.SpectraPage>("Import Peptide Search - After Selecting DDA Files page", tutorialPage++);

            if (IsFullData)
            {
                // Remove prefix/suffix dialog pops up; accept default behavior
                var removeSuffix = ShowDialog <ImportResultsNameDlg>(() => importPeptideSearchDlg.ClickNextButton());
                PauseForScreenShot <ImportResultsNameDlg>("Import Results - Common prefix form", tutorialPage++);
                OkDialog(removeSuffix, () => removeSuffix.YesDialog());
                WaitForDocumentLoaded();
            }
            else
            {
                RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));
            }

            // We're on the "Match Modifications" page. Add SILAC mods and M+16
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.match_modifications_page);
            PauseForScreenShot <ImportPeptideSearchDlg.MatchModsPage>("Import Peptide Search - Add Modifications page", tutorialPage++);

            var editHeavyModListUI =
                ShowDialog <EditListDlg <SettingsListBase <StaticMod>, StaticMod> >(importPeptideSearchDlg.MatchModificationsControl.ClickAddHeavyModification);
            var heavyKDlg = ShowDialog <EditStaticModDlg>(editHeavyModListUI.AddItem);

            RunUI(() => heavyKDlg.SetModification(HEAVY_K, true));
            PauseForScreenShot <EditStaticModDlg.IsotopeModView>("Edit Isotope Modification form - K", tutorialPage++);
            OkDialog(heavyKDlg, heavyKDlg.OkDialog);

            var heavyRDlg = ShowDialog <EditStaticModDlg>(editHeavyModListUI.AddItem);

            RunUI(() => heavyRDlg.SetModification(HEAVY_R, true));
            PauseForScreenShot <EditStaticModDlg.IsotopeModView>("Edit Isotope Modification form - R", tutorialPage++);
            OkDialog(heavyRDlg, heavyRDlg.OkDialog);
            OkDialog(editHeavyModListUI, editHeavyModListUI.OkDialog);

            /*var peptideSettingsUI = ShowDialog<PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
             * var modHeavyK = new StaticMod(HEAVY_K, "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, RelativeRT.Matching, null, null, null);
             * var modHeavyR = new StaticMod(HEAVY_R, "R", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, RelativeRT.Matching, null, null, null);
             * AddHeavyMod(modHeavyK, peptideSettingsUI, "Edit Isotope Modification form", tutorialPage++);
             * AddHeavyMod(modHeavyR, peptideSettingsUI, "Edit Isotope Modification form", tutorialPage++);*/

            var editStructModListUI =
                ShowDialog <EditListDlg <SettingsListBase <StaticMod>, StaticMod> >(importPeptideSearchDlg.MatchModificationsControl.ClickAddStructuralModification);

            RunDlg <EditStaticModDlg>(editStructModListUI.AddItem, editModDlg =>
            {
                editModDlg.SetModification(OXIDATION_M, true); // Not L10N
                editModDlg.OkDialog();
            });
            OkDialog(editStructModListUI, editStructModListUI.OkDialog);

            RunUI(() => importPeptideSearchDlg.MatchModificationsControl.ChangeAll(true));

            PauseForScreenShot <ImportPeptideSearchDlg.MatchModsPage>("Import Peptide Search - After adding modifications page", tutorialPage++);
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // We're on the MS1 full scan settings page. Set tolerance to 20ppm
            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page);
            RunUI(() => importPeptideSearchDlg.FullScanSettingsControl.PrecursorRes = 20);
            PauseForScreenShot <ImportPeptideSearchDlg.Ms1FullScanPage>("Import Peptide Search - Configure MS1 Full-Scan Settings page", tutorialPage++);
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // We're on the "Import FASTA" page.
            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.import_fasta_page);
                Assert.IsFalse(importPeptideSearchDlg.ImportFastaControl.DecoyGenerationEnabled);
                importPeptideSearchDlg.ImportFastaControl.SetFastaContent(GetTestPath("DdaSearchMs1Filtering\\2014_01_HUMAN_UPS.fasta"));
            });
            PauseForScreenShot <ImportPeptideSearchDlg.FastaPage>("Import Peptide Search - Import FASTA page", tutorialPage++);
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            // We're on the "Adjust Search Settings" page
            bool?searchSucceeded = null;

            RunUI(() =>
            {
                Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.dda_search_settings_page);
                importPeptideSearchDlg.SearchSettingsControl.SetPrecursorTolerance(new MzTolerance(5, MzTolerance.Units.ppm));
                importPeptideSearchDlg.SearchSettingsControl.SetFragmentTolerance(new MzTolerance(10, MzTolerance.Units.ppm));
                importPeptideSearchDlg.SearchSettingsControl.SetFragmentIons("b, y");

                importPeptideSearchDlg.SearchControl.OnSearchFinished += (success) => searchSucceeded = success;
            });
            PauseForScreenShot <ImportPeptideSearchDlg.DDASearchSettingsPage>("Import Peptide Search - DDA Search Settings page", tutorialPage++);

            // Run the search
            RunUI(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            WaitForConditionUI(() => importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.dda_search_page);
            PauseForScreenShot <ImportPeptideSearchDlg.DDASearchPage>("Import Peptide Search - DDA Search Progress page", tutorialPage++);

            // Wait for search to finish
            WaitForConditionUI(60000 * 60, () => searchSucceeded.HasValue);
            Assert.IsTrue(searchSucceeded.Value);
            if (IsCoverShotMode)
            {
                _searchLogImage = ScreenshotManager.TakeNextShot(importPeptideSearchDlg);
                Assert.IsNotNull(_searchLogImage);
            }

            // clicking 'Finish' (Next) will run ImportFasta
            var ambiguousDlg = ShowDialog <MessageDlg>(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()));

            PauseForScreenShot <MessageDlg>("Import Peptide Search - Ambiguous Peptides dialog", tutorialPage++);
            RunUI(() => AssertEx.Contains(ambiguousDlg.Message,
                                          Resources.BiblioSpecLiteBuilder_AmbiguousMatches_The_library_built_successfully__Spectra_matching_the_following_peptides_had_multiple_ambiguous_peptide_matches_and_were_excluded_));

            var emptyProteinsDlg = ShowDialog <PeptidesPerProteinDlg>(() => ambiguousDlg.OkDialog());

            RunUI(() =>
            {
                emptyProteinsDlg.RemoveRepeatedPeptides = true;
                int proteinCount, peptideCount, precursorCount, transitionCount;
                emptyProteinsDlg.NewTargetsAll(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                if (!IsFullData)
                {
                    if (RecordAuditLogs)
                    {
                        Console.WriteLine();
                        Console.WriteLine($@"Assert.AreEqual({proteinCount}, proteinCount);");
                        Console.WriteLine($@"Assert.AreEqual({peptideCount}, peptideCount);");
                        Console.WriteLine($@"Assert.AreEqual({precursorCount}, precursorCount);");
                        Console.WriteLine($@"Assert.AreEqual({transitionCount}, transitionCount);");
                    }
                    else
                    {
                        Assert.AreEqual(12590, proteinCount);
                        Assert.AreEqual(28251, peptideCount);
                        Assert.AreEqual(56111, precursorCount);
                        Assert.AreEqual(168333, transitionCount);
                    }
                }

                emptyProteinsDlg.NewTargetsFinalSync(out proteinCount, out peptideCount, out precursorCount, out transitionCount);
                if (!IsFullData)
                {
                    if (RecordAuditLogs)
                    {
                        Console.WriteLine();
                        Console.WriteLine($@"Assert.AreEqual({proteinCount}, proteinCount);");
                        Console.WriteLine($@"Assert.AreEqual({peptideCount}, peptideCount);");
                        Console.WriteLine($@"Assert.AreEqual({precursorCount}, precursorCount);");
                        Console.WriteLine($@"Assert.AreEqual({transitionCount}, transitionCount);");
                    }
                    else
                    {
                        Assert.AreEqual(3772, proteinCount);
                        Assert.AreEqual(7173, peptideCount);
                        Assert.AreEqual(14203, precursorCount);
                        Assert.AreEqual(42609, transitionCount);
                    }
                }
            });
            PauseForScreenShot("Import Peptide Search - Empty Proteins dialog", tutorialPage++);

            using (new WaitDocumentChange(null, true))
            {
                OkDialog(emptyProteinsDlg, emptyProteinsDlg.OkDialog);
            }

            FindNode(string.Format("{0:F04}++", IsFullData ? 835.914 : 699.3566));
            RunUI(() =>
            {
                SkylineWindow.GraphSpectrumSettings.ShowBIons = true;
                SkylineWindow.ShowAlignedPeptideIDTimes(true);
            });
            WaitForGraphs();
            RestoreViewOnScreen(17);
            RunUI(() =>
            {
                SkylineWindow.Size = new Size(1137, 714);
                // Set horizontal scroll position
            });
            WaitForGraphs();
            PauseForScreenShot("Main window with peptide search results", tutorialPage++);

            RunUI(() => SkylineWindow.ShowPeakAreaReplicateComparison());
            RefreshGraphs();
            PauseForScreenShot("Peak Areas - Replicate Comparison", tutorialPage++);

            RunUI(() =>
            {
                SkylineWindow.ShowChromatogramLegends(false);
                SkylineWindow.AutoZoomBestPeak();
            });
            RestoreViewOnScreen(19);
            RefreshGraphs();
            RefreshGraphs();    // For some reason the first time doesn't get the idotp values in the are graph right
            PauseForScreenShot("Main window arranged", tutorialPage);

            if (IsCoverShotMode)
            {
                RunUI(() =>
                {
                    Settings.Default.ChromatogramFontSize = 14;
                    Settings.Default.AreaFontSize         = 14;
                });
                RestoreCoverViewOnScreen(false);

                RunUI(SkylineWindow.FocusDocument);
                RefreshGraphs();
                TakeCoverShot();
                return;
            }

            RunUI(() => SkylineWindow.SaveDocument());
        }
예제 #19
0
        protected override void DoTest()
        {
            var folderAbsoluteQuant = UseRawFiles ? "AbsoluteQuant" : "AbsoluteQuantMzml";
            // Generating a Transition List, p. 4
            {
                var doc = SkylineWindow.Document;
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() =>
                {
                    // Predicition Settings
                    transitionSettingsUI.SelectedTab       = TransitionSettingsUI.TABS.Prediction;
                    transitionSettingsUI.PrecursorMassType = MassType.Monoisotopic;
                    transitionSettingsUI.FragmentMassType  = MassType.Monoisotopic;
                    transitionSettingsUI.RegressionCEName  = "Thermo TSQ Vantage";
                    transitionSettingsUI.RegressionDPName  = Resources.SettingsList_ELEMENT_NONE_None;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings - Prediction tab", 4);

                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab      = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.PrecursorCharges = "2";
                    transitionSettingsUI.ProductCharges   = "1";
                    transitionSettingsUI.FragmentTypes    = "y";
                    transitionSettingsUI.RangeFrom        = Resources.TransitionFilter_FragmentStartFinders_ion_3;
                    transitionSettingsUI.RangeTo          = Resources.TransitionFilter_FragmentEndFinders_last_ion_minus_1;
                    transitionSettingsUI.SpecialIons      = new string[0];
                });
                PauseForScreenShot <TransitionSettingsUI.FilterTab>("Transition Settings - Filter tab", 4);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(doc);
            }

            // Configuring Peptide settings p. 4
            PeptideSettingsUI peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Modifications);
            PauseForScreenShot <PeptideSettingsUI.ModificationsTab>("Peptide Settings - Modification tab", 5);

            var modHeavyK = new StaticMod("Label:13C(6)15N(2) (C-term K)", "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15,
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyK, peptideSettingsUI, "Edit Isotope Modification over Transition Settings", 5);
            RunUI(() => peptideSettingsUI.PickedHeavyMods = new[] { modHeavyK.Name });
            PauseForScreenShot <PeptideSettingsUI.ModificationsTab>("Peptide Settings - Modification tab with mod added", 5);

            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);

            // Inserting a peptide sequence p. 5
            using (new CheckDocumentState(1, 1, 2, 10))
            {
                RunUI(() => SetClipboardText("IEAIPQIDK\tGST-tag"));
                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg);
                RunUI(pasteDlg.PastePeptides);
                WaitForProteinMetadataBackgroundLoaderCompletedUI();
                PauseForScreenShot <PasteDlg.PeptideListTab>("Insert Peptide List", 6);

                OkDialog(pasteDlg, pasteDlg.OkDialog);
            }

            RunUI(SkylineWindow.ExpandPrecursors);
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath(folderAbsoluteQuant + @"test_file.sky")));
            WaitForCondition(() => File.Exists(TestFilesDir.GetTestPath(folderAbsoluteQuant + @"test_file.sky")));
            PauseForScreenShot("Main window with Targets view", 6);

            // Exporting a transition list p. 6
            {
                var exportMethodDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportMethodDlg.InstrumentType = ExportInstrumentType.THERMO;
                    exportMethodDlg.ExportStrategy = ExportStrategy.Single;
                    exportMethodDlg.OptimizeType   = ExportOptimize.NONE;
                    exportMethodDlg.MethodType     = ExportMethodType.Standard;
                });
                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List", 7);

                OkDialog(exportMethodDlg, () =>
                         exportMethodDlg.OkDialog(TestFilesDir.GetTestPath("Quant_Abs_Thermo_TSQ_Vantage.csv")));
            }

            // Importing RAW files into Skyline p. 7
            var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            PauseForScreenShot <ImportResultsDlg>("Import Results - click OK to get shot of Import Results Files and then cancel", 8);

            RunUI(() =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value.Skip(1);
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg.NamedPathSets = namedPathSets.ToArray();
            });
            RunDlg <ImportResultsNameDlg>(importResultsDlg.OkDialog,
                                          importResultsNameDlg => importResultsNameDlg.NoDialog());

            WaitForGraphs();

            RunUI(() =>
            {
                SkylineWindow.SelectedPath             = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                Settings.Default.ArrangeGraphsOrder    = GroupGraphsOrder.Document.ToString();
                Settings.Default.ArrangeGraphsReversed = false;
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.AutoZoomBestPeak();
            });
            WaitForCondition(() => Equals(8, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden)),
                             "unexpected visible graphChromatogram count");

            WaitForCondition(10 * 60 * 1000,    // ten minutes
                             () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            PauseForScreenShot("Main window with imported data", 9);

            // Analyzing SRM Data from FOXN1-GST Sample p. 9
            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults,
                                      importResultsDlg1 =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value.Take(1);
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg1.NamedPathSets = namedPathSets.ToArray();
                importResultsDlg1.OkDialog();
            });
            WaitForGraphs();
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
            WaitForCondition(5 * 60 * 1000, // five minutes
                             () =>
                             SkylineWindow.Document.Settings.HasResults &&
                             SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);

            RunUI(() =>
            {
                SkylineWindow.ToggleIntegrateAll();
                SkylineWindow.ArrangeGraphsTabbed();
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.ShowPeakAreaReplicateComparison();
                // Total normalization
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view);
            });

            RunUI(() => SkylineWindow.ActivateReplicate("FOXN1-GST"));
            WaitForGraphs();
            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 0));
            WaitForGraphs();
            RunUI(() =>
            {
                Assert.AreEqual(SkylineWindow.SelectedResultsIndex, SkylineWindow.GraphPeakArea.ResultsIndex);
                Assert.AreEqual(SkylineWindow.SelectedResultsIndex, SkylineWindow.GraphRetentionTime.ResultsIndex);
            });

            RunUI(() =>
            {
                int transitionCount = SkylineWindow.DocumentUI.PeptideTransitionGroups.First().TransitionCount;
                CheckGstGraphs(transitionCount, transitionCount);
            });
            PauseForScreenShot("Main window with Peak Areas, Retention Times and FOXN1-GST for light", 10);

            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 1));
            WaitForGraphs();

            RunUI(() =>
            {
                int transitionCount = SkylineWindow.DocumentUI.PeptideTransitionGroups.ToArray()[1].TransitionCount;
                CheckGstGraphs(transitionCount, transitionCount);
            });
            PauseForScreenShot("Main window with Peak Areas, Retention Times and FOXN1-GST for heavy", 10);

            RunUI(() => SkylineWindow.SelectedPath = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.Molecules, 0));
            WaitForGraphs();
            // Heavy normalization
            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_ratio_view));
            WaitForGraphs();
            RunUI(() =>
            {
                int transitionGroupCount = SkylineWindow.DocumentUI.Peptides.First().TransitionGroupCount;
                CheckGstGraphs(transitionGroupCount, transitionGroupCount - 1);
            });
            PauseForScreenShot("Main window with totals graphs for light and heavy and FOXN1-GST", 11);

            // Peptide Quantitification Settings p. 11
            var          peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            const string quantUnits        = "fmol/ul";

            RunUI(() =>
            {
                peptideSettingsUi.SelectedTab              = PeptideSettingsUI.TABS.Quantification;
                peptideSettingsUi.QuantRegressionFit       = RegressionFit.LINEAR;
                peptideSettingsUi.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                peptideSettingsUi.QuantUnits = quantUnits;
            });
            PauseForScreenShot("Peptide Settings Quantification Tab", 12);
            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            // Specify analyte concentrations of external standards
            RunUI(() => SkylineWindow.ShowDocumentGrid(true));
            var documentGridForm = FindOpenForm <DocumentGridForm>();

            RunUI(() =>
            {
                documentGridForm.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates);
            });
            WaitForConditionUI(() => documentGridForm.IsComplete);
            var concentrations = new[] { 40, 12.5, 5, 2.5, 1, .5, .25, .1 };

            for (int iRow = 0; iRow < concentrations.Length; iRow++)
            {
                // ReSharper disable AccessToModifiedClosure
                RunUI(() =>
                {
                    var colSampleType = documentGridForm.FindColumn(PropertyPath.Root.Property("SampleType"));
                    documentGridForm.DataGridView.Rows[iRow].Cells[colSampleType.Index].Value = SampleType.STANDARD;
                });
                WaitForConditionUI(() => documentGridForm.IsComplete);
                RunUI(() =>
                {
                    var colAnalyteConcentration =
                        documentGridForm.FindColumn(PropertyPath.Root.Property("AnalyteConcentration"));
                    var cell = documentGridForm.DataGridView.Rows[iRow].Cells[colAnalyteConcentration.Index];
                    documentGridForm.DataGridView.CurrentCell = cell;
                    cell.Value = concentrations[iRow];
                });
                // ReSharper restore AccessToModifiedClosure
                WaitForConditionUI(() => documentGridForm.IsComplete);
            }
            PauseForScreenShot("Document grid with concentrations filled in", 13);

            // View the calibration curve p. 13
            RunUI(() => SkylineWindow.ShowCalibrationForm());
            var calibrationForm = FindOpenForm <CalibrationForm>();

            PauseForScreenShot("View calibration curve", 14);

            Assert.AreEqual(CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, quantUnits), calibrationForm.ZedGraphControl.GraphPane.XAxis.Title.Text);
            Assert.AreEqual(string.Format(QuantificationStrings.CalibrationCurveFitter_PeakAreaRatioText__0___1__Peak_Area_Ratio, IsotopeLabelType.light.Title, IsotopeLabelType.heavy.Title),
                            calibrationForm.ZedGraphControl.GraphPane.YAxis.Title.Text);
        }
예제 #20
0
        private void DoMrmerTest()
        {
            // Preparing a Document to Accept a Transition List, p. 2
            var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            var editListUI        =
                ShowDialog <EditListDlg <SettingsListBase <LibrarySpec>, LibrarySpec> >(peptideSettingsUI.EditLibraryList);

            RunDlg <EditLibraryDlg>(editListUI.AddItem, editLibraryDlg =>
            {
                editLibraryDlg.LibrarySpec =
                    new BiblioSpecLibSpec("Yeast_mini", GetTestPath(@"MRMer\Yeast_MRMer_min.blib")); // Not L10N
                editLibraryDlg.OkDialog();
            });
            OkDialog(editListUI, editListUI.OkDialog);
            RunUI(() =>
            {
                peptideSettingsUI.PickedLibraries = new[] { "Yeast_mini" }; // Not L10N
                peptideSettingsUI.SelectedTab     = PeptideSettingsUI.TABS.Library;
            });
            PauseForScreenShot <PeptideSettingsUI.LibraryTab>("Peptide Settings - Library tab", 4);

            RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Digest);
            RunDlg <BuildBackgroundProteomeDlg>(peptideSettingsUI.ShowBuildBackgroundProteomeDlg,
                                                buildBackgroundProteomeDlg =>
            {
                buildBackgroundProteomeDlg.BackgroundProteomeName = "Yeast_mini";                                  // Not L10N
                buildBackgroundProteomeDlg.BackgroundProteomePath = GetTestPath(@"MRMer\Yeast_MRMer_mini.protdb"); // Not L10N
                buildBackgroundProteomeDlg.OkDialog();
            });
            PauseForScreenShot <PeptideSettingsUI.DigestionTab>("Peptide Settings - Digestion tab", 5);

            var modHeavyK = new StaticMod(HEAVY_K, "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, // Not L10N
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyK, peptideSettingsUI, "Edit Isotope Modification form", 6);
            var modHeavyR = new StaticMod(HEAVY_R, "R", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, // Not L10N
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyR, peptideSettingsUI, "Edit Isotope Modification form", 7);
            RunUI(() => peptideSettingsUI.PickedHeavyMods = new[] { HEAVY_K, HEAVY_R });
            var docBeforePeptideSettings = SkylineWindow.Document;

            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
            WaitForDocumentChangeLoaded(docBeforePeptideSettings);

            // Inserting a Transition List With Associated Proteins, p. 6
            RunUI(() =>
            {
                var filePath = GetTestPath(@"MRMer\silac_1_to_4.xls");  // Not L10N
                SetExcelFileClipboardText(filePath, "Fixed", 3, false); // Not L10N
            });
            using (new CheckDocumentState(24, 44, 88, 296))
            {
                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);
                RunUI(() =>
                {
                    pasteDlg.Height     = 465;
                    pasteDlg.IsMolecule = false;
                    pasteDlg.PasteTransitions();  // Make sure it's ready to accept peptides rather than small molecules
                });
                PauseForScreenShot <PasteDlg.TransitionListTab>("Insert Transition List form", 8);
                OkDialog(pasteDlg, pasteDlg.OkDialog);
            }
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0];
                SkylineWindow.Size = new Size(1035, 511);
            });
            PauseForScreenShot("Main window with transitions added", 9);

            FindNode("LWDVAT");
            RunUI(() =>
            {
                Assert.IsTrue(((PeptideDocNode)((PeptideTreeNode)SkylineWindow.SelectedNode).Model).HasChildType(IsotopeLabelType.heavy));
                SkylineWindow.ExpandPrecursors();
            });
            FindNode(string.Format("{0:F03}", 854.4)); // I18N
            WaitForGraphs();
            // Unfortunately, label hiding may mean that the selected ion is not labeled
            Assert.IsTrue(SkylineWindow.GraphSpectrum.SelectedIonLabel != null
                              ? SkylineWindow.GraphSpectrum.SelectedIonLabel.Contains("y7")                           // Not L10N
                              : SkylineWindow.GraphSpectrum.IonLabels.Contains(ionLabel => ionLabel.Contains("y7"))); // Not L10N
            RunUI(() =>
            {
                SkylineWindow.GraphSpectrumSettings.ShowBIons   = true;
                SkylineWindow.GraphSpectrumSettings.ShowCharge2 = true;
            });
            RestoreViewOnScreen(10);
            PauseForScreenShot <GraphSpectrum>("Main window with spectral library graph showing", 10);

            // Importing Data, p. 10.
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"MRMer\MRMer.sky"))); // Not L10N
            ImportResultsFile("silac_1_to_4.mzXML");                                  // Not L10N
            FindNode("ETFP");                                                         // Not L10N
            RunUI(() =>
            {
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.SequenceTree.TopNode = SkylineWindow.SequenceTree.Nodes[5];
            });
            PauseForScreenShot("Main window with data imported", 12);

            RunUI(() =>
            {
                var selNode = SkylineWindow.SequenceTree.SelectedNode;
                Assert.IsTrue(selNode.Text.Contains("ETFPILVEEK")); // Not L10N
                Assert.IsTrue(((PeptideDocNode)((PeptideTreeNode)selNode).Model).HasResults);
                Assert.IsTrue(Equals(selNode.StateImageIndex, (int)SequenceTree.StateImageId.keep));
                SkylineWindow.ShowAllTransitions();
                SkylineWindow.SelectedPath =
                    SkylineWindow.SequenceTree.GetNodePath(selNode.Nodes[0].Nodes[2] as TreeNodeMS);
                Assert.IsTrue(Equals(SkylineWindow.SequenceTree.SelectedNode.StateImageIndex,
                                     (int)SequenceTree.StateImageId.no_peak));
            });
            PauseForScreenShot("Main window", 13);

            // Removing a Transition with Interference, p. 13.
            FindNode(string.Format("{0:F04}", 504.2664));   // I18N
            RunUI(() =>
            {
                var precursorNode = (TransitionGroupTreeNode)SkylineWindow.SelectedNode.Parent;
                VerifyPrecursorRatio(precursorNode, 0.31);

                SkylineWindow.SequenceTree.KeysOverride = Keys.Control;
                var selNode = (TransitionTreeNode)SkylineWindow.SelectedNode;
                VerifyTransitionRatio(selNode, "y4", 0.37);
                var nextNode = (TransitionTreeNode)SkylineWindow.SelectedNode.NextNode;
                VerifyTransitionRatio(nextNode, "y3", 0.59);
                SkylineWindow.SequenceTree.SelectedNode = nextNode;
                var heavyNode = (TransitionTreeNode)precursorNode.Parent.Nodes[1].Nodes[1];
                VerifyTransitionRatio(heavyNode, "y4");
                SkylineWindow.SequenceTree.SelectedNode = heavyNode;
                var heavyNextNode = (TransitionTreeNode)SkylineWindow.SelectedNode.NextNode;
                VerifyTransitionRatio(heavyNextNode, "y3");
                SkylineWindow.SequenceTree.SelectedNode = heavyNextNode;
                SkylineWindow.SequenceTree.KeysOverride = Keys.None;

                SkylineWindow.MarkQuantitative(false);

                VerifyPrecursorRatio(precursorNode, 0.24);
            });

            // Adjusting Peak Boundaries to Exclude Interference, p. 15.
            RunUI(() => SkylineWindow.Undo());
            FindNode("ETFP");
            RunUI(() =>
            {
                var precursorNode = (TransitionGroupTreeNode)SkylineWindow.SelectedNode.Nodes[0];
                VerifyPrecursorRatio(precursorNode, 0.31);
                var pathGroup =
                    SkylineWindow.SequenceTree.GetNodePath((TreeNodeMS)SkylineWindow.SelectedNode.Nodes[0]);
                var graphChrom  = SkylineWindow.GraphChromatograms.ToList()[0];
                var listChanges = new List <ChangedPeakBoundsEventArgs>
                {
                    new ChangedPeakBoundsEventArgs(pathGroup, null, graphChrom.NameSet,
                                                   graphChrom.ChromGroupInfos[0].FilePath,
                                                   new ScaledRetentionTime(29.8, 29.8),
                                                   new ScaledRetentionTime(30.4, 30.4),
                                                   PeakIdentification.FALSE,
                                                   PeakBoundsChangeType.both)
                };
                graphChrom.SimulateChangedPeakBounds(listChanges);
                foreach (TransitionTreeNode node in SkylineWindow.SequenceTree.SelectedNode.Nodes[0].Nodes)
                {
                    Assert.IsTrue(((TransitionDocNode)node.Model).HasResults);
                }
            });
            RestoreViewOnScreen(15);
            PauseForScreenShot("Main window", 15);

            FindNode("YVDP");
            RunUI(() =>
                  Assert.IsTrue(SkylineWindow.SequenceTree.SelectedNode.Nodes[0].Nodes[2].StateImageIndex
                                == (int)SequenceTree.StateImageId.peak_blank));
            RunUI(() => SkylineWindow.SaveDocument());
            PauseForAuditLog();
        }
예제 #21
0
        protected override void DoTest()
        {
            string skyFile = TestFilesDirs[0].GetTestPath(@"DriftTimePrediction\BSA-Training.sky");

            RunUI(() => SkylineWindow.OpenFile(skyFile));

            var document = WaitForDocumentLoaded(240 * 1000); // 4 minutes

            RunUI(() => SkylineWindow.Size = new Size(880, 560));
            RestoreViewOnScreen(2);
            PauseForScreenShot("Document open - full window", 2);
            AssertEx.IsDocumentState(document, null, 1, 34, 38, 404);

            {
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(() =>
                                                                             SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.FullScan));

                PauseForScreenShot <TransitionSettingsUI.FullScanTab>("Full-scan settings", 3);

                RunUI(() =>
                {
                    Assert.AreEqual(FullScanPrecursorIsotopes.Count, transitionSettingsUI.PrecursorIsotopesCurrent);
                    Assert.AreEqual(20 * 1000, transitionSettingsUI.PrecursorRes);
                    Assert.AreEqual(FullScanMassAnalyzerType.tof, transitionSettingsUI.PrecursorMassAnalyzer);
                    Assert.AreEqual(IsolationScheme.SpecialHandlingType.ALL_IONS, transitionSettingsUI.IsolationSchemeName);
                    Assert.AreEqual(20 * 1000, transitionSettingsUI.ProductRes);
                    Assert.AreEqual(FullScanMassAnalyzerType.tof, transitionSettingsUI.ProductMassAnalyzer);
                });

                OkDialog(transitionSettingsUI, transitionSettingsUI.CancelDialog);
            }

            {
                var importResults = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                RunUI(() => importResults.ImportSimultaneousIndex = 2);

                PauseForScreenShot <ImportResultsDlg>("Import results form", 4);

                // Importing raw data from a sample which is a mixture of yeast and BSA

                var openDataSourceDialog = ShowDialog <OpenDataSourceDialog>(importResults.OkDialog);

                RunUI(() =>
                {
                    openDataSourceDialog.CurrentDirectory = new MsDataFilePath(DataPath);
                    openDataSourceDialog.SelectAllFileType(".d");
                });
                PauseForScreenShot <OpenDataSourceDialog>("Import results files", 5);

                OkDialog(openDataSourceDialog, openDataSourceDialog.Open);
            }

            string yeastReplicateName = Path.GetFileNameWithoutExtension(Yeast_BSA);

            PauseForScreenShot <AllChromatogramsGraph>("Importing results form", 6);

            WaitForDocumentChangeLoaded(document, 1000 * 60 * 60 * 10); // 10 minutes

            // Arrange graphs tiled
            RunUI(() =>
            {
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ShowSplitChromatogramGraph(true);
            });
            FindNode("R.FKDLGEEHFK.G");

            RunUI(() => SkylineWindow.Size = new Size(1075, 799));
            RestoreViewOnScreen(7);
            PauseForScreenShot("Zoomed split graph panes onely", 7);

            RunUI(() => SkylineWindow.AutoZoomNone());
            PauseForScreenShot("Unzoomed split graph panes onely", 8);

            RunUI(() =>
            {
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.ShowGraphPeakArea(true);
                SkylineWindow.ShowChromatogramLegends(false);
                SkylineWindow.ShowPeakAreaLegend(false);
                SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view);
                SkylineWindow.SynchronizeZooming(true);
                SkylineWindow.Size = new Size(1547, 855);
            });
            RestoreViewOnScreen(9);
            PauseForScreenShot("Full window", 9);

            FindNode("TCVADESHAGCEK");
            var noteDlg = ShowDialog <EditNoteDlg>(SkylineWindow.EditNote);

            RunUI(() => noteDlg.NoteText = "Lost in yeast samples");

            PauseForScreenShot("Peptide note", 10);
            OkDialog(noteDlg, noteDlg.OkDialog);

            FindNode("NECFLSHKDDSPDLPK");
            PauseForScreenShot("Yeast chromatograms and RT only - prtsc-paste-edit", 11);

            PauseForScreenShot("Hover over BSA in water chromatogram - prtsc-paste-edit", 12);

            RestoreViewOnScreen(13);
            PauseForScreenShot("Full scan 2D MS1 graph", 13);
            {
                const double clickTime1 = 41.06;
                ClickChromatogram(clickTime1, 1.62E+6, PaneKey.PRECURSORS);
                var fullScanGraph = FindOpenForm <GraphFullScan>();
                RunUI(() => fullScanGraph.SetSpectrum(false));
                PauseForScreenShot("Full scan 3D MS1 graph", 13);
                ValidateClickTime(fullScanGraph, clickTime1);

                RunUI(() => fullScanGraph.SetZoom(false));
                PauseForScreenShot("Full scan unzoomed 3D MS1 graph", 14);

                const double clickTime2 = 41.02;
                RunUI(() => fullScanGraph.SetZoom(true));
                ClickChromatogram(clickTime2, 5.8E+4, PaneKey.PRODUCTS);
                PauseForScreenShot("Full scan 3D MS/MS graph", 15);
                ValidateClickTime(fullScanGraph, clickTime2);

                RunUI(() => fullScanGraph.SetZoom(false));
                PauseForScreenShot("Full scan unzoomed 3D MS/MS graph", 14);

                const double clickTime3 = 41.48;
                ClickChromatogram(yeastReplicateName, clickTime3, 3.14E+4, PaneKey.PRODUCTS);
                PauseForScreenShot("Interference full scan unzoomed 3D MS/MS graph", 15);
                ValidateClickTime(fullScanGraph, clickTime3);

                RunUI(SkylineWindow.HideFullScanGraph);
            }

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, dlg =>
            {
                dlg.SelectedChromatograms = SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Skip(1);
                dlg.RemoveReplicates();
                dlg.OkDialog();
            });
            RunUI(() => SkylineWindow.SaveDocument());

            {
                var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Prediction);
                var          driftPredictor = ShowDialog <EditDriftTimePredictorDlg>(peptideSettingsUI.AddDriftTimePredictor);
                const string predictorName  = "BSA";
                RunUI(() =>
                {
                    driftPredictor.SetPredictorName(predictorName);
                    driftPredictor.SetResolvingPower(50);
                    driftPredictor.GetDriftTimesFromResults();
                });
                PauseForScreenShot("Edit predictor form", 18);

                OkDialog(driftPredictor, () => driftPredictor.OkDialog());

                PauseForScreenShot("Peptide Settings - Prediction", 19);

                RunUI(() =>
                {
                    Assert.IsTrue(peptideSettingsUI.IsUseMeasuredRT);
                    Assert.AreEqual(6, peptideSettingsUI.TimeWindow);
                    Assert.AreEqual(predictorName, peptideSettingsUI.SelectedDriftTimePredictor);
                });

                OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
            }

            {
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);
                RunUI(() =>
                {
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.FullScan;
                    transitionSettingsUI.SetRetentionTimeFilter(RetentionTimeFilterType.scheduling_windows, 3);
                });

                PauseForScreenShot("Transition Settings - Full-Scan", 20);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
            }

            using (new WaitDocumentChange(1, true, 1000 * 60 * 60 * 5))
            {
                var choosePredictionReplicates = ShowDialog <ChooseSchedulingReplicatesDlg>(SkylineWindow.ImportResults);
                PauseForScreenShot("Choose Replicates form", 21);

                RunUI(() => choosePredictionReplicates.SelectOrDeselectAll(true));
                var importResults = ShowDialog <ImportResultsDlg>(choosePredictionReplicates.OkDialog);
                RunDlg <OpenDataSourceDialog>(importResults.OkDialog, openDataSourceDialog =>
                {
                    openDataSourceDialog.CurrentDirectory = new MsDataFilePath(DataPath);
                    openDataSourceDialog.SelectAllFileType(Yeast_BSA);
                    openDataSourceDialog.Open();
                });
            }
            WaitForGraphs();

            // CONSIDER: Test the peak annotations to ensure the filtering happened

            PauseForScreenShot("Yeast chromatogram and RTs - prtsc-paste-edit", 22);

            {
                const double clickTime = 42.20;
                ClickChromatogram(yeastReplicateName, clickTime, 2.904E+4, PaneKey.PRODUCTS);
                var fullScanGraph = FindOpenForm <GraphFullScan>();
                RunUI(() => fullScanGraph.SetZoom(true));
                PauseForScreenShot("Full-scan graph zoomed", 23);
                RunUI(() => Assert.IsTrue(fullScanGraph.TitleText.Contains(clickTime.ToString(CultureInfo.CurrentCulture))));
                RunUI(SkylineWindow.HideFullScanGraph);
            }

            FindNode("FKDLGEEHFK");

            PauseForScreenShot("Chromatograms (copy metafile) and legend - prtsc-paste-edit", 23);

            PauseForScreenShot("Peak area percentages (copy metafile)", 24);

            var docFiltered = SkylineWindow.Document;

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageDlg =>
            {
                manageDlg.SelectedChromatograms = SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Take(1);
                manageDlg.ReimportResults();
                manageDlg.OkDialog();
            });

            WaitForDocumentChangeLoaded(docFiltered, 1000 * 60 * 60 * 5); // 5 minutes

            // TODO: Check peak ranks before and after
        }
예제 #22
0
        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);
        }
예제 #23
0
        protected override void DoTest()
        {
            // Skyline Targeted Method Refinement

            var folderMethodRefine = UseRawFiles ? "MethodRefine" : "MethodRefineMzml"; // Not L10N

            // Results Data, p. 2
            var doc = SkylineWindow.Document;

            RunUI(() => SkylineWindow.OpenFile(TestFilesDirs[1].GetTestPath(folderMethodRefine + @"\WormUnrefined.sky"))); // Not L10N
            WaitForDocumentChangeLoaded(doc);
            RunUI(() =>
            {
                // Adjust font sizes for better screen shots
                Settings.Default.ChromatogramFontSize = 14;
                Settings.Default.SpectrumFontSize     = 14;
                SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);

                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0];
                SkylineWindow.AutoZoomBestPeak();   // TODO: Mention this in the tutorial
                SkylineWindow.Size = new Size(1160, 660);

                Assert.AreEqual(SkylineWindow.SequenceTree.SelectedNode.Text, "YLGAYLLATLGGNASPSAQDVLK"); // Not L10N
            });
            PauseForScreenShot("Main window", 2);

            // TODO: Update tutorial to view b-ions.
            RunUI(() => SkylineWindow.GraphSpectrumSettings.ShowBIons = true);

            // Unrefined Methods, p. 3
            {
                var exportDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() =>
                {
                    exportDlg.ExportStrategy = ExportStrategy.Buckets;
                    exportDlg.MethodType     = ExportMethodType.Standard;
                    exportDlg.OptimizeType   = ExportOptimize.NONE;
                    exportDlg.MaxTransitions = 59;
                });
                PauseForScreenShot("Export Transition List form", 3);                                                       // Not L10N
                OkDialog(exportDlg, () => exportDlg.OkDialog(TestFilesDirs[1].GetTestPath(folderMethodRefine + @"\worm"))); // Not L10N
            }

            for (int i = 1; i < 10; i++)
            {
                Assert.IsTrue(File.Exists(TestFilesDirs[1].GetTestPath(folderMethodRefine + @"\worm_000" + i + TextUtil.EXT_CSV))); // Not L10N
            }
            for (int i = 10; i < 40; i++)
            {
                Assert.IsTrue(File.Exists(TestFilesDirs[1].GetTestPath(folderMethodRefine + @"\worm_00" + i + TextUtil.EXT_CSV))); // Not L10N
            }

            // Importing Multiple Injection Data, p. 4

            Assert.IsTrue(SkylineWindow.Document.Settings.HasResults);
            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageResultsDlg =>
            {
                manageResultsDlg.RemoveReplicates();
                Assert.AreEqual(manageResultsDlg.Chromatograms.ToArray().Length, 0);
                manageResultsDlg.OkDialog();
            });

            RunUI(() => SkylineWindow.SaveDocument());
            Assert.IsFalse(SkylineWindow.Document.Settings.HasResults);

            const string replicateName = "Unrefined"; // Not L10N

            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults, importResultsDlg =>
            {
                importResultsDlg.RadioAddNewChecked = true;
                var namedPathSets = DataSourceUtil.GetDataSourcesInSubdirs(TestFilesDirs[0].FullPath).ToArray();
                importResultsDlg.NamedPathSets =
                    new[] { new KeyValuePair <string, MsDataFileUri[]>(replicateName, namedPathSets[0].Value.Take(15).ToArray()) };
                importResultsDlg.OkDialog();
            });
            WaitForOpenForm <AllChromatogramsGraph>();                                                        // To make the AllChromatogramsGraph form accessible to the SkylineTester forms tab
            PauseForScreenShot <AllChromatogramsGraph>("Loading Chromatograms: Take screenshot at about 25% loaded...", 5);
            WaitForCondition(15 * 60 * 1000, () => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); // 15 minutes

            Assert.IsTrue(SkylineWindow.Document.Settings.HasResults);
            Assert.AreEqual(15, SkylineWindow.Document.Settings.MeasuredResults.CachedFilePaths.ToArray().Length);

            RunDlg <ImportResultsDlg>(SkylineWindow.ImportResults, importResultsDlg =>
            {
                importResultsDlg.RadioAddExistingChecked = true;
                var namedPathSets = DataSourceUtil.GetDataSourcesInSubdirs(TestFilesDirs[0].FullPath).ToArray();
                importResultsDlg.NamedPathSets =
                    new[] { new KeyValuePair <string, MsDataFileUri[]>(replicateName, namedPathSets[0].Value.Skip(15).ToArray()) };
                importResultsDlg.OkDialog();
            });
            WaitForCondition(20 * 60 * 1000, () => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);  // 15 minutes

            Assert.AreEqual(39, SkylineWindow.Document.Settings.MeasuredResults.CachedFilePaths.ToArray().Length);

            RunUI(SkylineWindow.AutoZoomNone);
            RestoreViewOnScreen(7);
            PauseForScreenShot("Chromatogram graph metafile", 7);

            // Simple Manual Refinement, p. 6
            int startingNodeCount = SkylineWindow.SequenceTree.Nodes[0].GetNodeCount(false);

            Assert.AreEqual("YLGAYLLATLGGNASPSAQDVLK", SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Text); // Not L10N

            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0];
                SkylineWindow.AutoZoomNone();
                SkylineWindow.AutoZoomBestPeak();
                SkylineWindow.EditDelete();
                SkylineWindow.ShowRTLinearRegressionGraph();
            });
            Assert.AreEqual(SkylineWindow.SequenceTree.Nodes[0].GetNodeCount(false), startingNodeCount - 1);
            Assert.AreEqual("VLEAGGLDCDMENANSVVDALK", SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Text); // Not L10N
            PauseForScreenShot("Retention Times Regression plot metafile", 8);

            RunDlg <RegressionRTThresholdDlg>(SkylineWindow.ShowRegressionRTThresholdDlg, rtThresholdDlg =>
            {
                rtThresholdDlg.Threshold = 0.95;
                rtThresholdDlg.OkDialog();
            });
            WaitForConditionUI(() => SkylineWindow.RTGraphController.RegressionRefined != null);
            WaitForGraphs();
            PauseForScreenShot("Retention Times Regression plot metafile with 0.95 threshold", 9); // Not L10N

            TestRTResidualsSwitch();

            RunDlg <EditRTDlg>(SkylineWindow.CreateRegression, editRTDlg => editRTDlg.OkDialog());

            RunUI(() => SkylineWindow.ShowGraphRetentionTime(false));
            RunUI(SkylineWindow.AutoZoomNone);
            PauseForScreenShot("Chromatogram graph metafile zoomed out", 10); // Not L10N

            // Missing Data, p. 10
            RunUI(() =>
            {
                SkylineWindow.RTGraphController.SelectPeptide(SkylineWindow.Document.GetPathTo(1, 163));
                Assert.AreEqual("YLAEVASEDR", SkylineWindow.SequenceTree.SelectedNode.Text);     // Not L10N
            });
            RestoreViewOnScreen(11);
            //  Restoring the view changes the selection
            RunUI(SkylineWindow.CollapsePeptides);
            FindNode("YLAEVASEDR");
            RunUI(() => SkylineWindow.SequenceTree.TopNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[153]);

            PauseForScreenShot("Targets view clipped from the main window", 11);

            RunUI(() =>
            {
                var nodePep = (PeptideDocNode)((SrmTreeNode)SkylineWindow.SequenceTree.SelectedNode).Model;
                Assert.AreEqual(null,
                                nodePep.GetPeakCountRatio(
                                    SkylineWindow.SequenceTree.GetDisplayResultsIndex(nodePep)));
                SkylineWindow.SequenceTree.SelectedPath = SkylineWindow.Document.GetPathTo(1, 157);
                Assert.AreEqual("VTVVDDQSVILK", SkylineWindow.SequenceTree.SelectedNode.Text);
            });
            WaitForGraphs();
            RunUI(() =>
            {
                SkylineWindow.ActivateReplicate("Unrefined");
                SkylineWindow.AutoZoomNone();
            });
            PauseForScreenShot("Unrefined chromatogram graph page clipped from main window", 12); // Not L10N

//            foreach (var peptideDocNode in SkylineWindow.Document.Peptides)
//            {
//                var nodeGroup = ((TransitionGroupDocNode)peptideDocNode.Children[0]);
//                Console.WriteLine("{0} - {1}", peptideDocNode.Peptide.Sequence,
//                    nodeGroup.GetDisplayText(SkylineWindow.SequenceTree.GetDisplaySettings(peptideDocNode)));
//            }
//            Console.WriteLine("---------------------------------");

            RunUI(() =>
            {
                var graphChrom = SkylineWindow.GetGraphChrom("Unrefined"); // Not L10N
                Assert.AreEqual(2, graphChrom.Files.Count);
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0];

                // Picking Measurable Peptides and Transitions, p. 12
                SkylineWindow.ExpandPeptides();
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0];
            });

            RunUI(SkylineWindow.AutoZoomBestPeak);
            RestoreViewOnScreen(13);
            RunUI(() => SkylineWindow.ShowGraphSpectrum(false));
            PauseForScreenShot("Targets view clipped from the main window and chromatogram graph metafile", 13);

            RunUI(() => SkylineWindow.ShowGraphSpectrum(true));
            PauseForScreenShot("Library Match plot metafile", 14);

            RunUI(() =>
            {
                SkylineWindow.ShowGraphSpectrum(false);
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Transitions, 0);
                SkylineWindow.SelectedNode.Expand();
                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
            });

            PauseForScreenShot("Targetes view clipped from the main window", 14); // Not L10N

            RunUI(() =>
            {
                double dotpExpect = Math.Round(Statistics.AngleToNormalizedContrastAngle(0.78), 2);  // 0.57
                AssertEx.Contains(SkylineWindow.SequenceTree.SelectedNode.Nodes[0].Text,
                                  dotpExpect.ToString(LocalizationHelper.CurrentCulture));
                SkylineWindow.EditDelete();

                dotpExpect = 0.34; // Math.Round(Statistics.AngleToNormalizedContrastAngle(0.633), 2);  // 0.44
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0];
                AssertEx.Contains(SkylineWindow.SequenceTree.SelectedNode.Nodes[0].Text,
                                  dotpExpect.ToString(LocalizationHelper.CurrentCulture));
                SkylineWindow.EditDelete();

                PeptideTreeNode nodePep;
                for (int i = 0; i < 2; i++)
                {
                    nodePep = (PeptideTreeNode)SkylineWindow.SequenceTree.Nodes[0].Nodes[i];
                    nodePep.ExpandAll();
                    foreach (TransitionTreeNode nodeTran in nodePep.Nodes[0].Nodes)
                    {
                        TransitionDocNode nodeTranDoc = (TransitionDocNode)nodeTran.Model;
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak,
                                        TransitionTreeNode.GetPeakImageIndex(nodeTranDoc,
                                                                             (PeptideDocNode)nodePep.Model,
                                                                             SkylineWindow.SequenceTree));
                        var resultsIndex = SkylineWindow.SequenceTree.GetDisplayResultsIndex(nodePep);
                        var rank         = nodeTranDoc.GetPeakRank(resultsIndex);
                        if (rank == null || rank > 3)
                        {
                            SkylineWindow.SequenceTree.SelectedNode = nodeTran;
                        }
                        SkylineWindow.SequenceTree.KeysOverride = Keys.Control;
                    }
                }
                nodePep = (PeptideTreeNode)SkylineWindow.SequenceTree.Nodes[0].Nodes[2];
                nodePep.ExpandAll();
                foreach (TransitionTreeNode nodeTran in nodePep.Nodes[0].Nodes)
                {
                    TransitionDocNode nodeTranDoc = (TransitionDocNode)nodeTran.Model;
                    Assert.AreEqual((int)SequenceTree.StateImageId.peak,
                                    TransitionTreeNode.GetPeakImageIndex(nodeTranDoc,
                                                                         (PeptideDocNode)nodePep.Model,
                                                                         SkylineWindow.SequenceTree));
                    var name = ((TransitionDocNode)nodeTran.Model).FragmentIonName;
                    if (!(name == "y11" || name == "y13" || name == "y14")) // Not L10N
                    {
                        SkylineWindow.SequenceTree.SelectedNode = nodeTran;
                    }
                    SkylineWindow.SequenceTree.KeysOverride = Keys.Control;
                }
                SkylineWindow.SequenceTree.KeysOverride = Keys.None;
                SkylineWindow.EditDelete();
                for (int i = 0; i < 3; i++)
                {
                    Assert.IsTrue(SkylineWindow.SequenceTree.Nodes[0].Nodes[i].Nodes[0].Nodes.Count == 3);
                }
                SkylineWindow.AutoZoomNone();

                SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Transitions, 5);
                SkylineWindow.Size         = new Size(722, 449);
            });

            RunUI(SkylineWindow.AutoZoomBestPeak);
            RestoreViewOnScreen(15);
            PauseForScreenShot("Targetes view clipped from main window and chromatogram graph metafile", 15);

            // Automated Refinement, p. 16
            RunDlg <RefineDlg>(SkylineWindow.ShowRefineDlg, refineDlg =>
            {
                refineDlg.MaxTransitionPeakRank = 3;
                refineDlg.PreferLargerIons      = true;
                refineDlg.RemoveMissingResults  = true;
                refineDlg.RTRegressionThreshold = 0.95;
                refineDlg.DotProductThreshold   = Statistics.AngleToNormalizedContrastAngle(0.95);  // Convert from original cos(angle) dot-product
                refineDlg.OkDialog();
            });
            WaitForCondition(() => SkylineWindow.Document.PeptideCount < 73);
//            foreach (var peptideDocNode in SkylineWindow.Document.Peptides)
//            {
//                var nodeGroup = ((TransitionGroupDocNode) peptideDocNode.Children[0]);
//                Console.WriteLine("{0} - {1}", peptideDocNode.Peptide.Sequence,
//                    nodeGroup.GetDisplayText(SkylineWindow.SequenceTree.GetDisplaySettings(peptideDocNode)));
//            }
            RunUI(() =>
            {
                Assert.AreEqual(72, SkylineWindow.Document.PeptideCount);
                Assert.AreEqual(216, SkylineWindow.Document.PeptideTransitionCount);
                SkylineWindow.CollapsePeptides();
                SkylineWindow.Undo();
            });
            RunDlg <RefineDlg>(SkylineWindow.ShowRefineDlg, refineDlg =>
            {
                refineDlg.MaxTransitionPeakRank = 6;
                refineDlg.RemoveMissingResults  = true;
                refineDlg.RTRegressionThreshold = 0.90;
                refineDlg.DotProductThreshold   = Statistics.AngleToNormalizedContrastAngle(0.90);  // Convert from original cos(angle) dot-product
                refineDlg.OkDialog();
            });

            WaitForCondition(() => SkylineWindow.Document.PeptideCount < 120);
            RunUI(() =>
            {
                Assert.AreEqual(113, SkylineWindow.Document.PeptideCount);

                // Scheduling for Efficient Acquisition, p. 17
                SkylineWindow.Undo();
            });

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, mResults =>
            {
                Assert.AreEqual(1, mResults.Chromatograms.Count());

                mResults.SelectedChromatograms =
                    SkylineWindow.Document.Settings.MeasuredResults.Chromatograms.Where(
                        set => Equals("Unrefined", set.Name)); // Not L10N

                mResults.RemoveReplicates();

                Assert.AreEqual(0, mResults.Chromatograms.Count());
                mResults.OkDialog();
            });

            var importResultsDlg0 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode           = SkylineWindow.SequenceTree.Nodes[0];
                importResultsDlg0.RadioCreateMultipleMultiChecked = true;
                importResultsDlg0.NamedPathSets =
                    DataSourceUtil.GetDataSourcesInSubdirs(Path.Combine(TestFilesDirs[1].FullPath,
                                                                        Path.GetFileName(TestFilesDirs[1].FullPath) ??
                                                                        string.Empty)).ToArray();
            });
            var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg0.OkDialog);

            RunUI(importResultsNameDlg.NoDialog);
            WaitForCondition(15 * 60 * 1000, () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); // 15 minutes

            var docCurrent = SkylineWindow.Document;

            RunUI(SkylineWindow.RemoveMissingResults);
            WaitForDocumentChange(docCurrent);
            Assert.AreEqual(86, SkylineWindow.Document.PeptideCount);
            Assert.AreEqual(255, SkylineWindow.Document.PeptideTransitionCount);

            TestRTResidualsSwitch();

            // Measuring Retention Times, p. 17
            {
                var exportDlg = ShowDialog <ExportMethodDlg>(() => SkylineWindow.ShowExportMethodDialog(ExportFileType.List));
                RunUI(() => exportDlg.MaxTransitions = 130);
                PauseForScreenShot <ExportMethodDlg.TransitionListView>("Export Transition List form", 18);
                OkDialog(exportDlg, () => exportDlg.OkDialog(TestFilesDirs[1].FullPath + "\\unscheduled")); // Not L10N
            }
            ///////////////////////

            // Reviewing Retention Time Runs, p. 18
            RunUI(() =>
            {
                SkylineWindow.ShowGraphSpectrum(false);
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.AutoZoomNone();
                SkylineWindow.AutoZoomBestPeak();
            });
            FindNode("FWEVISDEHGIQPDGTFK");

            RunUI(() => SkylineWindow.Size = new Size(1060, 550));
            RestoreViewOnScreen(19);
            PauseForScreenShot("Main window", 19); // Not L10N

            RunUI(() => SkylineWindow.ShowRTSchedulingGraph());
            WaitForCondition(() => SkylineWindow.GraphRetentionTime != null);

            PauseForScreenShot("Retention Times - Scheduling graph metafile", 19);

            RestoreViewOnScreen(20);

            // Creating a Scheduled Transition List, p. 20
            {
                var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() =>
                {
                    peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Prediction;
                    peptideSettingsUI.TimeWindow  = 4;
                });
                PauseForScreenShot <PeptideSettingsUI.PredictionTab>("Peptide Settings - Prediction tab", 21);
                OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog); // Not L10N
            }

            var exportMethodDlg1 = ShowDialog <ExportMethodDlg>(() =>
                                                                SkylineWindow.ShowExportMethodDialog(ExportFileType.List));

            RunUI(() =>
            {
                exportMethodDlg1.ExportStrategy = ExportStrategy.Single;
                exportMethodDlg1.MethodType     = ExportMethodType.Scheduled;
            });
            // TODO: Update tutorial to mention the scheduling options dialog.
            PauseForScreenShot("Export Transition List form", 22);                                              // Not L10N
            RunDlg <SchedulingOptionsDlg>(() =>
                                          exportMethodDlg1.OkDialog(TestFilesDirs[1].FullPath + "\\scheduled"), // Not L10N
                                          schedulingOptionsDlg => schedulingOptionsDlg.OkDialog());
            WaitForClosedForm(exportMethodDlg1);

            // Reviewing Multi-Replicate Data, p. 22
            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, manageResultsDlg =>
            {
                manageResultsDlg.RemoveAllReplicates();
                manageResultsDlg.OkDialog();
            });
            var importResultsDlg1 = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            RunDlg <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets = importResultsDlg1.GetDataSourcePathsFile(null),
                                          openDataSourceDialog =>
            {
                openDataSourceDialog.SelectAllFileType(ExtThermoRaw);
                openDataSourceDialog.Open();
            });
            RunDlg <ImportResultsNameDlg>(importResultsDlg1.OkDialog, importResultsNameDlg0 =>
            {
                importResultsNameDlg0.Prefix = "Scheduled_"; // Not L10N
                importResultsNameDlg0.YesDialog();
            });
            WaitForCondition(15 * 60 * 1000, () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); // 15 minutes
            Assert.AreEqual(5, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden));
            RunUI(() =>
            {
                SkylineWindow.RemoveMissingResults();
                SkylineWindow.ArrangeGraphsTiled();
                SkylineWindow.ShowGraphRetentionTime(false);
            });
            WaitForCondition(() => SkylineWindow.GraphRetentionTime.IsHidden);
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0];
                SkylineWindow.ShowRTReplicateGraph();
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.CollapsePeptides();
                SkylineWindow.ShowChromatogramLegends(false);
                SkylineWindow.Size = new Size(1024, 768);
            });
            RestoreViewOnScreen(24);
            WaitForGraphs();
            PauseForScreenShot("Main window", 24); // Not L10N

            RunUI(() => SkylineWindow.SaveDocument());
            RunUI(SkylineWindow.NewDocument);
        }
예제 #24
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.SetUIMode(SrmDocument.DOCUMENT_TYPE.small_molecules));

            // Inserting a Transition List, p. 2
            {
                var doc = SkylineWindow.Document;

                for (var retry = 0; retry < 2; retry++)
                {
                    var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPasteTransitionListDlg);

                    RunUI(() =>
                    {
                        pasteDlg.IsMolecule = true;
                        pasteDlg.SetSmallMoleculeColumns(null);  // Default columns
                        pasteDlg.Height = 290;
                    });
                    if (retry == 0)
                    {
                        PauseForScreenShot <PasteDlg>("Paste Dialog in small molecule mode, default columns - show Columns checklist", 3);
                    }


                    var columnsOrdered = new[]
                    {
                        // Prepare transition list insert window to match tutorial
                        // Molecule List Name,Precursor Name,Precursor Formula,Precursor Adduct,Label Type,Precursor m/z,Precursor Charge,Explicit Retention Time
                        SmallMoleculeTransitionListColumnHeaders.moleculeGroup,
                        SmallMoleculeTransitionListColumnHeaders.namePrecursor,
                        SmallMoleculeTransitionListColumnHeaders.formulaPrecursor,
                        SmallMoleculeTransitionListColumnHeaders.adductPrecursor,
                        SmallMoleculeTransitionListColumnHeaders.labelType,
                        SmallMoleculeTransitionListColumnHeaders.mzPrecursor,
                        SmallMoleculeTransitionListColumnHeaders.chargePrecursor,
                        SmallMoleculeTransitionListColumnHeaders.rtPrecursor,
                    }.ToList();
                    RunUI(() => { pasteDlg.SetSmallMoleculeColumns(columnsOrdered); });
                    TryWaitForConditionUI(() => pasteDlg.GetUsableColumnCount() == columnsOrdered.Count);
                    RunUI(() => AssertEx.AreEqualDeep(columnsOrdered, pasteDlg.GetColumnNames()));
                    if (retry == 0)
                    {
                        PauseForScreenShot <PasteDlg>("Paste Dialog with selected and ordered columns", 4);
                    }

                    var text = GetCsvFileText(GetTestPath("PUFA_TransitionList.csv"), true);
                    if (retry > 0)
                    {
                        // Fix bad charge declaration
                        var z    = string.Format("{0}1{0}", TextUtil.CsvSeparator);
                        var zneg = string.Format("{0}-1{0}", TextUtil.CsvSeparator);
                        text = text.Replace(z, zneg);
                    }
                    SetClipboardText(text);
                    RunUI(pasteDlg.PasteTransitions);
                    RunUI(pasteDlg.ValidateCells);
                    RunUI(() => pasteDlg.Height = 428);
                    if (retry == 0)
                    {
                        PauseForScreenShot <PasteDlg>("Paste Dialog with validated contents showing charge problem", 5);
                        OkDialog(pasteDlg, pasteDlg.CancelDialog);
                    }
                    else
                    {
                        PauseForScreenShot <PasteDlg>("Paste Dialog with validated contents", 6);
                        OkDialog(pasteDlg, pasteDlg.OkDialog);
                    }
                }
                var docTargets = WaitForDocumentChange(doc);

                AssertEx.IsDocumentState(docTargets, null, 1, 4, 7, 7);
                Assert.IsFalse(docTargets.MoleculeTransitions.Any(t => !t.Transition.IsPrecursor()));

                RunUI(() =>
                {
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                    SkylineWindow.Size = new Size(957, 654);
                    SkylineWindow.ExpandPeptides();
                });
                RestoreViewOnScreen(5);
                PauseForScreenShot <SkylineWindow>("Skyline with small molecule targets - show the right-click menu for setting DHA to be a surrogate standard", 7);

                // Set the standard type of the surrogate standards to StandardType.SURROGATE_STANDARD
                RunUI(() =>
                {
                    List <IdentityPath> pathsToSelect = SkylineWindow.SequenceTree.Nodes.OfType <PeptideGroupTreeNode>()
                                                        .SelectMany(peptideGroup => peptideGroup.Nodes.OfType <PeptideTreeNode>())
                                                        .Where(peptideTreeNode => peptideTreeNode.DocNode.RawTextId.Contains("(DHA)"))
                                                        .Select(treeNode => treeNode.Path)
                                                        .ToList();
                    SkylineWindow.SequenceTree.SelectedPaths = pathsToSelect;
                    SkylineWindow.SetStandardType(StandardType.SURROGATE_STANDARD);
                });


                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.SelectedPeptidesSmallMolsSubTab = 1;
                    transitionSettingsUI.SmallMoleculePrecursorAdducts   = Adduct.M_PLUS_H.AdductFormula;
                    transitionSettingsUI.SmallMoleculeFragmentAdducts    = Adduct.M_PLUS.AdductFormula;
                    transitionSettingsUI.SmallMoleculeFragmentTypes      =
                        TransitionFilter.SMALL_MOLECULE_FRAGMENT_CHAR + "," + TransitionFilter.PRECURSOR_ION_CHAR;
                    transitionSettingsUI.FragmentMassType = MassType.Monoisotopic;
                    transitionSettingsUI.SetAutoSelect    = true;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings -Filter tab", 9);


                RunUI(() =>
                {
                    // Full Scan Settings
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.FullScan;
                    transitionSettingsUI.PrecursorIsotopesCurrent = FullScanPrecursorIsotopes.Count;
                    transitionSettingsUI.Peaks = 2;
                    transitionSettingsUI.PrecursorMassAnalyzer   = FullScanMassAnalyzerType.orbitrap;
                    transitionSettingsUI.PrecursorRes            = 70000;
                    transitionSettingsUI.PrecursorResMz          = 200;
                    transitionSettingsUI.RetentionTimeFilterType = RetentionTimeFilterType.none;
                });
                PauseForScreenShot <TransitionSettingsUI.PredictionTab>("Transition Settings -Full Scan tab", 10);

                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(docTargets);

                RunUI(() => SkylineWindow.SaveDocument(GetTestPath("FattyAcids_demo.sky")));

                using (new WaitDocumentChange(1, true))
                {
                    var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
                    var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                                      importResultsDlg1.GetDataSourcePathsFile(null));
                    RunUI(() =>
                    {
                        openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(Path.Combine(TestFilesDirs.First().PersistentFilesDir, GetDataFolder()));
                        openDataSourceDialog1.SelectAllFileType(ExtWatersRaw);
                    });
                    PauseForScreenShot <OpenDataSourceDialog>("Import Results Files form", 11);
                    OkDialog(openDataSourceDialog1, openDataSourceDialog1.Open);

                    OkDialog(importResultsDlg1, importResultsDlg1.OkDialog);
                }

                SelectNode(SrmDocument.Level.Molecules, 0);
                SelectNode(SrmDocument.Level.MoleculeGroups, 0);

                PauseForScreenShot <SkylineWindow>("Skyline window multi-target graph", 12);

                var docResults = SkylineWindow.Document;

                var expectedTransCount = new Dictionary <string, int[]>
                {
                    // peptides, transition groups, heavy transition groups, tranistions, heavy transitions
                    { "default", new[] { 4, 4, 3, 8, 6 } }, // Most have these values
                    { "ID31609_01_E749_4745_091517", new[] { 4, 4, 3, 7, 6 } },
                };
                var msg = "";
                foreach (var chromatogramSet in docResults.Settings.MeasuredResults.Chromatograms)
                {
                    int[] transitions;
                    if (!expectedTransCount.TryGetValue(chromatogramSet.Name, out transitions))
                    {
                        transitions = expectedTransCount["default"];
                    }
                    try
                    {
                        AssertResult.IsDocumentResultsState(docResults, chromatogramSet.Name, transitions[0], transitions[1], transitions[2], transitions[3], transitions[4]);
                    }
                    catch (Exception x)
                    {
                        msg += TextUtil.LineSeparate(x.Message);
                    }
                }
                if (!string.IsNullOrEmpty(msg))
                {
                    Assert.IsTrue(string.IsNullOrEmpty(msg), msg);
                }
                RestoreViewOnScreen(9);
                var documentGrid = FindOpenForm <DocumentGridForm>();
                if (documentGrid == null)
                {
                    // When running offscreen, can't depend on RestoreViewOnScreen to open document grid
                    RunUI(() => SkylineWindow.ShowDocumentGrid(true));
                    documentGrid = FindOpenForm <DocumentGridForm>();
                }
                if (!IsCoverShotMode)
                {
                    RunUI(() => documentGrid.ChooseView(Resources.Resources_ReportSpecList_GetDefaults_Peptide_Quantification));
                }
                else
                {
                    RunUI(() => documentGrid.DataboundGridControl.ChooseView(new ViewName(ViewGroup.BUILT_IN.Id,
                                                                                          Resources.SkylineViewContext_GetDocumentGridRowSources_Molecules)));
                }
                PauseForScreenShot <SkylineWindow>("Skyline window multi-replicate layout", 13);

                if (IsCoverShotMode)
                {
                    RunUI(() =>
                    {
                        Settings.Default.ChromatogramFontSize = 14;
                        Settings.Default.AreaFontSize         = 14;
                        SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                        SkylineWindow.AutoZoomBestPeak();
                        SkylineWindow.ShowPeakAreaLegend(false);
                        SkylineWindow.ShowRTLegend(false);
                    });

                    RestoreCoverViewOnScreen();

                    RunUI(SkylineWindow.FocusDocument);

                    ClickChromatogram("GW2_01", 1.148979, 209663764);

                    // TODO: This doesn't exactly reproduce the screen shot. The profile curve does not get adjusted.
                    RunUI(() => ZoomXAxis(SkylineWindow.GraphFullScan.ZedGraphControl, 332.25, 332.28));
                    RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.PrevNode);
                    WaitForGraphs();
                    RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.NextNode);
                    WaitForGraphs();

                    TakeCoverShot();
                    return;
                }

                using (new WaitDocumentChange(1, true))
                {
                    // Quant settings
                    var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

                    RunUI(() =>
                    {
                        peptideSettingsUI.SelectedTab              = PeptideSettingsUI.TABS.Quantification - 2;
                        peptideSettingsUI.QuantRegressionFit       = RegressionFit.LINEAR_THROUGH_ZERO;
                        peptideSettingsUI.QuantNormalizationMethod =
                            new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                        peptideSettingsUI.QuantRegressionWeighting = RegressionWeighting.NONE;
                        peptideSettingsUI.QuantMsLevel             = null; // All
                        peptideSettingsUI.QuantUnits = "uM";
                    });

                    PauseForScreenShot <PeptideSettingsUI.QuantificationTab>("Peptide Settings - Quantitation", 14);
                    OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);
                }

                var documentGrid2 = FindOpenForm <DocumentGridForm>();
                RunUI(() =>
                {
                    documentGrid2.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates);
                });
                WaitForConditionUI(() => (documentGrid2.RowCount == 16)); // Let it initialize

                RunUI(() =>
                {
                    var gridView = documentGrid2.DataGridView;
                    for (var index = 0; index < gridView.Rows.Count; index++)
                    {
                        var row = gridView.Rows[index];
                        if (row.Cells[0].Value.ToString().StartsWith("NIST"))
                        {
                            row.Cells[1].Value = SampleType.STANDARD;
                            row.Cells[2].Value = 1.0;
                        }
                        else if (row.Cells[0].Value.ToString().StartsWith("GW"))
                        {
                            row.Cells[1].Value = SampleType.QC;
                        }
                    }
                });
                // Make sure the edits have flowed to the document
                WaitForConditionUI(() => SkylineWindow.DocumentUI.Settings.MeasuredResults.Chromatograms.Where(c => c.Name.StartsWith("GW")).All(c => c.SampleType.Equals(SampleType.QC)));
                PauseForScreenShot <DocumentGridForm>("Document Grid - replicates", 15);

                // Finish setting up quant
                var documentGrid3 = FindOpenForm <DocumentGridForm>();
                RunUI(() =>
                {
                    documentGrid3.ChooseView(Resources.Resources_ReportSpecList_GetDefaults_Peptide_Quantification);
                });
                WaitForConditionUI(() => (documentGrid3.RowCount > 0 &&
                                          documentGrid3.ColumnCount > 6)); // Let it initialize

                RunUI(() =>
                {
                    var gridView = documentGrid3.DataGridView;
                    var methods  = ((DataGridViewComboBoxCell)gridView.Rows[0].Cells[6]).Items;
                    var ratioToSurrogateHeavyDHA    = ((Tuple <String, NormalizationMethod>)methods[6]).Item2;
                    gridView.Rows[0].Cells[5].Value = 2838.0;
                    gridView.Rows[1].Cells[5].Value = 54.0;
                    gridView.Rows[1].Cells[6].Value = ratioToSurrogateHeavyDHA;
                    gridView.Rows[2].Cells[5].Value = 984.0;
                    gridView.Rows[3].Cells[5].Value = 118.0;
                });

                PauseForScreenShot <DocumentGridForm>("Document Grid - peptide quant again", 15);

                RunUI(() => SkylineWindow.ShowCalibrationForm());
                SelectNode(SrmDocument.Level.Molecules, 0);
                WaitForGraphs();
                PauseForScreenShot <DocumentGridForm>("Calibration curve", 16);
            }
        }