Пример #1
0
        public void TestDocumentWithOneLabel()
        {
            var           assembly = typeof(ReportSpecConverterTest).Assembly;
            XmlSerializer ser      = new XmlSerializer(typeof(SrmDocument));
            // ReSharper disable once AssignNullToNotNullAttribute
            var docWithLabel = (SrmDocument)ser.Deserialize(
                assembly.GetManifestResourceStream(typeof(ReportSpecConverterTest), "HeavyLabeledLeucine.sky"));

            CheckReportCompatibility.CheckAll(docWithLabel);
        }
Пример #2
0
        public void TestCustomReportsCompatibility()
        {
            var myType   = typeof(MultiLabelRatioTest);
            var document = ResultsUtil.DeserializeDocument("MultiLabel.sky", myType);
            // ReSharper disable once AssignNullToNotNullAttribute
            var customReports = (ReportSpecList) new XmlSerializer(typeof(ReportSpecList)).Deserialize(
                myType.Assembly.GetManifestResourceStream(myType, "MultiLabelCustomReports.skyr"));

            Assert.AreNotEqual(0, customReports.Count);
            using (var checkReportCompatibility = new CheckReportCompatibility(document))
            {
                checkReportCompatibility.CheckAll();
                foreach (var customReport in customReports)
                {
                    checkReportCompatibility.CheckReport(customReport);
                }
            }
        }
Пример #3
0
        public void TestConverted()
        {
            var           assembly           = typeof(LiveReportPivotTest).Assembly;
            XmlSerializer documentSerializer = new XmlSerializer(typeof(SrmDocument));
            // ReSharper disable once AssignNullToNotNullAttribute
            var document = (SrmDocument)documentSerializer.Deserialize(
                assembly.GetManifestResourceStream(typeof(ReportSpecConverterTest), "silac_1_to_4.sky"));
            XmlSerializer reportSerializer = new XmlSerializer(typeof(ReportSpecList));
            // ReSharper disable once AssignNullToNotNullAttribute
            var reports = (ReportSpecList)
                          reportSerializer.Deserialize(assembly.GetManifestResourceStream(typeof(ReportSpecConverterTest),
                                                                                          "ResultSummaryPivot.skyr"));

            Assert.AreNotEqual(0, reports.Count);
            using (var checker = new CheckReportCompatibility(document))
            {
                foreach (var report in reports)
                {
                    checker.CheckReport(report);
                }
            }
        }
Пример #4
0
        public void TestPivotIsotopeLabel()
        {
            var           assembly           = typeof(ReportSpecConverterTest).Assembly;
            XmlSerializer documentSerializer = new XmlSerializer(typeof(SrmDocument));
            // ReSharper disable once AssignNullToNotNullAttribute
            var docWithLabel = (SrmDocument)documentSerializer.Deserialize(
                assembly.GetManifestResourceStream(typeof(ReportSpecConverterTest), "HeavyLabeledLeucine.sky"));
            XmlSerializer reportSerializer = new XmlSerializer(typeof(ReportSpecList));
            // ReSharper disable once AssignNullToNotNullAttribute
            var reports = (ReportSpecList)
                          reportSerializer.Deserialize(assembly.GetManifestResourceStream(typeof(ReportSpecConverterTest),
                                                                                          "PivotIsotopeLabel.skyr"));

            Assert.AreNotEqual(0, reports.Count);
            using (var checker = new CheckReportCompatibility(docWithLabel))
            {
                foreach (var report in reports)
                {
                    checker.CheckReport(report);
                }
            }
        }
        private void DoStudy7Test()
        {
            // Preparing a Document to Accept the Study 7 Transition List, p. 15
            RunUI(() => SkylineWindow.NewDocument());
            var peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            var mod13Cr            = new StaticMod("Label:13C(6) (C-term R)", "R", ModTerminus.C, false, null, LabelAtoms.C13,
                                                   RelativeRT.Matching, null, null, null);

            AddHeavyMod(mod13Cr, peptideSettingsUI1, "Edit Isotope Modification form", 17);
            RunUI(() =>
            {
                peptideSettingsUI1.PickedHeavyMods            = new[] { "Label:13C(6) (C-term R)", HEAVY_K };
                peptideSettingsUI1.PickedLibraries            = new[] { "" };
                peptideSettingsUI1.SelectedBackgroundProteome = Resources.SettingsList_ELEMENT_NONE_None;
                peptideSettingsUI1.OkDialog();
            });

            // Pasting a Transition List into the Document, p. 18.
            string clipboardSaveText = string.Empty;

            RunUI(() =>
            {
                var filePath = GetTestPath(@"Study 7\Study7 transition list.xls");
                SetExcelFileClipboardText(filePath, "Simple", 6, false);
                clipboardSaveText = ClipboardEx.GetText();
            });

            {
                var messageDlg = ShowDialog <ImportTransitionListErrorDlg>(SkylineWindow.Paste);
                PauseForScreenShot <ImportTransitionListErrorDlg>("Error message form (expected)", 18);
                OkDialog(messageDlg, messageDlg.CancelDialog);

                // Restore the clipboard text after pausing
                ClipboardEx.SetText(clipboardSaveText);
            }

            RunDlg <TransitionSettingsUI>(() => SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Instrument), transitionSettingsUI =>
            {
                transitionSettingsUI.InstrumentMaxMz = 1800;
                transitionSettingsUI.OkDialog();
            });
            RunUI(() =>
            {
                SkylineWindow.Paste();
                SkylineWindow.CollapsePeptides();
            });
            PauseForScreenShot("Targets tree (selected from main window)", 19);

            // Adjusting Modifications Manually, p. 19.
            AdjustModifications("AGLCQTFVYGGCR", true, 'V', 747.348);
            PauseForScreenShot("Target tree clipped from main window", 22);

            AdjustModifications("IVGGWECEK", true, 'V', 541.763);
            AdjustModifications("YEVQGEVFTKPQLWP", false, 'L', 913.974);
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"Study 7\Study7.sky")));

            // Importing Data from a Multiple Sample WIFF file, p. 23.
            var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
            var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                              importResultsDlg1.GetDataSourcePathsFile(null));

            RunUI(() =>
            {
                openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Study 7"));
                openDataSourceDialog1.SelectAllFileType(IsFullData ? ".wiff" : ExtensionTestContext.ExtAbWiff); // Force true wiff for FullData
            });
            if (UseRawFilesOrFullData)
            {
                var importResultsSamplesDlg = ShowDialog <ImportResultsSamplesDlg>(openDataSourceDialog1.Open);
                PauseForScreenShot <ImportResultsSamplesDlg>("Choose Samples form", 23);

                RunUI(() =>
                {
                    if (IsFullData)
                    {
                        importResultsSamplesDlg.CheckAll(true);
                        importResultsSamplesDlg.ExcludeSample(0);           // Blank
                        importResultsSamplesDlg.ExcludeSample(25);          // QC
                        importResultsSamplesDlg.ExcludeSample(26);
                        importResultsSamplesDlg.ExcludeSample(27);
                        importResultsSamplesDlg.ExcludeSample(28);
                        importResultsSamplesDlg.ExcludeSample(45);           // A2
                        importResultsSamplesDlg.ExcludeSample(46);
                        importResultsSamplesDlg.ExcludeSample(47);
                        importResultsSamplesDlg.ExcludeSample(48);
                        importResultsSamplesDlg.ExcludeSample(49);           // gradientwash
                        importResultsSamplesDlg.ExcludeSample(50);
                        importResultsSamplesDlg.ExcludeSample(51);
                        importResultsSamplesDlg.ExcludeSample(52);
                        importResultsSamplesDlg.ExcludeSample(53);           // A3
                        importResultsSamplesDlg.ExcludeSample(54);
                        importResultsSamplesDlg.ExcludeSample(55);
                        importResultsSamplesDlg.ExcludeSample(56);
                    }
                    else
                    {
                        importResultsSamplesDlg.CheckAll(false);
                        importResultsSamplesDlg.IncludeSample(1);
                        importResultsSamplesDlg.IncludeSample(2);
                        importResultsSamplesDlg.IncludeSample(11);
                        importResultsSamplesDlg.IncludeSample(12);
                    }
                });
                OkDialog(importResultsSamplesDlg, importResultsSamplesDlg.OkDialog);
            }
            else
            {
                RunUI(openDataSourceDialog1.Open);
            }

            {
                var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                PauseForScreenShot <ImportDocResultsDlg>("Import Results Common prefix form", 24);

                OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);
            }
            WaitForCondition(() =>
                             SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            RestoreViewOnScreen(25);

            // Inspecting and Adjusting Peak Integration, p. 24.
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.ShowGraphRetentionTime(true);
            });

            if (!IsPauseForScreenShots && !IsFullData)
            {
                TestApplyToAll();
            }

            PauseForScreenShot <GraphSummary.RTGraphView>("Main window with peaks and retention times showing", 25);
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
            RunUI(SkylineWindow.EditDelete);
            FindNode("IVGGWECEK"); // Not L10N

            TransitionGroupTreeNode selNodeGroup = null;

            RunUI(() =>
            {
                selNodeGroup = (TransitionGroupTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[1];
                Assert.AreEqual(selNodeGroup.StateImageIndex, (int)SequenceTree.StateImageId.peak_blank);
            });
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI =>
            {
                transitionSettingsUI.MZMatchTolerance = 0.065;
                transitionSettingsUI.OkDialog();
            });
            RunUI(() =>
            {
                Assert.AreEqual((int)SequenceTree.StateImageId.peak, selNodeGroup.StateImageIndex);
                SkylineWindow.ToggleIntegrateAll();
            });
            RunUI(() =>
            {
                foreach (PeptideDocNode nodePep in SkylineWindow.Document.Molecules)
                {
                    string sequence = nodePep.Peptide.Sequence;
                    int imageIndex  = PeptideTreeNode.GetPeakImageIndex(nodePep, SkylineWindow.SequenceTree);
                    if ((sequence != null) && (sequence.StartsWith("YLA") || sequence.StartsWith("YEV"))) // Not L10N
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.keep, imageIndex,
                                        string.Format("Expected keep icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else if (sequence != null)
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak, imageIndex,
                                        string.Format("Expected peak icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else // Custom Ion
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak_blank, imageIndex,
                                        string.Format("Expected peak_blank icon for the custom ion {0}, found {1}", nodePep.ModifiedTarget, imageIndex));
                    }
                }
            });
            PauseForScreenShot("Main window", 27);

            // Data Inspection with Peak Areas View, p. 27.
            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(NormalizeGraphToHeavy);
            RestoreViewOnScreen(28);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 28);

            FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++"); // ESDTSYVSLK - Not L10N
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 29);

            RunUI(SkylineWindow.ExpandPeptides);
            string hgflprLight = (363.7059).ToString(LocalizationHelper.CurrentCulture) + "++";  // HGFLPR - Not L10N

            FindNode(hgflprLight);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 30);

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view));
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph normalized metafile", 31);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            RunUI(() => SkylineWindow.ActivateReplicate("E_03"));
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile with interference", 31);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(true));
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowTotalTransitions();
                SkylineWindow.ShowCVValues(true);
                SkylineWindow.ShowPeptideOrder(SummaryPeptideOrder.document);
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Peptide Comparison graph metafile", 32);

            // Annotating replicates with concentration values
            var chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            var editListDlg          = ShowDialog <EditListDlg <SettingsListBase <AnnotationDef>, AnnotationDef> >(chooseAnnotationsDlg.EditAnnotationList);

            RunUI(editListDlg.ResetList);
            var defineAnnotationDlg = ShowDialog <DefineAnnotationDlg>(editListDlg.AddItem);

            RunUI(() =>
            {
                defineAnnotationDlg.AnnotationName    = "Concentration";
                defineAnnotationDlg.AnnotationType    = AnnotationDef.AnnotationType.number;
                defineAnnotationDlg.AnnotationTargets = AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.replicate);
            });
            PauseForScreenShot <DefineAnnotationDlg>("Define Annotation form", 33);
            OkDialog(defineAnnotationDlg, defineAnnotationDlg.OkDialog);
            OkDialog(editListDlg, () => editListDlg.DialogResult = DialogResult.OK);
            RunUI(() => chooseAnnotationsDlg.AnnotationsCheckedListBox.SetItemChecked(0, true));
            PauseForScreenShot <DocumentSettingsDlg>("Annotation Settings form", 34);
            OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.OkDialog);
            RunUI(() => SkylineWindow.ShowResultsGrid(true));
            RunUI(() =>
            {
                SkylineWindow.SelectedPath =
                    SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.MoleculeGroups, 0);
            });
            WaitForGraphs();
            WaitForConditionUI(() => FindOpenForm <LiveResultsGrid>().IsComplete);
            RunUI(() =>
            {
                Settings.Default.ResultsGridSynchSelection = false;
                var resultsGrid      = FindOpenForm <LiveResultsGrid>().DataGridView;
                var colConcentration =
// ReSharper disable LocalizableElement
                    resultsGrid.Columns.Cast <DataGridViewColumn>().First(col => "Concentration" == col.HeaderText); // Not L10N
// ReSharper restore LocalizableElement
                if (IsFullData)
                {
                    float[] concentrations = { 0f, 60, 175, 513, 1500, 2760, 4980, 9060, 16500, 30000 };
                    for (int i = 0; i < concentrations.Length; i++)
                    {
                        for (int j = i * 4; j < (i + 1) * 4; j++)
                        {
                            SetCellValue(resultsGrid, j, colConcentration.Index, concentrations[i]);
                        }
                    }
                }
                else
                {
                    SetCellValue(resultsGrid, 0, colConcentration.Index, 0f);
                    SetCellValue(resultsGrid, 1, colConcentration.Index, 0f);
                    SetCellValue(resultsGrid, 2, colConcentration.Index, 175f);
                    SetCellValue(resultsGrid, 3, colConcentration.Index, 175f);
                }
            });
            WaitForGraphs();
            PauseForScreenShot <LiveResultsGrid>("Results grid with annotations (scrolled to the end)", 35);

            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.GroupByReplicateAnnotation("Concentration");
                NormalizeGraphToHeavy();
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph with CVs metafile", 36);

            RunUI(() => SkylineWindow.ShowCVValues(false));
            RunUI(() => SkylineWindow.SaveDocument());
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph grouped by concentration metafile", 36);
            PauseForAuditLog();
            // Further Exploration, p. 33.
            RunUI(() =>
            {
                SkylineWindow.OpenFile(GetTestPath(@"Study 7\Study II\Study 7ii (site 52).sky")); // Not L10N
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowCVValues(true);
            });
            WaitForCondition(() => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas peptide comparison graph metafile", 37);
            FindNode("LSEPAELTDAVK");
            RunUI(SkylineWindow.ShowRTReplicateGraph);
            PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times replicate graph metafile", 38);

            FindNode("INDISHTQSVSAK");
            RunUI(SkylineWindow.ShowPeakAreaReplicateComparison);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas normalized to heave graph metafile", 38);

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.none));
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas no normalization graph metafile", 39);

            FindNode(hgflprLight);
            RunUI(() =>
            {
                SkylineWindow.ShowAllTransitions();
                NormalizeGraphToHeavy();
            });
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Area Ratio to Heavy graph showing interference metafile", 40);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            RunUI(() => SkylineWindow.ActivateReplicate("E_ 03"));
            WaitForGraphs();
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile showing slight interference", 40);
        }
Пример #6
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);
        }
Пример #7
0
        protected void DoLiveReportsTest()
        {
            var chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            var editListDlg          = ShowDialog <EditListDlg <SettingsListBase <AnnotationDef>, AnnotationDef> >(chooseAnnotationsDlg.EditAnnotationList);

            // Define the annotations that we are going to be using in this test.
            RunUI(editListDlg.ResetList);
            DefineAnnotation(editListDlg, ANNOTATION_PROTEIN_TEXT, AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.protein), AnnotationDef.AnnotationType.text, null);
            DefineAnnotation(editListDlg, "peptide Items", AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.peptide),
                             AnnotationDef.AnnotationType.value_list, new[] { "one", "two", "three" });
            DefineAnnotation(editListDlg, "precursor 'True' 'False'", AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.precursor),
                             AnnotationDef.AnnotationType.true_false, null);
            DefineAnnotation(editListDlg, "transition_Text", AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.transition),
                             AnnotationDef.AnnotationType.text, null);
            DefineAnnotation(editListDlg, ANNOTATION_REPLICATE, AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.replicate),
                             AnnotationDef.AnnotationType.text, null);
            DefineAnnotation(editListDlg, ANNOTATION_PRECURSOR_RESULTS_ITEMS, AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.precursor_result),
                             AnnotationDef.AnnotationType.value_list, new[] { "a", "b", "c" });
            DefineAnnotation(editListDlg, ANNOTATION_TRANSITION_RESULT, AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.transition_result),
                             AnnotationDef.AnnotationType.true_false, null);
            DefineAnnotation(editListDlg, "\"all\"",
                             AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.protein),
                             AnnotationDef.AnnotationType.text, null);
            DefineAnnotation(editListDlg, ANNOTATION_PRECURSOR_TRANSITION_RESULT,
                             AnnotationDef.AnnotationTargetSet.OfValues(
                                 AnnotationDef.AnnotationTarget.precursor_result,
                                 AnnotationDef.AnnotationTarget.transition_result),
                             AnnotationDef.AnnotationType.text,
                             new[] { "x", "y", "z" });
            OkDialog(editListDlg, () => editListDlg.DialogResult = DialogResult.OK);
            OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.Close);
            // Open the .sky file
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("CE_Vantage_15mTorr_scheduled_mini_missing_results.sky")));
            // Turn on the annotations
            chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            RunUI(() =>
            {
                var checkedListBox = chooseAnnotationsDlg.AnnotationsCheckedListBox;
                for (int i = 0; i < checkedListBox.Items.Count; i++)
                {
                    checkedListBox.SetItemChecked(i, true);
                }
            });
            OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.OkDialog);
            // Edit the _note_ on the root node.
            var editNoteDlg = ShowDialog <EditNoteDlg>(SkylineWindow.EditNote);

            Assert.IsNull(SkylineWindow.Document.PeptideGroups.First().Annotations.GetAnnotation(ANNOTATION_PROTEIN_TEXT));
            RunUI(() => SetAnnotationValue(editNoteDlg, ANNOTATION_PROTEIN_TEXT, "proteinTextValue"));
            OkDialog(editNoteDlg, () => editNoteDlg.DialogResult = DialogResult.OK);
            Assert.AreEqual("proteinTextValue",
                            SkylineWindow.Document.PeptideGroups.First().Annotations.GetAnnotation(ANNOTATION_PROTEIN_TEXT));
            // Show the ResultsGrid
            var resultsGridForm = ShowDialog <LiveResultsGrid>(() => SkylineWindow.ShowResultsGrid(true));
            var resultsGrid     = resultsGridForm.DataGridView;

            RunUI(() =>
            {
                SkylineWindow.SequenceTree.Nodes[0].Expand();
                SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Expand();
                SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0].Expand();
            });
            // Select the first Precursor in the SequenceTree
            var precursorTreeNode = (SrmTreeNode)SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0];

            RunUI(() => SkylineWindow.SequenceTree.SelectedNode = precursorTreeNode);
            var chromInfo = ((TransitionGroupDocNode)precursorTreeNode.Model).Results[0][0];

            Assert.IsNull(chromInfo.Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));
            WaitForGraphPanesToUpdate();
            // Show the "precursorResultItems" annotation column
            RunDlg <ViewEditor>(resultsGridForm.NavBar.CustomizeView,
                                viewEditor =>
            {
                Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX + ANNOTATION_PRECURSOR_RESULTS_ITEMS)));
                viewEditor.ViewName = "PrecursorResults1";
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
                viewEditor.OkDialog();
            });
            WaitForConditionUI(() => resultsGridForm.IsComplete);
            // Set the annotation value on the first two rows in the ResultsGrid.
            // The annotation is a dropdown with values {blank, "a", "b", "c"}
            DataGridViewCell cell;

            RunUI(() =>
            {
                var colPrecursorResultsItems = resultsGridForm.FindColumn(
                    PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX + ANNOTATION_PRECURSOR_RESULTS_ITEMS));
                cell = resultsGrid.Rows[0].Cells[colPrecursorResultsItems.Index];
                resultsGrid.CurrentCell = cell;
                resultsGrid.BeginEdit(true);
                ((ComboBox)resultsGrid.EditingControl).SelectedIndex = 2;
                Assert.IsTrue(resultsGrid.EndEdit());
                Assert.AreEqual("b", ((TransitionGroupDocNode)precursorTreeNode.Model).Results[0][0]
                                .Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));
            });
            cell = null;
            RunUI(() =>
            {
                var colPrecursorResultsItems = resultsGridForm.FindColumn(
                    PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX + ANNOTATION_PRECURSOR_RESULTS_ITEMS));
                cell = resultsGrid.Rows[1].Cells[colPrecursorResultsItems.Index];
                resultsGrid.CurrentCell = cell;
                resultsGrid.BeginEdit(true);
                ((ComboBox)resultsGrid.EditingControl).SelectedIndex = 1;
                Assert.IsTrue(resultsGrid.EndEdit());
                Assert.AreEqual("b", ((TransitionGroupDocNode)precursorTreeNode.Model).Results[0][0]
                                .Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));
                Assert.AreEqual("a", ((TransitionGroupDocNode)precursorTreeNode.Model).Results[0][1]
                                .Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));
            });

            // Assert that the annotations have their new values.
            var precursorDocNode = ((TransitionGroupDocNode)precursorTreeNode.Model);

            Assert.AreEqual("b", precursorDocNode.Results[0][0]
                            .Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));
            Assert.AreEqual("a", precursorDocNode.Results[0][1]
                            .Annotations.GetAnnotation(ANNOTATION_PRECURSOR_RESULTS_ITEMS));

            // Test multiselect here.
            RunUI(() =>
            {
                var colPrecursorTransitionResult = resultsGridForm.FindColumn(PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX +
                                                                                                         ANNOTATION_PRECURSOR_TRANSITION_RESULT));
                // Annotations applying to transitions as well as precursors should be visible.
                cell = resultsGrid.Rows[0].Cells[colPrecursorTransitionResult.Index];
                Assert.IsTrue(cell.Visible);
                // Select a transition node in addition to the precursor node already selected.
                SkylineWindow.SequenceTree.KeysOverride = Keys.Control;
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0].Nodes[0];
                SkylineWindow.SequenceTree.KeysOverride = Keys.None;
            });
            WaitForGraphPanesToUpdate();
// TODO(nicksh): The LiveResultsGrid does not support changing annotation values when more than one
// type of DocNode is selected (e.g. Precursors and Transitions).  The old ResultsGrid would let you
// see and change annotation values that applied to both precursors and transitions.
#if false
            RunUI(() =>
            {
                var findTransitionResultColumn =
                    new Func <DataGridViewColumn, bool>(col => col.HeaderText == ANNOTATION_TRANSITION_RESULT);
                const string annotationTestText = "Test";
                // Annotations applying to transitions will not be available
                Assert.IsFalse(resultsGrid.Columns.Cast <DataGridViewColumn>().Any(findTransitionResultColumn));

                var colPrecursorTransitionResult = resultsGridForm.FindColumn(
                    PropertyPath.Root.Property(AnnotationDef.ANNOTATION_PREFIX +
                                               ANNOTATION_PRECURSOR_TRANSITION_RESULT));
                cell = resultsGrid.Rows[0].Cells[colPrecursorTransitionResult.Index];
                // Annotations applying to both precursors and transitions should still be
                // visible.
                Assert.IsTrue(cell.Visible);

                // Set value for that annotation.
                resultsGrid.CurrentCell = cell;
                resultsGrid.BeginEdit(true);
                resultsGrid.EditingControl.Text = annotationTestText;
                resultsGrid.EndEdit();
                var colTransitionResult = resultsGrid.Columns.Cast <DataGridViewColumn>().First(findTransitionResultColumn);
                // Annotations applying just to precursors should be available (column exists) but not visible by default.
                cell = resultsGrid.Rows[0].Cells[colTransitionResult.Index];
                Assert.IsFalse(cell.Visible);

                precursorDocNode = (TransitionGroupDocNode)
                                   ((TransitionGroupTreeNode)SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0]).Model;
                // Check all annotations have the new value.
                foreach (TransitionGroupChromInfo info in precursorDocNode.Results[0])
                {
                    Assert.IsTrue(info.Annotations.ListAnnotations().Contains(pair =>
                                                                              Equals(pair.Value, annotationTestText)));
                }
            });
#endif
            // Multiselect transitions only.
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.KeysOverride = Keys.None;
                SkylineWindow.SequenceTree.SelectedNode =
                    SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0].Nodes[3];
            });
            WaitForGraphPanesToUpdate();
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.KeysOverride = Keys.Shift;
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0].Nodes[0];
            });
            WaitForGraphPanesToUpdate();
            Assert.AreEqual(4, resultsGridForm.SelectedIdentityPaths.Count);
            var docBeforeEdit = SkylineWindow.Document;
            WaitForConditionUI(() => resultsGridForm.IsComplete);
            RunUI(() =>
            {
                var transitionNoteColumn =
                    resultsGrid.Columns.Cast <DataGridViewColumn>()
                    .First(col => GetLocalizedCaption("TransitionReplicateNote") == col.HeaderText);
                // Since only transitions are selected, transition _note column should be visible.
                cell = resultsGrid.Rows[0].Cells[transitionNoteColumn.Index];
                Assert.IsTrue(cell.Visible);
                resultsGrid.CurrentCell = cell;
                resultsGrid.BeginEdit(true);
                resultsGrid.EditingControl.Text = "Test2"; // Not L10N
                resultsGrid.EndEdit();
            });
            WaitForDocumentChange(docBeforeEdit);
            RunUI(() =>
            {
                // Check all nodes have received the correct values.
                foreach (TransitionTreeNode nodeTree in SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[0].Nodes)
                {
                    foreach (TransitionChromInfo info in ((TransitionDocNode)nodeTree.Model).Results[0])
                    {
                        Assert.AreEqual("Test2", info.Annotations.Note);
                    }
                }
                // Test multiselect node without results - annotation columns should no longer be visible.
                TreeNodeMS precursorNoResults            = (TreeNodeMS)SkylineWindow.SequenceTree.Nodes[0].Nodes[0].Nodes[1];
                SkylineWindow.SequenceTree.SelectedPaths = new List <IdentityPath>
                {
                    SkylineWindow.SequenceTree.SelectedPath,
                    SkylineWindow.SequenceTree.GetNodePath(precursorNoResults)
                };
                //Assert.IsFalse(resultsGrid.GetAvailableColumns().Contains(resultsGrid.PrecursorNoteColumn));
                SkylineWindow.SequenceTree.KeysOverride = Keys.None;
            });

            // Show the "precursorResultItems" annotation column
            RunDlg <ViewEditor>(resultsGridForm.NavBar.CustomizeView, viewEditor =>
            {
                Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Root.Property("File").Property("Replicate").Property(AnnotationDef.ANNOTATION_PREFIX + ANNOTATION_REPLICATE)));
                viewEditor.ViewName = "CustomView";
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
                viewEditor.OkDialog();
            });
            WaitForConditionUI(() => resultsGrid.Columns.Cast <DataGridViewColumn>().FirstOrDefault(col => col.HeaderText == ANNOTATION_REPLICATE) != null);
            const string newValueOfReplicateAnnotation = "New value of replicate annotation";
            Assert.IsNull(SkylineWindow.Document.Settings.MeasuredResults.Chromatograms[0].Annotations.GetAnnotation(ANNOTATION_REPLICATE));
            WaitForConditionUI(() => resultsGridForm.IsComplete);
            RunUI(() =>
            {
                var colAnnotationReplicate = resultsGrid.Columns.Cast <DataGridViewColumn>().First(col => col.HeaderText == ANNOTATION_REPLICATE);
                cell = resultsGrid.Rows[0].Cells[colAnnotationReplicate.Index];
                resultsGrid.CurrentCell = cell;
                resultsGrid.BeginEdit(true);
                resultsGrid.EditingControl.Text = newValueOfReplicateAnnotation;
                resultsGrid.EndEdit();
            });
            Assert.AreEqual(newValueOfReplicateAnnotation, SkylineWindow.Document.Settings.MeasuredResults.Chromatograms[0].Annotations.GetAnnotation(ANNOTATION_REPLICATE));
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
        }
Пример #8
0
 public void ReportToCsv(ReportSpec reportSpec, SrmDocument doc, string fileName, CultureInfo cultureInfo)
 {
     CheckReportCompatibility.ReportToCsv(reportSpec, doc, fileName, cultureInfo);
 }
Пример #9
0
 public void ReportToCsv(ReportSpec reportSpec, SrmDocument doc, string fileName)
 {
     CheckReportCompatibility.ReportToCsv(reportSpec, doc, fileName, LocalizationHelper.CurrentCulture);
 }
Пример #10
0
        public void TestBlankDocument()
        {
            var blankDocument = new SrmDocument(SrmSettingsList.GetDefault());

            CheckReportCompatibility.CheckAll(blankDocument);
        }
Пример #11
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);
        }
        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);
        }