Пример #1
0
        private void TestToolDirMacro()
        {
            string path1 = TestFilesDir.GetTestPath("TestToolDirMacro.zip");

            RunDlg <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg, configureToolsDlg =>
            {
                configureToolsDlg.RemoveAllTools();
                configureToolsDlg.InstallZipTool(path1);
                Assert.AreEqual("TestToolDirMacro", configureToolsDlg.textTitle.Text);
                Assert.AreEqual("$(ToolDir)\\HelloWorld.exe", configureToolsDlg.textCommand.Text);
                Assert.AreEqual("$(ToolDir)\\MSStatsDSS.r", configureToolsDlg.textArguments.Text);
                Assert.AreEqual(string.Empty, configureToolsDlg.textInitialDirectory.Text);
                Assert.AreEqual(CheckState.Unchecked, configureToolsDlg.cbOutputImmediateWindow.CheckState);
                Assert.AreEqual(string.Empty, configureToolsDlg.comboReport.SelectedItem);
                configureToolsDlg.PopulateListMacroArguments();
                string toolDir      = configureToolsDlg.ToolDir;
                string macroToolDir =
                    configureToolsDlg.GetMacroArgumentToolTip(Resources.ToolMacros__listArguments_Tool_Directory);
                Assert.AreEqual(toolDir, macroToolDir);
                string inputReportTempPath =
                    configureToolsDlg.GetMacroArgumentToolTip(
                        Resources.ToolMacros__listArguments_Input_Report_Temp_Path);
                Assert.AreEqual(inputReportTempPath, Resources.ConfigureToolsDlg_PopulateMacroDropdown_File_path_to_a_temporary_report);
                configureToolsDlg.SaveTools();
                ToolDescription tool = Settings.Default.ToolList[0];
                Assert.AreEqual(tool.Title, configureToolsDlg.textTitle.Text);
                Assert.AreEqual(tool.ToolDirPath, toolDir);
                string expectedcommand = configureToolsDlg.textCommand.Text.Replace("$(ToolDir)", toolDir);

                string command = ToolMacros.ReplaceMacrosCommand(SkylineWindow.Document, SkylineWindow, tool, SkylineWindow);
                Assert.AreEqual(expectedcommand, command);

                string expectedArgument = configureToolsDlg.textArguments.Text.Replace("$(ToolDir)", toolDir);

                string arguments = ToolMacros.ReplaceMacrosArguments(SkylineWindow.Document, SkylineWindow, tool, SkylineWindow);
                Assert.AreEqual(expectedArgument, arguments);

                configureToolsDlg.RemoveAllTools();
                configureToolsDlg.OkDialog();
            });
        }
Пример #2
0
        private void CirtLibraryBuildTest()
        {
            RunUI(() =>
            {
                SkylineWindow.NewDocument(true);
                SkylineWindow.ModifyDocument("Set default settings", doc => doc.ChangeSettings(SrmSettingsList.GetDefault()));
            });

            var peptideSettingsDlg = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            // build a library with CiRT peptides
            BuildLibrary(TestFilesDir.GetTestPath("maxquant_cirt"), null, null, false, true,
                         false, false, IrtStandard.CIRT_SHORT);
            var addIrtStandardsDlg = WaitForOpenForm <AddIrtStandardsDlg>();

            // use 15 CiRT peptides as standards
            const int numStandards = 15;

            RunUI(() => addIrtStandardsDlg.StandardCount = numStandards);
            var addIrtPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(addIrtStandardsDlg.OkDialog);

            // don't recalibrate; add RT predictor
            var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addIrtPeptidesDlg.OkDialog);
            var addRetentionTimePredictorDlg = ShowDialog <AddRetentionTimePredictorDlg>(recalibrateDlg.ClickNo);

            OkDialog(addRetentionTimePredictorDlg, addRetentionTimePredictorDlg.OkDialog);

            // verify that there are 15 CiRT peptides as standards in the calculator
            var editIrtCalcDlg = ShowDialog <EditIrtCalcDlg>(peptideSettingsDlg.EditCalculator);
            var cirtPeptides   = new TargetMap <bool>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true)));

            RunUI(() =>
            {
                Assert.AreEqual(numStandards, editIrtCalcDlg.StandardPeptideCount);
                Assert.IsTrue(editIrtCalcDlg.StandardPeptides.All(pep => cirtPeptides.ContainsKey(pep.ModifiedTarget)));
            });

            OkDialog(editIrtCalcDlg, editIrtCalcDlg.CancelDialog);
            OkDialog(peptideSettingsDlg, peptideSettingsDlg.CancelDialog);
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath("cirt_test.sky")));
        }
Пример #3
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("DextranLadder.sky")));
            var peptideSettingsUi = ShowDialog <PeptideSettingsUI>(() => SkylineWindow.ShowPeptideSettingsUI(PeptideSettingsUI.TABS.Prediction));
            var irtCalc           = ShowDialog <EditIrtCalcDlg>(peptideSettingsUi.AddCalculator);
            var calibrateDlg      = ShowDialog <CalibrateIrtDlg>(irtCalc.Calibrate);

            // First, populate the iRT database with any set of standards from the results
            var addStandardsDlg = ShowDialog <AddIrtStandardsDlg>(calibrateDlg.UseResults);

            RunUI(() => addStandardsDlg.StandardCount = 10);
            OkDialog(addStandardsDlg, addStandardsDlg.OkDialog);
            OkDialog(calibrateDlg, calibrateDlg.OkDialog);
            var addIrtPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(irtCalc.AddResults);

            OkDialog(addIrtPeptidesDlg, addIrtPeptidesDlg.OkDialog);
            var alertDlg = WaitForOpenForm <AlertDlg>();

            OkDialog(alertDlg, alertDlg.ClickYes);

            // Now, change the set of standards to the ones that we want to use.
            var changeIrtPeptidesDlg = ShowDialog <ChangeIrtPeptidesDlg>(irtCalc.ChangeStandardPeptides);

            RunUI(() =>
            {
                changeIrtPeptidesDlg.PeptidesText =
                    "(Glc)3\r\n(Glc)4\r\n(Glc)5\r\n(Glc)6\r\n(Glc)7\r\n(Glc)8\r\n(Glc)9\r\n(Glc)10\r\n";
            });
            OkDialog(changeIrtPeptidesDlg, changeIrtPeptidesDlg.OkDialog);
            RunUI(() =>
            {
                irtCalc.CalcName = "DextranLadderIrt";
                irtCalc.CreateDatabase(TestFilesDir.GetTestPath("DextranLadder.irtdb"));
            });
            var confirmStandardCountDlg = ShowDialog <MultiButtonMsgDlg>(irtCalc.OkDialog);

            OkDialog(confirmStandardCountDlg, confirmStandardCountDlg.ClickYes);
            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            RunUI(() => SkylineWindow.SaveDocument());
        }
Пример #4
0
        public void TestInstrumentSerialNumbers()
        {
            if (Skyline.Program.NoVendorReaders)
            {
                return;
            }

            const string testZipPath  = @"TestData\PwizFileInfoTest.zip";
            var          testFilesDir = new TestFilesDir(TestContext, testZipPath);

            if (ExtensionTestContext.CanImportAbWiff2)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("OnyxTOFMS.wiff2"), null); // WIFF2 file with empty serial number
            }
            if (ExtensionTestContext.CanImportAbWiff)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("051309_digestion.wiff"), "U016050603");
            }

            if (ExtensionTestContext.CanImportAgilentRaw)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("081809_100fmol-MichromMix-05.d"), "50331873");
            }

            if (ExtensionTestContext.CanImportShimadzuRaw)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("10nmol_Negative_MS_ID_ON_055.lcd"), null); // Shimadzu does not provide serial number
            }
            if (ExtensionTestContext.CanImportWatersRaw)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("160109_Mix1_calcurve_075.raw"), null); // Waters does not provide serial number
            }
            if (ExtensionTestContext.CanImportThermoRaw)
            {
                VerifySerialNumber(testFilesDir.GetTestPath("CE_Vantage_15mTorr_0001_REP1_01.raw"), null); // Thermo RAW file with empty serial number

                const string testZipPath2  = @"TestData\Results\ThermoQuant.zip";
                var          testFilesDir2 = new TestFilesDir(TestContext, testZipPath2);
                VerifySerialNumber(testFilesDir2.GetTestPath("Site20_STUDY9P_PHASEII_QC_03.raw"), "TQU00490");
            }
        }
Пример #5
0
        protected override void DoTest()
        {
            RunUI(() =>
            {
                SkylineWindow.OpenFile(TestFilesDir.GetTestPath("HeatMapTest.sky"));
                SkylineWindow.ShowDocumentGrid(true);
            });
            TestGroupComparisonClustering();
            var documentGrid = FindOpenForm <DocumentGridForm>();

            Assert.IsNotNull(documentGrid);
            RunUI(() => documentGrid.ChooseView("PeptideResultValues"));
            WaitForCondition(() => documentGrid.IsComplete);
            var heatMap        = ShowDialog <HierarchicalClusterGraph>(() => documentGrid.DataboundGridControl.ShowHeatMap());
            var heatMapResults = heatMap.GraphResults;

            Assert.IsNotNull(heatMap);
            PauseForScreenShot("Normal heat map");
            OkDialog(heatMap, heatMap.Close);

            RunUI(() => documentGrid.BindingListSource.ClusteringSpec = ClusteringSpec.DEFAULT);
            WaitForCondition(() => documentGrid.IsComplete);
            List <string> expectedRowLabels = documentGrid.BindingListSource.OfType <RowItem>().Select(row =>
                                                                                                       documentGrid.BindingListSource.ItemProperties[0].GetValue(row)?.ToString() ?? string.Empty).ToList();
            List <string> actualRowLabels = heatMapResults.RowHeaders.Select(header => header.Caption).ToList();

            CollectionAssert.AreEqual(expectedRowLabels, actualRowLabels);
            List <string> expectedColumnLabels = documentGrid.BindingListSource.ItemProperties.OfType <ColumnPropertyDescriptor>()
                                                 .Where(c => c.PropertyPath.Name == "NormalizedArea").Select(col =>
                                                                                                             col.PivotedColumnId.PivotKeyCaption.GetCaption(SkylineDataSchema.GetLocalizedSchemaLocalizer())).ToList();
            List <string> actualColumnLabels = heatMapResults.ColumnGroups.First().Headers.Select(header => header.Caption).ToList();

            CollectionAssert.AreEqual(expectedColumnLabels, actualColumnLabels);

            RunUI(() => documentGrid.ChooseView("ThreeColumnGroups"));
            WaitForCondition(() => documentGrid.IsComplete);
            heatMap = ShowDialog <HierarchicalClusterGraph>(() => documentGrid.DataboundGridControl.ShowHeatMap());
            PauseForScreenShot("Heat map with three column groups");
            Assert.AreEqual(6, heatMap.GraphResults.ColumnGroups.Count);
            OkDialog(heatMap, heatMap.Close);
        }
Пример #6
0
        private void BuildLibraryValid(string inputDir, IEnumerable <string> inputFiles,
                                       bool keepRedundant, bool filterPeptides, bool append, int expectedSpectra, int expectedAmbiguous = 0)
        {
            ReportLibraryBuildFailures = true;
            BuildLibrary(inputDir, inputFiles, null, keepRedundant, false, filterPeptides, append, null);

            if (expectedAmbiguous > 0)
            {
                var ambiguousDlg = WaitForOpenForm <MessageDlg>();
                RunUI(() => Assert.AreEqual(expectedAmbiguous, ambiguousDlg.Message.Split('\n').Length - 1, ambiguousDlg.Message));
                OkDialog(ambiguousDlg, ambiguousDlg.OkDialog);
            }

            if (!TryWaitForConditionUI(() => PeptideSettingsUI.AvailableLibraries.Contains(_libraryName)))
            {
                var messageDlg = FindOpenForm <MessageDlg>();
                if (messageDlg != null)
                {
                    AssertEx.Fail("Unexpected MessageDlg: " + messageDlg.DetailedMessage);
                }
                AssertEx.Fail("Failed waiting for the library {0} in Peptide Settings", _libraryName);
            }
            string nonRedundantBuildPath = TestFilesDir.GetTestPath(_libraryName + BiblioSpecLiteSpec.EXT);

            WaitForConditionUI(() => File.Exists(nonRedundantBuildPath),
                               string.Format("Failed waiting for the non-redundant library {0}", nonRedundantBuildPath));
            WaitForConditionUI(() => !PeptideSettingsUI.IsBuildingLibrary,
                               string.Format("Failed waiting for library {0} build to complete", _libraryName));

            RunUI(() => PeptideSettingsUI.PickedLibraries = new[] { _libraryName });
            OkDialog(PeptideSettingsUI, PeptideSettingsUI.OkDialog);

            // Wait for the library to load
            AbstractFunctionalTestEx.WaitForLibrary(expectedSpectra);
            var librarySettings = SkylineWindow.Document.Settings.PeptideSettings.Libraries;

            Assert.IsTrue(librarySettings.IsLoaded);
            Assert.AreEqual(1, librarySettings.Libraries.Count);
            Assert.AreEqual(_libraryName, librarySettings.Libraries[0].Name);
            Assert.AreEqual(expectedSpectra, librarySettings.Libraries[0].Keys.Count());
        }
        public void NativeVsMz5OptimzeCeImportPerformanceTest(string baseName, string skyFile)
        {
            // compare mz5 and raw import times
            TestFilesZip        = GetPerfTestDataURL(baseName + ".zip");
            TestFilesPersistent = new[] { "Native/", "Mz5/" }; // list of files (directories, in this case) that we'd like to unzip alongside parent zipFile, and (re)use in place
            _testFilesDir       = new TestFilesDir(TestContext, TestFilesZip, null, TestFilesPersistent);
            _skyFile            = _testFilesDir.GetTestPath(Path.Combine(baseName, skyFile));


            foreach (var resultspath in TestFilesPersistent)
            {
                _replicatesDirName = Path.Combine(_testFilesDir.PersistentFilesDir, Path.Combine(baseName, resultspath.Substring(0, resultspath.Length - 1)));
                for (var loop = 0; loop < _loopCount + 1; loop++)                     // one extra initial loop for warmup
                {
                    MsDataFileImpl.PerfUtilFactory.IssueDummyPerfUtils = (loop == 0); // turn on performance measurement after initial warmup loop
                    RunFunctionalTest();
                    // make sure we're clean for next pass
                    File.Delete(Path.ChangeExtension(_skyFile, ChromatogramCache.EXT) ?? ChromatogramCache.EXT); // Not null for ReSharper
                }
            }
        }
Пример #8
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("PMF Skyline PepCalMix 01.sky")));
            WaitForDocumentLoaded();
            ImportResultsFile(TestFilesDir.GetTestPath("160204 PepCalMix MIDAS01 heavy.wiff"));
            WaitForDocumentLoaded();
            SelectNode(SrmDocument.Level.TransitionGroups, 1);
            RunUI(() => SkylineWindow.ShowGraphSpectrum(true));
            var graphSpectrum = SkylineWindow.GraphSpectrum;

            Assert.IsNotNull(graphSpectrum);
            WaitForCondition(() => null != graphSpectrum.AvailableSpectra);
            Assert.AreEqual(8, graphSpectrum.AvailableSpectra.Count());
            var goodSpectrum = graphSpectrum.AvailableSpectra.Skip(1).First();

            RunUI(() =>
            {
                graphSpectrum.SelectSpectrum(new SpectrumIdentifier(goodSpectrum.FilePath.ToString(), goodSpectrum.RetentionTime.GetValueOrDefault()));
            });
            Assert.AreEqual(7, graphSpectrum.IonLabels.Count());
        }
Пример #9
0
        public void TestSkylineCmd()
        {
            TestFilesZip = @"TestFunctional/SkylineCmdTest.zip";
            TestFilesDir = new TestFilesDir(TestContext, TestFilesZip);

            // failure to start
            {
                var process = Process.Start(GetProcessStartInfo("--invalidargument"));
                WaitForExit(process, Program.EXIT_CODE_FAILURE_TO_START);
            }
            // ran with errors
            {
                var process = Process.Start(GetProcessStartInfo("\"--in=" + TestFilesDir.GetTestPath("invalidpath.sky") + "\""));
                WaitForExit(process, Program.EXIT_CODE_RAN_WITH_ERRORS);
            }
            // success
            {
                var process = Process.Start(GetProcessStartInfo("\"--in=" + TestFilesDir.GetTestPath("SkylineCmdTest.sky") + "\""));
                WaitForExit(process, Program.EXIT_CODE_SUCCESS);
            }
        }
Пример #10
0
        /// <summary>
        /// Tests that we fail gracefully when document settings would result in an excessive number of nodes.
        /// </summary>
        protected override void DoTest()
        {
            // User managed to create an interesting incomplete file that can only be opened with proper local paths
            string text = File.ReadAllText(TestFilesDir.GetTestPath("wildsettings.sky"));

            text = text.Replace(@"__TESTPATH__", TestFilesDir.FullPath);
            File.WriteAllText(TestFilesDir.GetTestPath("wildsettings.sky"), text);

            // Open the file and it should fail quickly
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("wildsettings.sky")));
            // Should present an error dialog
            var errorDlg = WaitForOpenForm <MessageDlg>();

            RunUI(() =>
            {
                Assert.IsTrue(errorDlg.Message.Contains(String.Format(
                                                            Resources.PeptideGroupDocNode_ChangeSettings_The_current_document_settings_would_cause_the_number_of_targeted_transitions_to_exceed__0_n0___The_document_settings_must_be_more_restrictive_or_add_fewer_proteins_,
                                                            SrmDocument.MaxTransitionCount)));
                errorDlg.OkDialog();
            });
        }
Пример #11
0
        protected override void DoTest()
        {
            Settings.Default.PeakScoringModelList.Clear();

            var documentFile = TestFilesDir.GetTestPath("MProphetGold-rescore2.sky");

            RunUI(() => SkylineWindow.OpenFile(documentFile));
            WaitForDocumentLoaded();
            _defaultMProphetCalcs = (new MProphetPeakScoringModel("dummy")).PeakFeatureCalculators.ToArray();

            TestDialog();
            TestModelChangesAndSave();
            TestBackwardCompatibility();
            TestIncompatibleDataSet();

            var documentMissingScores = TestFilesDir.GetTestPath("SRMCourse_DosR-hDP__20130501.sky");

            RunUI(() => SkylineWindow.OpenFile(documentMissingScores));
            WaitForDocumentLoaded();
            TestFindMissingScores();
        }
Пример #12
0
        public void TestProteomeDb()
        {
            using (var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE))
            {
                string fastaPath  = testFilesDir.GetTestPath("high_ipi.Human.20060111.fasta");
                string protDbPath = testFilesDir.GetTestPath("test.protdb");

                using (ProteomeDb proteomeDb = ProteomeDb.CreateProteomeDb(protDbPath))
                {
                    IProgressStatus status = new ProgressStatus(string.Empty);
                    using (var reader = new StreamReader(fastaPath))
                    {
                        proteomeDb.AddFastaFile(reader, new SilentProgressMonitor(), ref status, true); // Delay indexing
                    }
                    // perform digestion
                    Digestion digestion         = proteomeDb.GetDigestion();
                    var       digestedProteins0 = digestion.GetProteinsWithSequence("EDGWVK");
                    Assert.IsTrue(digestedProteins0.Count >= 1);
                }
            }
        }
Пример #13
0
        protected override void DoTest()
        {
            TestFilesZip = @"TestFunctional\RunToRunRegressionTest.zip";

            var documentPath = TestFilesDir.GetTestPath("alpha-crystallin_data.sky");

            RunUI(() => SkylineWindow.OpenFile(documentPath));
            WaitForDocumentLoaded();

            Settings.Default.RTRefinePeptides = false;

            var summary = ShowDialog <GraphSummary>(() => SkylineWindow.ShowRTRegressionGraphScoreToRun());

            RunUI(() => SkylineWindow.ChooseCalculator(CALCULATOR_NAME));

            CheckNonlinearRegressionMethods(summary);

            //Check that Loess and KDE do not try to refine even if setting is true.
            Settings.Default.RTRefinePeptides = true;
            CheckNonlinearRegressionMethods(summary);
        }
Пример #14
0
        protected override void DoTest()
        {
            var exportLiveReportDlg = ShowDialog <ExportLiveReportDlg>(SkylineWindow.ShowExportReportDialog);
            var manageViewsForm     = ShowDialog <ManageViewsForm>(exportLiveReportDlg.EditList);

            RunUI(() => manageViewsForm.ImportViews(TestFilesDir.GetTestPath("CalibrationReports.skyr")));
            OkDialog(manageViewsForm, manageViewsForm.OkDialog);
            OkDialog(exportLiveReportDlg, exportLiveReportDlg.CancelClick);
            var scenarioNames = new []
            {
                "CalibrationTest",
                "CalibrationExcludedTest",
                "p180test_calibration_DukeApril2016",
                "MergedDocuments"
            };

            foreach (var scenarioName in scenarioNames)
            {
                RunScenario(scenarioName);
            }
        }
Пример #15
0
        // tool installation via the configure tools dlg
        private void TestInstallation()
        {
            var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg);

            RunUI(() =>
            {
                ToolStoreUtil.ToolStoreClient = new TestToolStoreClient(TestFilesDir.GetTestPath("TestBasicPopulation"));
                configureToolsDlg.RemoveAllTools();
                configureToolsDlg.SaveTools();
            });
            RunDlg <ToolStoreDlg>(configureToolsDlg.AddFromWeb, dlg => dlg.DownloadSelectedTool());
            WaitForConditionUI(() => configureToolsDlg.ToolList.Count == 1);
            RunUI(() =>
            {
                configureToolsDlg.SaveTools();
                Assert.AreEqual(TITLE, configureToolsDlg.ToolList[0].Title);
                Assert.AreEqual(COMMAND, configureToolsDlg.ToolList[0].Command);
            });
            OkDialog(configureToolsDlg, configureToolsDlg.Cancel);
            Settings.Default.ToolList.Clear();
        }
Пример #16
0
        protected override void DoTest()
        {
            var resultsPath = TestFilesDir.GetTestPath("PeakSortingIssue.raw");
            var docPath     = TestFilesDir.GetTestPath("PeakSortingIssue.sky");
            var doc         = ResultsUtil.DeserializeDocument(docPath);

            AssertEx.IsDocumentState(doc, 0, 1, 3, 6, 90);
            using (var docContainer = new ResultsTestDocumentContainer(doc, docPath))
            {
                var replicateName     = Path.GetFileNameWithoutExtension(resultsPath);
                var listChromatograms =
                    new List <ChromatogramSet> {
                    new ChromatogramSet(replicateName, new[] { MsDataFileUri.Parse(resultsPath) })
                };
                var docResults = doc.ChangeMeasuredResults(new MeasuredResults(listChromatograms));
                Assert.IsTrue(docContainer.SetDocument(docResults, doc, true));
                docContainer.AssertComplete();
                docResults = docContainer.Document;
                AssertResult.IsDocumentResultsState(docResults, replicateName, 0, 0, 0, 0, 3);
            }
        }
        protected void DoTest()
        {
            if (TestFilesZipPaths != null)
            {
                TestFilesDirs = new TestFilesDir[TestFilesZipPaths.Length];
                for (int i = 0; i < TestFilesZipPaths.Length; i++)
                {
                    TestFilesDirs[i] = new TestFilesDir(TestContext, TestFilesZipPaths[i], TestDirectoryName,
                                                        TestFilesPersistent, IsExtractHere(i));
                }
            }

            File.Copy(_baseSkyFile, _skyFile, true);
            Stopwatch loadStopwatch = new Stopwatch();

            loadStopwatch.Start();
            var doc = ResultsUtil.DeserializeDocument(_skyFile);

            if (_centroided)
            {
                doc = doc.ChangeSettings(doc.Settings.ChangeTransitionFullScan(f =>
                                                                               f.ChangePrecursorResolution(FullScanMassAnalyzerType.centroided, 20, null)
                                                                               .ChangeProductResolution(FullScanMassAnalyzerType.centroided, 20, null)));
            }
            doc = ConnectLibrarySpecs(doc, _skyFile);
            using (var docContainer = new ResultsTestDocumentContainer(doc, _skyFile))
            {
                var chromSets = new[]
                {
                    new ChromatogramSet(_replicateName, new[]
                                        { new MsDataFilePath(_dataFile), }),
                };
                var docResults = doc.ChangeMeasuredResults(new MeasuredResults(chromSets));
                Assert.IsTrue(docContainer.SetDocument(docResults, doc, true));
                docContainer.AssertComplete();
            }
            loadStopwatch.Stop();

            DebugLog.Info("{0} load time = {1}", _dataFile, loadStopwatch.ElapsedMilliseconds);
        }
Пример #18
0
        public void ChromatogramExportTest()
        {
            var    testFilesDir    = new TestFilesDir(TestContext, TEST_ZIP_PATH);
            string chromExportDoc  = testFilesDir.GetTestPath("ChromToExport.sky");
            string fileExpected1   = testFilesDir.GetTestPathLocale(EXPORT_1);
            string fileActual1     = GetActualName(fileExpected1);
            string fileExpected2   = testFilesDir.GetTestPathLocale(EXPORT_2);
            string fileActual2     = GetActualName(fileExpected2);
            string fileExpectedAll = testFilesDir.GetTestPathLocale(EXPORT_ALL);
            string fileActualAll   = GetActualName(fileExpectedAll);

            SrmDocument doc = ResultsUtil.DeserializeDocument(chromExportDoc);

            // Load an empty doc, so that we can make a change and
            // cause the .skyd to be loaded
            using (var docContainer = new ResultsTestDocumentContainer(null, chromExportDoc))
            {
                docContainer.SetDocument(doc, null, true);
                docContainer.AssertComplete();
                SrmDocument docResults = docContainer.Document;
                if (IsSaveAll)
                {
                    // For regenerating all of the required expected files, if things change
                    SaveChrom(docResults, testFilesDir.GetTestPath(EXPORT_1), FILE_NAMES_1.ToList(), CultureInfo.GetCultureInfo("en-US"), EXTRACTOR_1, SOURCES_1);
                    SaveChrom(docResults, testFilesDir.GetTestPath(EXPORT_2), FILE_NAMES_2.ToList(), CultureInfo.GetCultureInfo("en-US"), EXTRACTOR_2, SOURCES_2);
                    SaveChrom(docResults, testFilesDir.GetTestPath(EXPORT_ALL), FILE_NAMES_ALL.ToList(), CultureInfo.GetCultureInfo("en-US"), EXTRACTOR_ALL, SOURCES_ALL);
                    SaveChrom(docResults, testFilesDir.GetTestPathIntl(EXPORT_1), FILE_NAMES_1.ToList(), CultureInfo.GetCultureInfo("fr-FR"), EXTRACTOR_1, SOURCES_1);
                    SaveChrom(docResults, testFilesDir.GetTestPathIntl(EXPORT_2), FILE_NAMES_2.ToList(), CultureInfo.GetCultureInfo("fr-FR"), EXTRACTOR_2, SOURCES_2);
                    SaveChrom(docResults, testFilesDir.GetTestPathIntl(EXPORT_ALL), FILE_NAMES_ALL.ToList(), CultureInfo.GetCultureInfo("fr-FR"), EXTRACTOR_ALL, SOURCES_ALL);
                }

                SaveChrom(docResults, fileActual1, FILE_NAMES_1.ToList(), LocalizationHelper.CurrentCulture, EXTRACTOR_1, SOURCES_1);
                SaveChrom(docResults, fileActual2, FILE_NAMES_2.ToList(), LocalizationHelper.CurrentCulture, EXTRACTOR_2, SOURCES_2);
                SaveChrom(docResults, fileActualAll, FILE_NAMES_ALL.ToList(), LocalizationHelper.CurrentCulture, EXTRACTOR_ALL, SOURCES_ALL);

                AssertEx.FileEquals(fileExpected1, fileActual1);
                AssertEx.FileEquals(fileExpected2, fileActual2);
                AssertEx.FileEquals(fileExpectedAll, fileActualAll);
            }
        }
Пример #19
0
        public void TestCurrentXmlFormat()
        {
            var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

            var doc08Path      = testFilesDir.GetTestPath("Study7_for_xml_validation.sky");
            var docCurrentPath = testFilesDir.GetTestPath("Study7_for_xml_validation_current.sky");

            // Test schema validation.
            var assembly = Assembly.GetAssembly(typeof(AssertEx));
            var stream   = assembly.GetManifestResourceStream(
                typeof(AssertEx).Namespace + String.Format(CultureInfo.InvariantCulture, ".Schemas.Skyline_{0}.xsd", SrmDocument.FORMAT_VERSION));  // Not L10N

            TestSchemaValidation(stream, doc08Path, docCurrentPath);

            // Check explicit and implicit modifications in the current format.
            TestPeptideModifications(docCurrentPath);

            // Import a results file and check instrument information written out to the xml document.
            var resultsPath = testFilesDir.GetTestPath("CE_Vantage_15mTorr_0001_REP1_01.mzML");

            TestInstrumentInfo(resultsPath, docCurrentPath);
        }
Пример #20
0
        protected override void DoTest()
        {
            OpenDocument("Bovine_std_curated_seq_small2.sky");
            string succeedsFile  = TestFilesDir.GetTestPath(SUCCEEDS_FILE_NAME);
            string succeeds2File = TestFilesDir.GetTestPath(SUCCEEDS2_FILE_NAME);
            string failsFile     = TestFilesDir.GetTestPath(FAILS_FILE_NAME);

            File.Copy(succeedsFile, succeeds2File);
            var docOriginal = WaitForDocumentLoaded();

            // Cancel after failure
            var docCancel = ImportFailure(docOriginal, dlg => dlg.BtnCancelClick(), FAILS_FILE_NAME, SUCCEEDS_FILE_NAME);

            Assert.IsFalse(docCancel.Settings.HasResults);

            // Skip after failure
            var docSkip = ImportFailure(docCancel, dlg => dlg.Btn1Click(), FAILS_FILE_NAME, SUCCEEDS_FILE_NAME);

            Assert.IsTrue(docSkip.Settings.HasResults);
            Assert.AreEqual(1, docSkip.Settings.MeasuredResults.Chromatograms.Count);
            Assert.AreEqual(Path.GetFileNameWithoutExtension(SUCCEEDS_FILE_NAME),
                            docSkip.Settings.MeasuredResults.Chromatograms[0].Name);

            // Retry after failure
            ImportResultsAsync(FAILS_FILE_NAME, SUCCEEDS2_FILE_NAME);
            var dlgImportFailed = WaitForOpenForm <MultiButtonMsgDlg>();

            OkDialog(dlgImportFailed, () => dlgImportFailed.Btn0Click());
            var dlgImportFailed2 = WaitForOpenForm <MultiButtonMsgDlg>();
            var docBeforeSuccess = SkylineWindow.Document;

            File.Copy(succeedsFile, failsFile, true);
            RunUI(() => dlgImportFailed2.Btn0Click());
            var docAfterSuccess = WaitForDocumentChangeLoaded(docBeforeSuccess);

            Assert.AreEqual(3, docAfterSuccess.Settings.MeasuredResults.Chromatograms.Count);
            Assert.AreEqual(Path.GetFileNameWithoutExtension(FAILS_FILE_NAME),
                            docAfterSuccess.Settings.MeasuredResults.Chromatograms[1].Name);
        }
Пример #21
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("DuplicateTransitionGroups.sky")));
            var importResultsDlg     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
            var openDataSourceDialog = ShowDialog <OpenDataSourceDialog>(importResultsDlg.OkDialog);

            RunUI(() => openDataSourceDialog.SelectFile(TestFilesDir.GetTestPath("DuplicateTransitionGroupTest.mzML")));
            OkDialog(openDataSourceDialog, openDataSourceDialog.Open);
            WaitForDocumentLoaded();
            RunUI(() => SkylineWindow.ShowDocumentGrid(true));
            var documentGrid = FindOpenForm <DocumentGridForm>();

            RunUI(() => documentGrid.DataboundGridControl.ChooseView("RatioToStandards"));
            WaitForConditionUI(() => documentGrid.IsComplete && documentGrid.RowCount > 0);
            var expectedResults = new []
            {
                Tuple.Create("Normal", (double?).6469),
                Tuple.Create("BothLight", (double?)null),
                Tuple.Create("BothHeavy", (double?)null),
                Tuple.Create("ExtraLight", (double?).6469),
                Tuple.Create("ExtraHeavy", (double?)1),
            };
            var dataGridView = documentGrid.DataGridView;

            Assert.AreEqual(expectedResults.Length, dataGridView.RowCount);
            for (int iRow = 0; iRow < expectedResults.Length; iRow++)
            {
                Assert.AreEqual(expectedResults[iRow].Item1, dataGridView.Rows[iRow].Cells[0].Value);
                if (expectedResults[iRow].Item2 == null)
                {
                    Assert.IsNull(dataGridView.Rows[iRow].Cells[1].Value);
                }
                else
                {
                    Assert.IsInstanceOfType(dataGridView.Rows[iRow].Cells[1].Value, typeof(double));
                    Assert.AreEqual(expectedResults[iRow].Item2.Value, (double)dataGridView.Rows[iRow].Cells[1].Value, .001);
                }
            }
        }
Пример #22
0
        public void TestCurrentXmlFormat()
        {
            var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

            var doc08Path      = testFilesDir.GetTestPath("Study7_for_xml_validation.sky");
            var docCurrentPath = testFilesDir.GetTestPath("Study7_for_xml_validation_current.sky");

            // Test schema validation.
            var assembly = Assembly.GetAssembly(typeof(AssertEx));
            var xsdName  = SchemaDocuments.GetSkylineSchemaResourceName(DocumentFormat.CURRENT.ToString());
            var stream   = assembly.GetManifestResourceStream(xsdName);

            TestSchemaValidation(stream, doc08Path, docCurrentPath);

            // Check explicit and implicit modifications in the current format.
            TestPeptideModifications(docCurrentPath);

            // Import a results file and check instrument information written out to the xml document.
            var resultsPath = testFilesDir.GetTestPath("CE_Vantage_15mTorr_0001_REP1_01.mzML");

            TestInstrumentInfo(resultsPath, docCurrentPath);
        }
Пример #23
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("TriggeredAcquisitionTestWIthMs1.sky")));
            // First import the results as not triggered:
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, dlg =>
            {
                dlg.TriggeredAcquisition = false;
                dlg.OkDialog();
            });
            Assert.IsFalse(SkylineWindow.Document.Settings.TransitionSettings.Instrument.TriggeredAcquisition);
            ImportResultsFile(TestFilesDir.GetTestPath("TriggeredAcquisition.mzML"));
            var idPathPep1          = FindPeptide(SkylineWindow.Document, "VTSIQDWVQK");
            var idPathPep2          = FindPeptide(SkylineWindow.Document, "LGPHAGDVEGHLSFLEK");
            var untriggeredDocument = SkylineWindow.Document;

            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, dlg =>
            {
                dlg.TriggeredAcquisition = true;
                dlg.OkDialog();
            });
            Assert.IsTrue(SkylineWindow.Document.Settings.TransitionSettings.Instrument.TriggeredAcquisition);

            // TODO (nicksh): Update the timestamp on the .mzML file so that ChromatogramSet.CalcCacheFlags notices
            // that the file is different.
            // This should be removed once we have a robust way of noticing that a file has been reimported
            File.SetLastWriteTimeUtc(TestFilesDir.GetTestPath("TriggeredAcquisition.mzML"), DateTime.UtcNow);

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, dlg =>
            {
                dlg.ReimportResults();
                dlg.OkDialog();
            });
            WaitForDocumentChange(untriggeredDocument);
            WaitForConditionUI(() => SkylineWindow.DocumentUI.Settings.MeasuredResults.IsLoaded);
            var triggeredDocument = SkylineWindow.Document;

            CompareUntriggeredTriggered(untriggeredDocument, triggeredDocument, idPathPep1);
            CompareUntriggeredTriggered(untriggeredDocument, triggeredDocument, idPathPep2);
        }
Пример #24
0
        public void ThermoFileTypeTest()
        {
            var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

            string extRaw = ExtensionTestContext.ExtThermoRaw;

            // Do file type checks
            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03" + extRaw)))
            {
                Assert.IsTrue(msData.IsThermoFile);
            }

            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03.mzXML")))
            {
                Assert.IsTrue(msData.IsThermoFile);
            }

            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_05" + extRaw)))
            {
                Assert.IsTrue(msData.IsThermoFile);
            }
        }
        /// <summary>
        /// Verifies that adding the specified library to the document results in a warning message detailing the correct
        /// number of invalid peptides that were found.
        /// </summary>
        private void VerifyInvalidPeptideMessage(string libraryFile, int expectedInvalidCount, int expectedTotalCount)
        {
            var peptideSettingsUI = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() =>
            {
                peptideSettingsUI.SelectedTab = PeptideSettingsUI.TABS.Library;
            });

            var editListDlg =
                ShowDialog <EditListDlg <SettingsListBase <LibrarySpec>, LibrarySpec> >(peptideSettingsUI.EditLibraryList);
            var addLibDlg   = ShowDialog <EditLibraryDlg>(editListDlg.AddItem);
            var libraryPath = TestFilesDir.GetTestPath(libraryFile);
            var libName     = Path.GetFileNameWithoutExtension(libraryPath);

            RunUI(() =>
            {
                addLibDlg.LibraryName = libName;
                addLibDlg.LibraryPath = libraryPath;
            });
            OkDialog(addLibDlg, addLibDlg.OkDialog);
            OkDialog(editListDlg, editListDlg.OkDialog);
            RunUI(() =>
            {
                peptideSettingsUI.PickedLibraries = peptideSettingsUI.PickedLibraries.Append(libName).ToArray();
            });

            var messageDlg      = ShowDialog <AlertDlg>(peptideSettingsUI.OkDialog);
            var expectedMessage = string.Format(Resources.CachedLibrary_WarnInvalidEntries_, libName, expectedInvalidCount,
                                                expectedTotalCount, string.Empty);

            // TODO: This assertion currently only works in English
            if (Thread.CurrentThread.CurrentCulture.Equals(new CultureInfo("en")))
            {
                StringAssert.StartsWith(messageDlg.Message, expectedMessage);
            }
            OkDialog(messageDlg, messageDlg.OkDialog);
            WaitForClosedForm(peptideSettingsUI);
        }
Пример #26
0
        public void TestProteomeDb()
        {
            using (var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE))
            {
                string fastaPath  = testFilesDir.GetTestPath("high_ipi.Human.20060111.fasta");
                string protDbPath = testFilesDir.GetTestPath("test.protdb");

                using (ProteomeDb proteomeDb = ProteomeDb.CreateProteomeDb(protDbPath))
                {
                    Enzyme trypsin = EnzymeList.GetDefault();
                    using (var reader = new StreamReader(fastaPath))
                    {
                        proteomeDb.AddFastaFile(reader, (msg, progress) => true);
                    }
                    // perform digestion
                    proteomeDb.Digest(new ProteaseImpl(trypsin), (msg, progress) => true);
                    Digestion digestion         = proteomeDb.GetDigestion(trypsin.Name);
                    var       digestedProteins0 = digestion.GetProteinsWithSequencePrefix("EDGWVK", 100);
                    Assert.IsTrue(digestedProteins0.Count >= 1);
                }
            }
        }
Пример #27
0
        public void ThermoFormatsTest()
        {
            var         testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);
            string      docPath;
            SrmDocument doc          = InitThermoDocument(testFilesDir, out docPath);
            var         docContainer = new ResultsTestDocumentContainer(doc, docPath);
            // Verify mzML and RAW contain same results
            string extRaw = ExtensionTestContext.ExtThermoRaw;

            AssertResult.MatchChromatograms(docContainer,
                                            testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03" + extRaw),
                                            testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03.mzML"),
                                            0, 0);
            // Verify mzXML and RAW contain same results (some small peaks are different)
            AssertResult.MatchChromatograms(docContainer,
                                            testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03" + extRaw),
                                            testFilesDir.GetTestPath("Site20_STUDY9P_PHASEII_QC_03.mzXML"),
                                            2, 0);
            // Release file handles
            docContainer.Release();
            testFilesDir.Dispose();
        }
        protected override void DoTest()
        {
            RunUI(() =>
            {
                Settings.Default.AreaCVShowCVCutoff   = Settings.Default.AreaCVShowMedianCV = false;
                AreaGraphController.GroupByAnnotation = AreaGraphController.GroupByGroup = null;
            });

            OpenDocument(TestFilesDir.GetTestPath(@"BrukerDIA3_0.sky"));

            TestHistogramQValues <AreaCVHistogramGraphPane>(SkylineWindow.ShowPeakAreaCVHistogram, 0);
            TestHistogramQValues <AreaCVHistogram2DGraphPane>(SkylineWindow.ShowPeakAreaCVHistogram2D, 4);
            TestRefinementQvalue();

            OpenDocument(TestFilesDir.GetTestPath(@"Site54_Study9-1_standardcurves_083011_v1.sky"));

            TestHistogramRatios <AreaCVHistogramGraphPane>(SkylineWindow.ShowPeakAreaCVHistogram, 8);
            TestHistogramRatios <AreaCVHistogram2DGraphPane>(SkylineWindow.ShowPeakAreaCVHistogram2D, 11);
            TestRefinementRatios();

            Assert.IsFalse(RecordData, "Successfully recorded data");
        }
Пример #29
0
        // tests reinstallation
        private void TestReinstall()
        {
            // change the output to immediate window flag to true
            Settings.Default.ToolList.Add(new ToolDescription(GetSampleToolDescription(false))
            {
                OutputToImmediateWindow = true
            });
            var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg);

            RunUI(() =>
            {
                ToolStoreUtil.ToolStoreClient = new TestToolStoreClient(TestFilesDir.GetTestPath("TestBasicPopulation"));
            });
            var toolStoreDlg = ShowDialog <ToolStoreDlg>(configureToolsDlg.AddFromWeb);
            var reinstallDlg = ShowDialog <MultiButtonMsgDlg>(toolStoreDlg.DownloadSelectedTool);

            OkDialog(reinstallDlg, reinstallDlg.Btn0Click);
            OkDialog(configureToolsDlg, configureToolsDlg.OkDialog);
            // on reinstall, it should be back to normal
            Assert.IsFalse(Settings.Default.ToolList.First().OutputToImmediateWindow);
            Settings.Default.ToolList.Clear();
        }
Пример #30
0
 private void ValidateIsolationSchemeImport(EditIsolationSchemeDlg isoEditor, string fileName,
                                            int windowCount, int windowWidth, double?margin)
 {
     RunDlg <OpenDataSourceDialog>(isoEditor.ImportRanges, openData =>
     {
         openData.SelectFile(TestFilesDir.GetTestPath(fileName));
         openData.Open();
     });
     WaitForConditionUI(() => windowCount == (isoEditor.GetIsolationWindows()?.Count ?? 0));
     RunUI(() =>
     {
         var listIsolationWindows = isoEditor.GetIsolationWindows();
         AssertEx.AreEqual(windowCount, listIsolationWindows.Count);
         foreach (var isolationWindow in listIsolationWindows)
         {
             AssertEx.AreEqual(windowWidth, isolationWindow.End - isolationWindow.Start,
                               string.Format("Range {0} to {1} does not have width {2}", isolationWindow.Start, isolationWindow.End, windowWidth));
             AssertEx.AreEqual(margin, isolationWindow.StartMargin);
             AssertEx.AreEqual(margin, isolationWindow.EndMargin);
         }
     });
 }