Exemplo n.º 1
0
        protected override void DoTest()
        {
            // Configuring Peptide settings p. 4
            PeptideSettingsUI peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Modifications);
            PauseForScreenShot();

            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");
            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");
            RunUI(() => peptideSettingsUI.PickedHeavyMods = new[] { HEAVY_K, HEAVY_R });
            PauseForScreenShot();

            OkDialog(peptideSettingsUI, peptideSettingsUI.OkDialog);

            SetTransitionClipboardText(new[] { 0, 1, 7, 8 });

            RunUI(() =>
            {
                SkylineWindow.Paste();
                SkylineWindow.CollapsePeptides();
            });
            PauseForScreenShot();

            const string peptideStandardsName = "Tr_peps_set2";

            FindNode(peptideStandardsName);

            RunUI(() =>
            {
                SkylineWindow.Cut();
                SkylineWindow.SelectedPath = new IdentityPath(SequenceTree.NODE_INSERT_ID);
                SkylineWindow.Paste();
            });

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

            {
                var peptideSettingsUI2 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
                RunUI(() => peptideSettingsUI2.SelectedTab = PeptideSettingsUI.TABS.Prediction);
                var          regressionDlg  = ShowDialog <EditRTDlg>(peptideSettingsUI2.AddRTRegression);
                const string irtCalcName    = "iRT-OC-Study";
                var          editIrtCalcDlg = ShowDialog <EditIrtCalcDlg>(regressionDlg.AddCalculator);
                RunUI(() =>
                {
                    editIrtCalcDlg.CalcName = irtCalcName;
                    editIrtCalcDlg.CreateDatabase(GetOcRawTestPath("iRT-OC-Study.irtdb"));     // Not L10N
                    SetTransitionClipboardText(new[] { 15, 17 }, c =>
                    {
                        if (string.Equals(c[8], "protein_name"))
                        {
                            return(null);
                        }
//                                c[17] = double.Parse(c[17], CultureInfo.InvariantCulture).ToString(LocalizationHelper.CurrentCulture);
                        return(string.Equals(c[8], peptideStandardsName) ? c : null);
                    });
                    editIrtCalcDlg.DoPasteStandard();
                });

                PauseForScreenShot();

                RunUI(() =>
                {
                    string carbC = string.Format("C[+{0:F01}]", 57.0);
                    SetTransitionClipboardText(new[] { 15, 17 }, c =>
                    {
                        if (string.Equals(c[8], peptideStandardsName) || string.Equals(c[8], "protein_name"))
                        {
                            return(null);
                        }
                        c[15] = c[15].Replace("[C160]", carbC).Replace("C[160]", carbC);
//                            c[17] = double.Parse(c[17], CultureInfo.InvariantCulture).ToString(LocalizationHelper.CurrentCulture);
                        return(c);
                    });
                });

                var addPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(editIrtCalcDlg.DoPasteLibrary);

                PauseForScreenShot();   // Add Peptides form

                RunUI(() =>
                {
                    Assert.AreEqual(71, addPeptidesDlg.PeptidesCount);
                    Assert.AreEqual(0, addPeptidesDlg.RunsConvertedCount);
                    Assert.AreEqual(0, addPeptidesDlg.RunsFailedCount);
                    addPeptidesDlg.OkDialog();
                });
                WaitForClosedForm(addPeptidesDlg);

                PauseForScreenShot();   // Edit iRT Calculator form

                RunUI(() => Assert.AreEqual(71, editIrtCalcDlg.LibraryPeptideCount));
                OkDialog(editIrtCalcDlg, editIrtCalcDlg.OkDialog);

                RunUI(() =>
                {
                    regressionDlg.SetRegressionName(irtPredictorName);
                    regressionDlg.ChooseCalculator(irtCalcName);
                    regressionDlg.SetAutoCalcRegression(true);
                    regressionDlg.SetTimeWindow(3);
                });

                PauseForScreenShot();   // Edit retention time predictor form

                OkDialog(regressionDlg, regressionDlg.OkDialog);

                PauseForScreenShot();   // Prediction tab

                RunUI(() => peptideSettingsUI2.SelectedTab = PeptideSettingsUI.TABS.Library);

                var editLibListUI = ShowDialog <EditListDlg <SettingsListBase <LibrarySpec>, LibrarySpec> >(peptideSettingsUI2.EditLibraryList);
                var addLibUI      = ShowDialog <EditLibraryDlg>(editLibListUI.AddItem);
                RunUI(() => addLibUI.LibrarySpec =
                          new BiblioSpecLibSpec(HUMAN_MINI, GetOcRawTestPath("h130kdp_consensus.blib"))); // Not L10N
                PauseForScreenShot();

                OkDialog(addLibUI, addLibUI.OkDialog);
                OkDialog(editLibListUI, editLibListUI.OkDialog);

                RunUI(() => peptideSettingsUI2.PickedLibraries = new[] { HUMAN_MINI });
                PauseForScreenShot();

                OkDialog(peptideSettingsUI2, peptideSettingsUI2.OkDialog);
            }

            RunUI(() => SkylineWindow.SaveDocument(GetOcRawTestPath("OC-study.sky")));

            // Importing Data
            ImportResultsFiles(GetOcRawTestPath(), ExtAbWiff,
                               IsFullData ? "R201217" : "R201217_plasma_revision_A", true);
            WaitForCondition(5 * 60 * 1000, () =>
                             SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            ImportResultsFiles(GetOcRawTestPath(), ExtAbWiff,
                               IsFullData ? "R201203" : "R201203_plasma_revision_F", true);
            WaitForCondition(2 * 60 * 1000, () =>
                             SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);

            PauseForScreenShot();
        }