Exemplo n.º 1
0
        public void DoTestDemux(bool asSmallMolecules)
        {
            var    testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);
            string docPathMsx   = testFilesDir.GetTestPath("MsxTest.sky");
            string dataPathMsx  = testFilesDir.GetTestPath("MsxTest.mzML");
            string cachePathMsx = ChromatogramCache.FinalPathForName(docPathMsx, null);

            FileEx.SafeDelete(cachePathMsx);
            SrmDocument docMsx = ResultsUtil.DeserializeDocument(docPathMsx);

            if (asSmallMolecules)
            {
                var refine = new RefinementSettings();
                docMsx = refine.ConvertToSmallMolecules(docMsx, testFilesDir.FullPath);
            }
            var fullScanInitialMsx = docMsx.Settings.TransitionSettings.FullScan;

            Assert.IsTrue(fullScanInitialMsx.IsEnabledMsMs);

            TestMsx(docMsx, dataPathMsx);

            string docPathOverlap   = testFilesDir.GetTestPath("OverlapTest.sky");
            string dataPathOverlap  = testFilesDir.GetTestPath("OverlapTest.mzML");
            string cachePathOverlap = ChromatogramCache.FinalPathForName(docPathOverlap, null);

            FileEx.SafeDelete(cachePathOverlap);
            SrmDocument docOverlap = ResultsUtil.DeserializeDocument(docPathOverlap);

            if (asSmallMolecules)
            {
                var refine = new RefinementSettings();
                docOverlap = refine.ConvertToSmallMolecules(docOverlap, testFilesDir.FullPath);
            }
            var fullScanInitialOverlap = docMsx.Settings.TransitionSettings.FullScan;

            Assert.IsTrue(fullScanInitialOverlap.IsEnabledMsMs);
            TestOverlap(docOverlap, dataPathOverlap);
        }
Exemplo n.º 2
0
        public void WatersFileTypeTest()
        {
            var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

            string extRaw = ExtensionTestContext.ExtWatersRaw;

            // Do file type checks
            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("160109_Mix1_calcurve_075" + extRaw)))
            {
                Assert.IsTrue(msData.IsWatersFile);
                Assert.IsFalse(msData.IsWatersLockmassCorrectionCandidate);  // This file contains both scan and chromatogram data, we ignore the scan data
            }

            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("160109_Mix1_calcurve_070.mzML")))
            {
                Assert.IsTrue(msData.IsWatersFile);
            }

            // TODO: Fix Proteowizard.
            // This mzXML is from the MassWolf converter.
            // The source file types are recorded as "RAWData" and the parent file extension is .raw.
            // This ends up getting interpreted as ""Thermo RAW file" when reading with proteowizard.
            // using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("160109_Mix1_calcurve_070.mzXML")))
            // {
            //     Assert.IsFalse(msData.IsWatersFile);
            //     Assert.IsTrue(msData.IsThermoFile);
            // }

            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("160109_Mix1_calcurve_073.mzML")))
            {
                Assert.IsTrue(msData.IsWatersFile);
            }

            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("160109_Mix1_calcurve_078.mzML")))
            {
                Assert.IsTrue(msData.IsWatersFile);
            }
        }
Exemplo n.º 3
0
 protected override void DoTest()
 {
     if (!AllowInternetAccess)
     {
         return; // Not really a success, but certainly not a failure CONSIDER can we have a new attribure for tests like these?
     }
     // Open the .sky file, and and a version 0.0 protdb file that needs digesting and metadata lookup
     // The background loaders should actually hit the web services if SkylineTestRunner has enabled internet access.
     RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("backgroundtest.sky")));
     WaitForCondition(180 * 1000, () => SkylineWindow.Document.PeptideGroupCount > 0);                                                                           // doc loaded
     WaitForCondition(6 * 60 * 1000, () => (!(SkylineWindow.Document.PeptideGroups.Where(node => string.IsNullOrEmpty(node.ProteinMetadata.Accession))).Any())); // Easy protein metadata loaded
     WaitForCondition(6 * 60 * 1000, () => (!(SkylineWindow.Document.PeptideGroups.Where(node => string.IsNullOrEmpty(node.ProteinMetadata.Gene))).Any()));      // Uniprot search metadata loaded
     WaitForBackgroundProteomeLoaderCompleted();                                                                                                                 // Make sure we're done with yeast.protdb (may still be loading protein metadata) so test exits cleanly
 }
Exemplo n.º 4
0
        // download failure
        private void TestDownloadFailure()
        {
            var toolStoreDlg = ShowDialog <ToolStoreDlg>(() => ShowToolStore(TestFilesDir.GetTestPath("TestBasicPopulation"), false)); // Not L10N

            Assert.AreEqual(1, toolStoreDlg.ToolCount);
            var toolStoreItem = toolStoreDlg.GetTools().First();

            AssertToolItemEquality(GetSampleTool(), toolStoreItem);
            var errorDlg = ShowDialog <MessageDlg>(toolStoreDlg.DownloadSelectedTool);

            Assert.AreEqual(Resources.TestToolStoreClient_GetToolZipFile_Error_downloading_tool, errorDlg.Message);
            OkDialog(errorDlg, errorDlg.OkDialog);
            OkDialog(toolStoreDlg, toolStoreDlg.CancelButton.PerformClick);
        }
Exemplo n.º 5
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("SettingsChangeReimportTest.sky")));
            var idPath          = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.TransitionGroups, 0);
            var transitionGroup = (TransitionGroupDocNode)SkylineWindow.Document.FindNode(idPath);

            Assert.IsNull(transitionGroup.Results);

            // Import the file with "UseSelectiveExtraction" set to "false"
            Assert.IsFalse(SkylineWindow.Document.Settings.TransitionSettings.FullScan.UseSelectiveExtraction);
            ImportResultsFile(TestFilesDir.GetTestPath("S_1.mzML"));
            transitionGroup = (TransitionGroupDocNode)SkylineWindow.Document.FindNode(idPath);
            Assert.IsNotNull(transitionGroup.Results);
            Assert.AreEqual(1, transitionGroup.Results.Count);
            var transitionGroupChromInfo = transitionGroup.Results[0].First();

            // Verify the peak area is what we expect
            Assert.AreEqual(146015264f, transitionGroupChromInfo.Area.Value, 1f);

            // Reimport the file with "UseSelectiveExtraction" set to "true"
            RunUI(() => SkylineWindow.ModifyDocument("Change selective extraction",
                                                     doc => doc.ChangeSettings(doc.Settings.ChangeTransitionSettings(
                                                                                   doc.Settings.TransitionSettings.ChangeFullScan(doc.Settings.TransitionSettings.FullScan
                                                                                                                                  .ChangeUseSelectiveExtraction(true)))),
                                                     AuditLogEntry.SettingsLogFunction));
            Assert.IsTrue(SkylineWindow.Document.Settings.TransitionSettings.FullScan.UseSelectiveExtraction);

            // 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("S_1.mzML"), DateTime.UtcNow);

            // Do a reimport, and make sure that the manually chosen peak boundary remains
            var document = SkylineWindow.Document;

            RunDlg <ManageResultsDlg>(SkylineWindow.ManageResults, dlg =>
            {
                dlg.SelectedChromatograms = SkylineWindow.Document.MeasuredResults.Chromatograms.ToArray();
                dlg.ReimportResults();
                dlg.OkDialog();
            });
            WaitForDocumentChange(document);
            WaitForDocumentLoaded();
            transitionGroup = (TransitionGroupDocNode)SkylineWindow.Document.FindNode(idPath);
            Assert.IsNotNull(transitionGroup.Results);
            Assert.AreEqual(1, transitionGroup.Results.Count);
            transitionGroupChromInfo = transitionGroup.Results[0].First();
            // Verify that the peak area is a smaller number because the chromatogram extraction was more selective
            Assert.AreEqual(119877896f, transitionGroupChromInfo.Area.Value, 1f);
        }
Exemplo n.º 6
0
        private void VerifySerialization(string testPath, bool expect_mz5)
        {
            var text       = File.ReadAllText(testPath);
            var filePath   = TestFilesDir.GetTestPath(BSA_50fmol_TIMS_InfusionESI_10precd);
            var encodePath = SampleHelp.EncodePath(filePath, null, -1, null, false, false, !MsDataFileImpl.ForceUncombinedIonMobility);

            Assert.IsTrue(text.Contains(encodePath + '"'));
            if (expect_mz5)
            {
                filePath   = TestFilesDir.GetTestPath(bsaFmolTimsInfusionesiPrecMz5Mz5);
                encodePath = SampleHelp.EncodePath(filePath, null, -1, null, false, false, false);
                Assert.IsTrue(text.Contains(encodePath + '"'));
            }
        }
Exemplo n.º 7
0
        protected override void DoTest()
        {
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUi =>
            {
                transitionSettingsUi.SelectedTab              = TransitionSettingsUI.TABS.Filter;
                transitionSettingsUi.FragmentTypes            = @"p";
                transitionSettingsUi.SelectedTab              = TransitionSettingsUI.TABS.FullScan;
                transitionSettingsUi.PrecursorIsotopesCurrent = FullScanPrecursorIsotopes.Count;
                transitionSettingsUi.PrecursorMassAnalyzer    = FullScanMassAnalyzerType.qit;
                transitionSettingsUi.Peaks        = 1;
                transitionSettingsUi.PrecursorRes = 0.7;
                transitionSettingsUi.OkDialog();
            });
            var peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() =>
            {
                peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Modifications;
            });
            var editModListDlg = ShowEditStaticModsDlg(peptideSettingsUi);

            // Define a crosslinker which is a water loss. In this way, two peptides can be joined end to end
            // and will have the same chemical formula as a single concatenated peptide
            RunDlg <EditStaticModDlg>(editModListDlg.AddItem, editStaticModDlg => {
                {
                    editStaticModDlg.Modification  = new StaticMod(crosslinkerName, null, null, "-H2O");
                    editStaticModDlg.IsCrosslinker = true;
                    editStaticModDlg.OkDialog();
                }
            });
            RunDlg <EditStaticModDlg>(editModListDlg.AddItem, editStaticModDlg =>
            {
                editStaticModDlg.Modification = UniMod.GetModification("Oxidation (M)", true);
                editStaticModDlg.OkDialog();
            });
            OkDialog(editModListDlg, editModListDlg.OkDialog);
            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);
            var peptidesToPaste = TextUtil.LineSeparate(PEPTIDE_SEQUENCES.Select(MakeCrosslinkedSequence));

            RunDlg <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg, pasteDlg =>
            {
                SetClipboardText(peptidesToPaste);
                pasteDlg.PastePeptides();
                pasteDlg.OkDialog();
            });
            RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath("CrosslinkChromatogramTest.sky")));
            ImportResultsFile(TestFilesDir.GetTestPath("CAexample.mzXML"));
            RunUI(() => SkylineWindow.ShowRTRegressionGraphScoreToRun());
            RunUI(() => SkylineWindow.SaveDocument());
        }
Exemplo n.º 8
0
        private void RunScenario(string scenarioName)
        {
            RunUI(() => SkylineWindow.OpenSharedFile(TestFilesDir.GetTestPath(scenarioName + ".sky.zip")));
            if (null != TestContext.TestRunResultsDirectory)
            {
                var directory = Path.Combine(TestContext.TestRunResultsDirectory, "GroupComparisonScenariosTest");
                Directory.CreateDirectory(directory);
                string baseName = Path.Combine(directory, scenarioName);
                RunUI(() => SkylineWindow.ShareDocument(baseName + ".sky.zip", ShareType.COMPLETE));
                foreach (var groupComparison in SkylineWindow.Document.Settings.DataSettings.GroupComparisonDefs)
                {
                    String         groupComparisonName = groupComparison.Name;
                    FoldChangeGrid foldChangeGrid      =
                        ShowDialog <FoldChangeGrid>(() => SkylineWindow.ShowGroupComparisonWindow(groupComparisonName));
                    var reports = new[]
                    {
                        "GroupComparisonColumns"
                    };
                    var dsvWriter = new DsvWriter(CultureInfo.InvariantCulture, ',')
                    {
                        NumberFormatOverride = Formats.RoundTrip
                    };
                    foreach (String report in reports)
                    {
                        WaitForConditionUI(() => foldChangeGrid.DataboundGridControl.IsComplete &&
                                           null != foldChangeGrid.FoldChangeBindingSource.GroupComparisonModel.Results &&
                                           null != foldChangeGrid.DataboundGridControl.BindingListSource.ViewContext);

                        // ReSharper disable AccessToForEachVariableInClosure
                        RunUI(() => { foldChangeGrid.DataboundGridControl.ChooseView(report); });
                        // ReSharper restore AccessToForEachVariableInClosure

                        WaitForConditionUI(() => foldChangeGrid.DataboundGridControl.IsComplete);
                        String exportPath = Path.Combine(directory,
                                                         scenarioName + "_" + groupComparisonName + "_" + report + ".csv");

                        RunUI(() =>
                        {
                            var viewContext = (AbstractViewContext)foldChangeGrid.DataboundGridControl.NavBar.ViewContext;

                            viewContext.ExportToFile(foldChangeGrid,
                                                     foldChangeGrid.DataboundGridControl.BindingListSource, exportPath,
                                                     dsvWriter);
                        }
                              );
                    }
                    OkDialog(foldChangeGrid, foldChangeGrid.Close);
                }
            }
        }
Exemplo n.º 9
0
        private void DoTestAgilentCEOpt()
        {
            // The special mode for exercising non-proteomic molecules just doesn't make sense with this test
            TestSmallMolecules = false;

            var    testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);
            string docPath      = testFilesDir.GetTestPath(DOCUMENT_NAME);
            string cachePath    = ChromatogramCache.FinalPathForName(docPath, null);

            FileEx.SafeDelete(cachePath);
            SrmDocument doc = ResultsUtil.DeserializeDocument(docPath);

            using (var docContainer = new ResultsTestDocumentContainer(doc, docPath))
            {
                // Import the .d file
                Import(docContainer, testFilesDir.GetTestPath(RESULTS_NAME), true);
            }
            using (var docContainer = new ResultsTestDocumentContainer(doc, docPath))
            {
                // Import the .d file
                Import(docContainer, testFilesDir.GetTestPath(RESULTS_NAME), false);
            }
        }
Exemplo n.º 10
0
        private static SrmDocument InitWatersImsMseDocument(TestFilesDir testFilesDir, string skyFile,
                                                            RefinementSettings.ConvertToSmallMoleculesMode asSmallMolecules,
                                                            out string docPath)
        {
            docPath = testFilesDir.GetTestPath(skyFile);
            var cmdline = new CommandLine();

            Assert.IsTrue(cmdline.OpenSkyFile(docPath)); // Handles any path shifts in database files, like our .imdb file
            SrmDocument doc    = cmdline.Document;
            var         refine = new RefinementSettings();

            doc = refine.ConvertToSmallMolecules(doc, asSmallMolecules);
            return(doc);
        }
Exemplo n.º 11
0
        // tool is installed and is the most recent version
        private void TestToolFullyUpdated()
        {
            Settings.Default.ToolList.Add(GetSampleToolDescription(false));
            var toolStoreDlg = ShowDialog <ToolStoreDlg>(() => ShowToolStore(TestFilesDir.GetTestPath("TestBasicPopulation"), false)); // Not L10N

            Assert.AreEqual(1, toolStoreDlg.ToolCount);
            var toolStoreItem = toolStoreDlg.GetTools().First();

            AssertToolItemEquality(GetSampleTool(), toolStoreItem);
            Assert.IsTrue(toolStoreItem.Installed);
            Assert.IsTrue(toolStoreItem.IsMostRecentVersion);
            OkDialog(toolStoreDlg, toolStoreDlg.CancelButton.PerformClick);
            Settings.Default.ToolList.Clear();
        }
Exemplo n.º 12
0
        private void ImportResultFile(bool optimizing)
        {
            var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            if (optimizing)
            {
                RunUI(() => importResultsDlg.OptimizationName = ExportOptimize.CE);
            }
            var openDataSourceDialog = ShowDialog <OpenDataSourceDialog>(importResultsDlg.OkDialog);

            RunUI(() => openDataSourceDialog.SelectFile(TestFilesDir.GetTestPath("ChromDataSetMatchingTest.mzML")));
            OkDialog(openDataSourceDialog, openDataSourceDialog.Open);
            WaitForDocumentLoaded();
        }
Exemplo n.º 13
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();
                    IProgressStatus status  = new ProgressStatus(string.Empty);
                    using (var reader = new StreamReader(fastaPath))
                    {
                        proteomeDb.AddFastaFile(reader, new SilentProgressMonitor(), ref status, true); // Delay indexing
                    }
                    // perform digestion
                    proteomeDb.Digest(new ProteaseImpl(trypsin), ProteomeDb.PROTDB_MAX_MISSED_CLEAVAGES, new SilentProgressMonitor(), ref status);
                    Digestion digestion         = proteomeDb.GetDigestion(trypsin.Name);
                    var       digestedProteins0 = digestion.GetProteinsWithSequencePrefix("EDGWVK", 100);
                    Assert.IsTrue(digestedProteins0.Count >= 1);
                }
            }
        }
Exemplo n.º 14
0
        public void TestWiffCommandLineImport()
        {
            var    testFilesDir = new TestFilesDir(TestContext, ZIP_PATH);
            string docPath      = testFilesDir.GetTestPath(DOC_NAME);
            string rawPath      = testFilesDir.GetTestPath(WIFF_NAME);

            RunCommand("--in=" + docPath,
                       "--import-file=" + rawPath,
                       "--save");
            using (var stream = File.OpenRead(docPath))
            {
                var doc = (SrmDocument) new XmlSerializer(typeof(SrmDocument)).Deserialize(stream);
                Assert.IsTrue(doc.Settings.HasResults);
                Assert.AreEqual(SAMPLE_NAMES.Count, doc.Settings.MeasuredResults.Chromatograms.Count);
                for (int i = 0; i < SAMPLE_NAMES.Count; i++)
                {
                    var chromatogramSet = doc.Settings.MeasuredResults.Chromatograms[i];
                    Assert.AreEqual(SAMPLE_NAMES[i], chromatogramSet.Name);
                    Assert.AreEqual(1, chromatogramSet.MSDataFilePaths.Count());
                    var msDataFilePath = chromatogramSet.MSDataFilePaths.First() as MsDataFilePath;
                    Assert.IsNotNull(msDataFilePath);
                    Assert.AreEqual(i, msDataFilePath.SampleIndex);
                    Assert.AreEqual(SAMPLE_NAMES[i], msDataFilePath.SampleName);
                    Assert.AreEqual(rawPath, msDataFilePath.FilePath);
                }
            }
            // Import the file a second time, and make sure it does not result in 8 replicates.
            RunCommand("--in=" + docPath,
                       "--import-file=" + rawPath,
                       "--save");
            using (var stream = File.OpenRead(docPath))
            {
                var doc = (SrmDocument) new XmlSerializer(typeof(SrmDocument)).Deserialize(stream);
                Assert.IsTrue(doc.Settings.HasResults);
                Assert.AreEqual(SAMPLE_NAMES.Count, doc.Settings.MeasuredResults.Chromatograms.Count);
            }
        }
Exemplo n.º 15
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("ABSciex4000_Study9-1_Site19_CalCurves only.sky")));
            if (_asSmallMolecules)
            {
                ConvertDocumentToSmallMolecules(RefinementSettings.ConvertToSmallMoleculesMode.formulas,
                                                RefinementSettings.ConvertToSmallMoleculesChargesMode.none, true);
            }
            // Test select all
            RunUI(() =>
            {
                SkylineWindow.SelectAll();
                SkylineWindow.ShowGraphPeakArea(true);
            });
            WaitForGraphs();
            Assert.AreEqual(6, SkylineWindow.GraphPeakArea.CurveCount);

            // Test selecting each node down to the peptide/precursor level
            foreach (var node in SkylineWindow.SequenceTree.Nodes)
            {
                if (!(node is TreeNode) || node is EmptyNode)
                {
                    continue;
                }
                var peptideGroupTreeNode = node as TreeNode;
                SelectNode(peptideGroupTreeNode);
                int curveCount = 0;
                switch (peptideGroupTreeNode.Text)
                {
                case "sp|P09972|ALDOC_HUMAN":
                    curveCount = 5;
                    break;

                case "sp|P04083|ANXA1_HUMAN":
                    curveCount = 1;
                    break;
                }
                Assert.AreEqual(curveCount, SkylineWindow.GraphPeakArea.CurveCount);
                SummaryReplicateGraphPane pane;
                Assert.IsTrue(SkylineWindow.GraphPeakArea.TryGetGraphPane(out pane));
                Assert.IsFalse(pane.Legend.IsVisible);
                // Select indavidual peptides
                foreach (TreeNode peptide in peptideGroupTreeNode.Nodes)
                {
                    SelectNode(peptide);
                    Assert.AreNotEqual(0, SkylineWindow.GraphRetentionTime.CurveCount);
                }
            }
        }
Exemplo n.º 16
0
        protected override void DoTest()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("MultiSelectRetentionTimeTest.sky")));
            Assert.AreEqual(BarType.Cluster, SkylineWindow.GraphRetentionTime.GraphControl.GraphPane.BarSettings.Type);
            // Test select all
            RunUI(() =>
            {
                SkylineWindow.SelectAll();
                SkylineWindow.ShowGraphRetentionTime(true);
            });
            WaitForGraphs();
            Assert.AreEqual(BarType.SortedOverlay, SkylineWindow.GraphRetentionTime.GraphControl.GraphPane.BarSettings.Type);
            Assert.AreEqual(18, SkylineWindow.GraphRetentionTime.CurveCount);

            // Test selecting each node down to the peptide/precursor level
            foreach (var node in SkylineWindow.SequenceTree.Nodes)
            {
                if (!(node is TreeNode) || node is EmptyNode)
                {
                    continue;
                }
                var peptideGroupTreeNode = node as TreeNode;
                SelectNode(peptideGroupTreeNode);
                int curveCount = 0;
                switch (peptideGroupTreeNode.Text)
                {
                case "sp|P02647|APOA1_HUMAN":
                    curveCount = 8;
                    break;

                case "GST_SCHJA_Fusion_Peptide":
                    curveCount = 2;
                    break;

                case "PRTC peptides":
                    curveCount = 8;
                    break;
                }
                Assert.AreEqual(curveCount, SkylineWindow.GraphRetentionTime.CurveCount);
                Assert.AreEqual(BarType.SortedOverlay, SkylineWindow.GraphRetentionTime.GraphControl.GraphPane.BarSettings.Type);
                SummaryReplicateGraphPane pane;
                Assert.IsTrue(SkylineWindow.GraphRetentionTime.TryGetGraphPane(out pane));

                // Select first indavidual peptide (not worth selecting them all - slows test for not much extra coverage)
                SelectNode(peptideGroupTreeNode.Nodes[0]);
                Assert.AreEqual(4, SkylineWindow.GraphRetentionTime.CurveCount);  // All peptides have 4 precursor ions
                Assert.AreEqual(BarType.Cluster, SkylineWindow.GraphRetentionTime.GraphControl.GraphPane.BarSettings.Type);
            }
        }
Exemplo n.º 17
0
        public void WatersLockmassCmdlinePerfTest()
        {
            if (IsPerfTest && !RunPerfTests)
            {
                return; // Don't want to run this lengthy test right now
            }

            TestFilesZip        = GetPerfTestDataURL(@"PerfTestLockmass_v2.zip");
            TestFilesPersistent = new[] { "ID19638_01_UCA195_2533_082715.raw" }; // List of files that we'd like to unzip alongside parent zipFile, and (re)use in place
            TestFilesDir        = new TestFilesDir(TestContext, TestFilesZip, "CmdlineTest", TestFilesPersistent);

            var skyfile = GetTestPath("2533_FattyAcids.sky");

            var          rawPath          = GetTestPath(TestFilesPersistent[0]);
            const double lockmassNegative = 554.2615;
            const double lockmassToler    = 0.25; // Per Hans Vissers @ Waters

            // Exercise the commandline
            var outPathUncorrected = TestFilesDir.GetTestPath("cmdlineTestUncorrected.sky");
            var outPathCorrected   = TestFilesDir.GetTestPath("cmdlineTestCorrected.sky");

            RunCommand("--in=" + skyfile,
                       "--import-file=" + rawPath,
                       "--out=" + outPathUncorrected);
            FileEx.SafeDelete(Path.ChangeExtension(skyfile, ChromatogramCache.EXT));
            var cmdDocUncorrected = ResultsUtil.DeserializeDocument(outPathUncorrected);

            RunCommand("--in=" + skyfile,
                       "--import-file=" + rawPath,
                       "--import-lockmass-negative=" + lockmassNegative,
                       "--import-lockmass-tolerance=" + lockmassToler,
                       "--out=" + outPathCorrected);
            var cmdDocCorrected = ResultsUtil.DeserializeDocument(outPathCorrected);

            ComparePeaks(cmdDocCorrected, cmdDocUncorrected);
        }
Exemplo n.º 18
0
        protected override void DoTest()
        {
            //import some data
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("RetentionTimeFilterTest.sky")));
            WaitForDocumentLoaded();
            var docOriginal = SkylineWindow.Document;

            TestErrorMessages();
            TestName();

            SkylineWindow.SetDocument(docOriginal, SkylineWindow.Document);
            TestAccession();
            SkylineWindow.SetDocument(docOriginal, SkylineWindow.Document);
            TestPreferred();
        }
Exemplo n.º 19
0
        private void DoTestImportSim(bool asSmallMolecules)
        {
            TestSmallMolecules = false; // Don't need that magic extra node
            var    testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);
            string docPath      = testFilesDir.GetTestPath(DOCUMENT_NAME);
            string cachePath    = ChromatogramCache.FinalPathForName(docPath, null);

            FileEx.SafeDelete(cachePath);
            SrmDocument doc = ResultsUtil.DeserializeDocument(docPath);

            var pepdoc = doc;

            if (asSmallMolecules)
            {
                var refine = new RefinementSettings();
                doc = refine.ConvertToSmallMolecules(pepdoc);
            }

            var docContainer = new ResultsTestDocumentContainer(doc, docPath);

            // Import the mzML file and verify Mz range
            Import(docContainer, testFilesDir.GetTestPath(RESULTS_NAME), 510, 512);
            Import(docContainer, testFilesDir.GetTestPath(RESULTS_NAME2), 555, 557);
        }
        protected override void DoTest()
        {
            string skylinePath = TestFilesDir.GetTestPath("ExplicitAnalyteConcentrationTest.sky");

            RunUI(() => SkylineWindow.OpenFile(skylinePath));
            SetSampleTypes();
            CreatExplicitConcentrationReport();
            FillInExplicitConcentrations();
            CheckCalibrationCurves();
            RunUI(() => SkylineWindow.SaveDocument());
            RunUI(() => SkylineWindow.NewDocument());
            RunUI(() => SkylineWindow.OpenFile(skylinePath));
            WaitForDocumentLoaded();
            CheckCalibrationCurves();
        }
Exemplo n.º 21
0
        public void TestInstrumentInfo()
        {
            const string testZipPath = @"TestData\PwizFileInfoTest.zip";

            var testFilesDir = new TestFilesDir(TestContext, testZipPath);

            // Waters file (.raw directory) and mz5 equivalent
            foreach (
                var ext in
                new[]
                { ExtensionTestContext.ExtWatersRaw, ExtensionTestContext.ExtMz5 })
            {
                VerifyInstrumentInfo(testFilesDir.GetTestPath("160109_Mix1_calcurve_075" + ext),
                                     "Waters instrument model", "", "", "");
            }

            // ABI .wiff file
            if (ExtensionTestContext.CanImportAbWiff)
            {
                VerifyInstrumentInfo(testFilesDir.GetTestPath("051309_digestion.wiff"),
                                     "4000 QTRAP", "electrospray ionization", "quadrupole/quadrupole/axial ejection linear ion trap", "electron multiplier");
            }

            if (ExtensionTestContext.CanImportAbWiff2)
            {
                VerifyInstrumentInfo(testFilesDir.GetTestPath("OnyxTOFMS.wiff2"),
                                     "TripleTOF 5600", "electrospray ionization", "quadrupole/quadrupole/time-of-flight", "electron multiplier");
            }

            // MzWiff generated mzXML files
            VerifyInstrumentInfo(testFilesDir.GetTestPath("051309_digestion-s3.mzXML"),
                                 "4000 Q Trap", "electrospray ionization", "TOFMS", "");

            // Agilent file (.d directory)
            VerifyInstrumentInfo(testFilesDir.GetTestPath("081809_100fmol-MichromMix-05" + ExtensionTestContext.ExtAgilentRaw),
                                 "Agilent instrument model", "nanoelectrospray", "quadrupole/quadrupole/quadrupole", "electron multiplier");

            // Shimadzu TOF file (.lcd file)
            VerifyInstrumentInfo(testFilesDir.GetTestPath("10nmol_Negative_MS_ID_ON_055" + ExtensionTestContext.ExtShimadzuRaw),
                                 "Shimadzu instrument model", "electrospray ionization", "quadrupole/quadrupole/time-of-flight", "microchannel plate detector");

            // Thermo .raw|mzML file
            foreach (
                var ext in
                new[]
                { ExtensionTestContext.ExtThermoRaw, ExtensionTestContext.ExtMzml })
            {
                VerifyInstrumentInfo(testFilesDir.GetTestPath("CE_Vantage_15mTorr_0001_REP1_01" + ext),
                                     "TSQ Vantage", "nanoelectrospray", "quadrupole/quadrupole/quadrupole", "electron multiplier");
            }
        }
Exemplo n.º 22
0
        protected override void DoTest()
        {
            var exportLiveReportDlg = ShowDialog <ExportLiveReportDlg>(SkylineWindow.ShowExportReportDialog);
            var manageViewsForm     = ShowDialog <ManageViewsForm>(exportLiveReportDlg.EditList);

            RunUI(() => manageViewsForm.ImportViews(TestFilesDir.GetTestPath("GroupComparisonReports.skyr")));
            OkDialog(manageViewsForm, manageViewsForm.OkDialog);
            OkDialog(exportLiveReportDlg, exportLiveReportDlg.CancelClick);
            var scenarioNames = new[] { "Rat_plasma" };

            foreach (var scenarioName in scenarioNames)
            {
                RunScenario(scenarioName);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Test managing library runs in a document library.
        /// </summary>
        protected override void DoTest()
        {
            // Open the .sky file
            DocumentPath = TestFilesDir.GetTestPath("ManageLibraryRunsTest.sky");
            RunUI(() => SkylineWindow.OpenFile(DocumentPath));
            WaitForDocumentLoaded();

            // Ensure it has a document library, and the library blib and redundant.blib files exist
            Assert.IsTrue(VerifyDocumentLibrary());

            TestLibraryInfo();
            TestRemoveOneLibraryRunAndCorrespondingReplicates();
            TestRemoveOneReplicateAndCorrespondingLibraryRuns();
            TestRemoveAllLibraryRuns();
        }
Exemplo n.º 24
0
        private SrmDocument InitExplicitRTDocument(TestFilesDir testFilesDir, string fileName, out string docPath)
        {
            docPath = testFilesDir.GetTestPath(fileName);

            var documentFile = TestFilesDir.GetTestPath(docPath);

            WaitForCondition(() => File.Exists(documentFile));
            RunUI(() =>
            {
                SkylineWindow.OpenFile(documentFile + "d");                               //Highjacking this existing test to also test our handling of user trying to open a Skyline-related file (like .skyd) instead of actual Skyline file
                SkylineWindow.SaveDocument(documentFile.Replace(".sky", "_updated.sky")); // These are some of our oldest small mol docs, save an updated version for debug ease
            });

            OpenDocument(docPath);
            return(SkylineWindow.Document);
        }
Exemplo n.º 25
0
        public void ShimadzuFileTypeTest()
        {
            var testFilesDir = new TestFilesDir(TestContext, ZIP_FILE);

            string extRaw = ExtensionTestContext.ExtShimadzuRaw;

            // Do file type check
            using (var msData = new MsDataFileImpl(testFilesDir.GetTestPath("BSA-digest__MRM_optimisation_SL_scheduled_001" + extRaw)))
            {
                Assert.IsTrue(msData.IsShimadzuFile);

                // check time is minutes
                msData.GetChromatogram(msData.ChromatogramCount - 1, out _, out float[] times, out _);
                Assert.AreEqual(new KeyValuePair <float, float>(5.908167f, 8.905833f), new KeyValuePair <float, float>(times.First(), times.Last()));
            }
        }
Exemplo n.º 26
0
        // [TestMethod]  // disabling this since the test file URLs don't exist
        public void ConvertOpenSwathPerf()
        {
            if (!RunPerfTests)
            {
                return; // PerfTests only run when the global "allow perf tests" flag is set
            }
            TestFilesZip =
                @"http://proteome.gs.washington.edu/software/test/skyline-perf/HasmikProcessing.zip";
            var testFilesDir = new TestFilesDir(TestContext, TestFilesZip, null, TestFilesPersistent);


            var    inFiles = INDIVIDUAL_OUTPUT.Select(testFilesDir.GetTestPath);
            string outFile = testFilesDir.GetTestPath("Spectronaut.csv");

            RunConversion(inFiles, outFile);
        }
Exemplo n.º 27
0
        private SrmDocument InitExplicitRTDocument(TestFilesDir testFilesDir, string fileName, out string docPath)
        {
            docPath = testFilesDir.GetTestPath(fileName);

            var documentFile = TestFilesDir.GetTestPath(docPath);

            WaitForCondition(() => File.Exists(documentFile));
            RunUI(() =>
            {
                SkylineWindow.OpenFile(documentFile);
                SkylineWindow.SaveDocument(documentFile.Replace(".sky", "_updated.sky")); // These are some of our oldest small mol docs, save an updated version for debug ease
            });

            OpenDocument(docPath);
            return(SkylineWindow.Document);
        }
Exemplo n.º 28
0
        private void BuildLibrary(string inputDir, IEnumerable <string> inputFiles,
                                  string libraryPath, string libraryAuth, bool keepRedundant, bool filterPeptides, bool append)
        {
            EnsurePeptideSettings();

            var           buildLibraryDlg = ShowDialog <BuildLibraryDlg>(PeptideSettingsUI.ShowBuildLibraryDlg);
            List <string> inputPaths      = null;

            if (inputFiles != null)
            {
                inputPaths = new List <string>(inputFiles).ConvertAll(f => Path.Combine(inputDir, f));
            }
            string autoLibPath = null;
            string autoLibId   = null;

            RunUI(() =>
            {
                if (libraryPath != null)
                {
                    buildLibraryDlg.LibraryPath = libraryPath;
                }
                buildLibraryDlg.LibraryName = _libraryName;
                autoLibPath = buildLibraryDlg.LibraryPath;
                autoLibId   = buildLibraryDlg.LibraryId;
                buildLibraryDlg.LibraryKeepRedundant  = keepRedundant;
                buildLibraryDlg.LibraryFilterPeptides = filterPeptides;
                buildLibraryDlg.LibraryBuildAction    = (append ?
                                                         LibraryBuildAction.Append : LibraryBuildAction.Create);
                if (libraryAuth != null)
                {
                    buildLibraryDlg.LibraryAuthority = libraryAuth;
                }
                buildLibraryDlg.OkWizardPage();
                if (inputPaths != null)
                {
                    buildLibraryDlg.AddInputFiles(inputPaths);
                }
                else
                {
                    buildLibraryDlg.AddDirectory(inputDir);
                }
            });
            OkDialog(buildLibraryDlg, buildLibraryDlg.OkWizardPage);
            Assert.AreEqual(TestFilesDir.GetTestPath(_libraryName + BiblioSpecLiteSpec.EXT),
                            autoLibPath);
            Assert.AreEqual(_libraryName, autoLibId);
        }
Exemplo n.º 29
0
        // adding multiple tools to the store
        private void TestMultipleTools()
        {
            var toolStoreDlg = ShowDialog <ToolStoreDlg>(() => ShowToolStore(TestFilesDir.GetTestPath("TestMultipleTools"), false)); // Not L10N

            Assert.AreEqual(2, toolStoreDlg.ToolCount);
            var toolStoreItem1 = toolStoreDlg.GetTools().First();

            AssertToolItemEquality(GetSampleTool(), toolStoreItem1);
            Assert.IsFalse(toolStoreItem1.Installed);
            Assert.IsFalse(toolStoreItem1.IsMostRecentVersion);
            var toolStoreItem2 = toolStoreDlg.GetTools().ElementAt(1);

            AssertToolItemEquality(GetSampleToolAlternate(), toolStoreItem2);
            Assert.IsFalse(toolStoreItem2.Installed);
            Assert.IsFalse(toolStoreItem2.IsMostRecentVersion);
            OkDialog(toolStoreDlg, toolStoreDlg.CancelButton.PerformClick);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Tests deleting peptides when the view has been pivoted.
        /// This test deletes the peptides which are in rows 4 through 9.
        /// </summary>
        private void TestRemovePivotedPeptides()
        {
            RunUI(() => SkylineWindow.OpenFile(TestFilesDir.GetTestPath("RowActionsTest.sky")));
            WaitForDocumentLoaded();
            RunUI(() => SkylineWindow.ShowDocumentGrid(true));
            var documentGrid = FindOpenForm <DocumentGridForm>();
            var viewName     = new ViewName(PersistedViews.MainGroup.Id, "TransitionAreas");

            RunUI(() =>
            {
                documentGrid.DataboundGridControl.ChooseView(viewName);
            });
            Assert.AreEqual(4, SkylineWindow.Document.MoleculeCount);

            var layoutList = documentGrid.DataboundGridControl.BindingListSource.ViewContext.GetViewLayoutList(viewName);
            var layout     = layoutList.FindLayout("GroupedByPeptideAndReplicate");

            Assert.IsNotNull(layout);
            RunUI(() => documentGrid.DataboundGridControl.BindingListSource.ApplyLayout(layout));
            WaitForConditionUI(() => documentGrid.IsComplete);
            WaitForConditionUI(() => 3 == documentGrid.DataGridView.ColumnCount);
            Assert.AreEqual(12, documentGrid.DataGridView.RowCount);
            RunUI(() =>
            {
                for (int i = 0; i < documentGrid.DataGridView.RowCount; i++)
                {
                    documentGrid.DataGridView.Rows[i].Selected = i >= 3 && i < 9;
                }
            });
            var deletePeptidesAction = GetDropDownItems(documentGrid.NavBar.ActionsButton)
                                       .FirstOrDefault(item => item.Text == DeleteNodesAction.Peptides.GetMenuItemText(SrmDocument.DOCUMENT_TYPE.proteomic));

            Assert.IsNotNull(deletePeptidesAction);
            var    confirmDialog   = ShowDialog <AlertDlg>(deletePeptidesAction.PerformClick);
            string expectedMessage = string.Format(
                Resources.Peptide_GetDeleteConfirmation_Are_you_sure_you_want_to_delete_these__0__peptides_, 2);

            Assert.AreEqual(expectedMessage, confirmDialog.Message);
            OkDialog(confirmDialog, confirmDialog.ClickOk);
            Assert.AreEqual(2, SkylineWindow.Document.MoleculeCount);
            Assert.AreEqual("GLVLIAFSQYLQQCPFDEHVK", SkylineWindow.Document.Molecules.First().Peptide.Sequence);
            Assert.AreEqual("LVNELTEFAK", SkylineWindow.Document.Molecules.Skip(1).First().Peptide.Sequence);
            var alertDlg = ShowDialog <AlertDlg>(SkylineWindow.NewDocument);

            OkDialog(alertDlg, alertDlg.ClickNo);
        }