public void cannotFindMassTag_test1() { // var testFile = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 26523; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 1 select n).First(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult; Assert.IsNull(result.IsotopicProfile); Assert.IsNull(result.ScanSet); Assert.IsNull(result.ChromPeakSelected); Assert.IsTrue(result.FailedResult); Assert.AreEqual(DeconTools.Backend.Globals.TargetedResultFailureType.ChrompeakNotFoundWithinTolerances, result.FailureType); }
public void testVladsData() { var testFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\RawData\Alz_P01_A01_097_26Apr12_Roc_12-03-15.RAW"; var massTagFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2_First60.txt"; var peakTestFile = testFile.Replace(".RAW", "_peaks.txt"); var run = RunUtilities.CreateAndAlignRun(testFile, peakTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24653; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 1 select n).First(); TargetedWorkflowParameters parameters = new O16O18WorkflowParameters(); parameters.ChromNETTolerance = 0.2; parameters.MSToleranceInPPM = 10; parameters.ChromGeneratorMode = Globals.ChromatogramGeneratorMode.O16O18_THREE_MONOPEAKS; parameters.ChromPeakDetectorPeakBR = 1; parameters.ChromatogramCorrelationIsPerformed = true; var workflow = new O16O18Workflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as O16O18TargetedResultObject; Assert.IsTrue(workflow.Success); Assert.IsFalse(result.FailedResult); result.DisplayToConsole(); Console.WriteLine("Correlation between 016 and O18(double label)= " + result.ChromCorrO16O18DoubleLabel); Assert.IsTrue(result.ChromCorrO16O18DoubleLabel > 0); Console.WriteLine("theor monomass= \t" + result.Target.MonoIsotopicMass); Console.WriteLine("monomass= \t" + result.IsotopicProfile.MonoIsotopicMass); Console.WriteLine("ppmError before= \t" + result.MassErrorBeforeAlignment); Console.WriteLine("ppmError after= \t" + result.MassErrorAfterAlignment); }
public void IqWorkflowTest1() { //see https://jira.pnnl.gov/jira/browse/OMCS-709 var testFile = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24800; var oldStyleTarget = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromatogramCorrelationIsPerformed = true; parameters.ChromSmootherNumPointsInSmooth = 9; parameters.ChromPeakDetectorPeakBR = 1; parameters.ChromPeakDetectorSigNoise = 1; IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters); IqTarget target = new IqChargeStateTarget(iqWorkflow); target.ID = oldStyleTarget.ID; target.MZTheor = oldStyleTarget.MZ; target.ElutionTimeTheor = oldStyleTarget.NormalizedElutionTime; target.MonoMassTheor = oldStyleTarget.MonoIsotopicMass; target.EmpiricalFormula = oldStyleTarget.EmpiricalFormula; target.ChargeState = oldStyleTarget.ChargeState; Console.WriteLine(target.EmpiricalFormula + "\t" + target.ChargeState); target.DoWorkflow(); var result = target.GetResult(); Assert.IsNotNull(result, "result is null"); var reportString = result.ToStringWithDetailedReport(); Console.WriteLine(reportString); }
public void exporterTest1() { var testFile = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_NETVals0.3-0.33.txt"; var exportedResultFile = Path.Combine(FileRefs.OutputFolderPath, "UnlabelledTargetedResultsExporterOutput1.txt"); if (File.Exists(exportedResultFile)) { File.Delete(exportedResultFile); } var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var selectedMassTags = mtc.TargetList.OrderBy(p => p.ID).Take(10).ToList(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); var workflow = new BasicTargetedWorkflow(run, parameters); foreach (var mt in selectedMassTags) { run.CurrentMassTag = mt; workflow.Execute(); } var repo = new TargetedResultRepository(); repo.AddResults(run.ResultCollection.GetMassTagResults()); var exporter = new UnlabelledTargetedResultToTextExporter(exportedResultFile); exporter.ExportResults(repo.Results); }
public void WorkflowTest1() { //GORD: 3/18/2013 - this test is broken. We need to fix the N14N15 workflow and get this to pass // See: https://jira.pnnl.gov/jira/browse/OMCS-409 var run = RunUtilities.CreateAndAlignRun(bruker9t_samplefile1, bruker9t_peaksfile1); var targetsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\N14N15_standard_testing\Targets\POnly_MassTagsMatchingInHalfOfDatasets_Filtered0.45-0.47NET_first18.txt"; var importer = new MassTagFromTextFileImporter(targetsFile); var targetCollection = importer.Import(); run.CurrentMassTag = targetCollection.TargetList.FirstOrDefault(p => p.ChargeState == 1); var parameters = new N14N15Workflow2Parameters(); parameters.LoadParameters(Path.Combine(FileRefs.ImportedData, "importedN14N15WorkflowParameters.xml")); parameters.ChromGenTolerance = 25; parameters.MSToleranceInPPM = 25; parameters.TargetedFeatureFinderToleranceInPPM = 25; parameters.MultipleHighQualityMatchesAreAllowed = true; parameters.NumMSScansToSum = 5; parameters.SaveParametersToXML( @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\N14N15_standard_testing\Parameters\N14N15WorkflowParameters1_test.xml"); Console.WriteLine(parameters.ToStringWithDetails()); var workflow = new N14N15Workflow2(run, parameters); workflow.Execute(); Assert.IsTrue(run.ResultCollection.ResultType == Globals.ResultType.N14N15_TARGETED_RESULT); //TestUtilities.DisplayXYValues(workflow.ChromatogramXYData); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as N14N15_TResult; result.DisplayToConsole(); Assert.AreEqual(23085448, result.Target.ID); Assert.AreEqual(1, result.IsotopicProfile.ChargeState); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.IsNotNull(result.ChromPeakSelectedN15); return; Assert.AreEqual(1639.3m, (decimal)Math.Round(result.ChromPeakSelected.XValue, 1)); Assert.AreEqual(1638.5m, (decimal)Math.Round(result.ChromPeakSelectedN15.XValue, 1)); Assert.IsNotNull(result.IsotopicProfile); Assert.IsNotNull(result.IsotopicProfileLabeled); Console.WriteLine("theor monomass= \t" + result.Target.MonoIsotopicMass); Console.WriteLine("monomass= \t" + result.IsotopicProfile.MonoIsotopicMass); Console.WriteLine("monomassN15= \t" + result.IsotopicProfileLabeled.MonoIsotopicMass); Console.WriteLine("monoMZ= \t" + result.IsotopicProfile.MonoPeakMZ); Console.WriteLine("monoMZN15= \t" + result.IsotopicProfileLabeled.MonoPeakMZ); Console.WriteLine("ppmError= \t" + result.MassErrorAfterAlignment); Console.WriteLine("Database NET= " + result.Target.NormalizedElutionTime); Console.WriteLine("Result NET= " + result.GetNET()); Console.WriteLine("Result NET Error= " + result.GetNETAlignmentError()); Console.WriteLine("NumChromPeaksWithinTol= " + result.NumChromPeaksWithinTolerance); Console.WriteLine("NumChromPeaksWithinTolN15= " + result.NumChromPeaksWithinToleranceForN15Profile); }
public void findSingleMassTag_test1() { //see https://jira.pnnl.gov/jira/browse/OMCS-709 var testFile = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24800; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromatogramCorrelationIsPerformed = true; parameters.ChromSmootherNumPointsInSmooth = 9; parameters.ChromPeakDetectorPeakBR = 1; parameters.ChromPeakDetectorSigNoise = 1; var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); Assert.IsNotNull(workflow.ChromatogramXYData, "Chrom XY data is empty"); Assert.IsNotEmpty(workflow.ChromPeaksDetected, "Chrom peaks are empty"); Console.WriteLine("Chrom peaks detected"); foreach (var chromPeak in workflow.ChromPeaksDetected) { Console.WriteLine(chromPeak.XValue.ToString("0.0") + "\t" + chromPeak.Height.ToString("0") + "\t" + chromPeak.Width.ToString("0.0")); } Assert.AreEqual(3, workflow.ChromPeaksDetected.Count); Assert.IsNotNull(workflow.ChromPeakSelected, "No chrom peak was selected"); Assert.IsNotNull(workflow.MassSpectrumXYData, "Mass spectrum for selected chrom peak was not generated"); //TestUtilities.DisplayXYValues(workflow.MassSpectrumXYData); //TestUtilities.DisplayXYValues(workflow.ChromatogramXYData); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult; if (result.FailedResult) { Console.WriteLine(result.ErrorDescription); } Assert.IsFalse(result.FailedResult); // result.DisplayToConsole(); Assert.IsNotNull(result.IsotopicProfile); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.AreEqual(2, result.IsotopicProfile.ChargeState); Assert.AreEqual(718.41m, (decimal)Math.Round(result.IsotopicProfile.GetMZ(), 2)); Assert.AreEqual(5939, (decimal)Math.Round(result.ChromPeakSelected.XValue)); Assert.IsNotNull(result.ChromCorrelationData); foreach (var dataItem in result.ChromCorrelationData.CorrelationDataItems) { Console.WriteLine(dataItem); } }
public void IqExportResultsTest() { //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-832 var testFile = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; var run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24800; var oldStyleTarget = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromatogramCorrelationIsPerformed = true; parameters.ChromSmootherNumPointsInSmooth = 9; parameters.ChromPeakDetectorPeakBR = 1; parameters.ChromPeakDetectorSigNoise = 1; WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters(); IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters); IqTarget target = new IqChargeStateTarget(iqWorkflow); target.ID = oldStyleTarget.ID; target.MZTheor = oldStyleTarget.MZ; target.ElutionTimeTheor = oldStyleTarget.NormalizedElutionTime; target.MonoMassTheor = oldStyleTarget.MonoIsotopicMass; target.EmpiricalFormula = oldStyleTarget.EmpiricalFormula; target.ChargeState = oldStyleTarget.ChargeState; var targets = new List <IqTarget>(1); targets.Add(target); var executor = new IqExecutor(executorBaseParameters, run); //executor.ChromSourceDataFilePath = peaksTestFile; executor.Execute(targets); Assert.IsTrue(File.Exists(@"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Results\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_iqResults.txt")); using (var reader = new StreamReader(@"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Results\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_iqResults.txt")) { var temp = reader.ReadLine(); Assert.AreEqual( "TargetID\tCode\tEmpiricalFormula\tChargeState\tMonomassTheor\tMZTheor\tElutionTimeTheor\tMonoMassObs\tMZObs\tElutionTimeObs\tChromPeaksWithinTolerance\tScan\tAbundance\tIsoFitScore\tInterferenceScore", temp); temp = reader.ReadLine(); Console.WriteLine(temp); Assert.AreEqual( "24800\t\tC64H110N18O19\t2\t1434.8193888\t718.41697089\t0.321639209985733\t1434.81096195126\t718.412757465632\t0.318046778440475\t0\t5942\t1352176\t0.0850492709063084\t0.0942918054560866", temp); } }