public void findFeatureIn_dataset_with_bad_massCalibration_test1() { //mass error in this dataset is typically ~50ppm. var datasetFile = @"D:\Data\Orbitrap\Subissue01\QC_Shew_10_01-pt5-1_8Feb10_Doc_09-12-24.RAW"; var massTagFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\MassTags\QCShew_Formic_MassTags_Bin10_first10.txt"; var workflowParameterFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\WorkflowParameterFiles\UnlabelledTargeted_WorkflowParameters_noSum.xml"; var run = RunUtilities.CreateAndLoadPeaks(datasetFile, datasetFile.Replace(".RAW", "_peaks.txt")); RunUtilities.AlignRunUsingAlignmentInfoInFiles(run); Assert.IsTrue(run.MassIsAligned); Assert.IsTrue(run.NETIsAligned); var parameters = new BasicTargetedWorkflowParameters(); parameters.LoadParameters(workflowParameterFile); var workflow = new BasicTargetedWorkflow(parameters); workflow.Run = run; var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var mt1 = (from n in mtc.TargetList where n.ID == 24702 && n.ChargeState == 4 select n).First(); run.CurrentMassTag = mt1; workflow.Execute(); var repo = new TargetedResultRepository(); repo.AddResult(workflow.Result); Console.WriteLine("theor mono mass = " + mt1.MonoIsotopicMass); Console.WriteLine("theorMZ = " + mt1.MZ); Console.WriteLine("theorNET = " + mt1.NormalizedElutionTime); Console.WriteLine("obsScan = " + repo.Results[0].ScanLC); Console.WriteLine("obsNET = " + repo.Results[0].NET); Console.WriteLine("NETError = " + repo.Results[0].NETError); Console.WriteLine("obsMZ = " + repo.Results[0].MonoMZ); Console.WriteLine("monoMass = " + repo.Results[0].MonoMass); Console.WriteLine("obsMonoMassCalibrated = " + repo.Results[0].MonoMassCalibrated); Console.WriteLine("MassErrorBeforeAlignment = " + (mt1.MZ - repo.Results[0].MonoMZ) / mt1.MZ * 1e6); Console.WriteLine("MassErrorAfterAlignment = " + repo.Results[0].MassErrorBeforeCalibration); }
public void importParametersTest2() { var importedParametersFile = Path.Combine(FileRefs.ImportedData, "importedParameters_MostIntenseChromPeakSelection.xml"); var parameters = new BasicTargetedWorkflowParameters(); parameters.LoadParameters(importedParametersFile); Assert.AreEqual("BASIC_TARGETED_RESULT", parameters.ResultType.ToString()); Assert.AreEqual("MostIntense", parameters.ChromPeakSelectorMode.ToString()); }
public void ChromPeakAnalyzerWorkflowWrongTargetTest() { //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-884 var testFile = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var run = new RunFactory().CreateRun(testFile); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); IqTarget testTarget = new IqChargeStateTarget(); testTarget.SetWorkflow(new ChromPeakAnalyzerIqWorkflow(run, parameters)); testTarget.DoWorkflow(); }
public void parameterFileImportTest1() { var parameters = new BasicTargetedWorkflowParameters(); var importTestFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Parameters\BasicTargetedWorkflowParameters1_forImportTesting.xml"; parameters.LoadParameters(importTestFile); //TODO: complete testing of other values Assert.AreEqual(parameters.ChromGenToleranceUnit, Globals.ToleranceUnit.MZ); Assert.AreEqual(0.01, parameters.ChromGenTolerance); }
public void targetedWorkflow_alignUsingDataFromFiles_localVersion() { //TODO: figure out result is correct //TODO: get MS and Chrom in Jira var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.TargetsFilePath = @"C:\Users\d3x720\Documents\Data\QCShew\IQ\QCShew_Formic_MassTags_Bin10_MT24702_Z3.txt"; executorParameters.TargetedAlignmentIsPerformed = true; var workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.ChromSmootherNumPointsInSmooth = 9; workflowParameters.ChromPeakDetectorPeakBR = 1; workflowParameters.ChromPeakDetectorSigNoise = 1; workflowParameters.ChromGenTolerance = 20; workflowParameters.ChromNETTolerance = 0.025; workflowParameters.MSToleranceInPPM = 20; var workflow = new BasicTargetedWorkflow(workflowParameters); var testDatasetPath = @"C:\Users\d3x720\Documents\Data\QCShew\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; TargetedWorkflowExecutor executor = new BasicTargetedWorkflowExecutor(executorParameters, workflow, testDatasetPath); executor.Execute(); var expectedResultsFilename = @"C:\Users\d3x720\Documents\Data\QCShew\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_results.txt"; var result = executor.TargetedWorkflow.Result; 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); 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); //Dataset MassTagID ChargeState Scan ScanStart ScanEnd NET NumChromPeaksWithinTol NumQualityChromPeaksWithinTol MonoisotopicMass MonoMZ IntensityRep FitScore IScore FailureType //QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18 24702 3 8119 8112 8124 0.4172 2 1 2920.53082 974.51755 1379489 0.1136 0.0000 }
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 exportParametersTest1() { var exportedParametersFile = Path.Combine(FileRefs.OutputFolderPath, "exportedBasicTargetedWorkflowParameters.xml"); if (File.Exists(exportedParametersFile)) { File.Delete(exportedParametersFile); } var parameters = new BasicTargetedWorkflowParameters(); parameters.SaveParametersToXML(exportedParametersFile); Assert.That(File.Exists(exportedParametersFile), "Parameter file doesn't exist: " + exportedParametersFile); }
public void InvestigateIQFailures() { var executorParamFile = @"\\protoapps\DataPkgs\Public\2013\743_Mycobacterium_tuberculosis_Cys_and_Ser_ABP\IQ_Analysis\Parameters\ExecutorParameters1 - Copy.xml"; var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.LoadParameters(executorParamFile); var testFile = @"\\protoapps\DataPkgs\Public\2013\743_Mycobacterium_tuberculosis_Cys_and_Ser_ABP\IQ_Analysis\Testing\LNA_A_Expo_Sample_SC_9_LNA_ExpA_Expo_Stat_SeattleBioMed_15Feb13_Cougar_12-12-35.raw"; var run = new RunFactory().CreateRun(testFile); var iqparameterFile = @"\\protoapps\DataPkgs\Public\2013\743_Mycobacterium_tuberculosis_Cys_and_Ser_ABP\IQ_Analysis\Testing\IQWorkflowParameters1.xml"; var workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.LoadParameters(iqparameterFile); workflowParameters.MSToleranceInPPM = 10; workflowParameters.ChromPeakDetectorPeakBR = 0.25; workflowParameters.ChromPeakDetectorSigNoise = 2; var targetedWorkflow = new BasicTargetedWorkflow(run, workflowParameters); var executor = new BasicTargetedWorkflowExecutor(executorParameters, targetedWorkflow, testFile); //int[] testTargets = {349959971, 349951038,349954483 }; //int[] testTargets = { 349951038 }; //int[] testTargets = { 349954483 }; //int[] testTargets = { 2911730 }; int[] testTargets = { 349946881 }; var chargeState = 3; executor.Targets.TargetList = (from n in executor.Targets.TargetList where testTargets.Contains(n.ID) select n).ToList(); executor.Targets.TargetList = (from n in executor.Targets.TargetList where n.ChargeState == chargeState select n).ToList(); executor.Execute(); //Results of investiga tion! - 349959971 was being missed because the MSTolerance was too narrow. When changed from 5 to 6, it was found. I think we can safely set this at 10. //Results of investigation! - 349951038 was being missed because it was being flagged (peak to the left) problem. TestUtilities.DisplayXYValues(executor.TargetedWorkflow.ChromatogramXYData); }
public void featuresLoadedFromFile_test1() { RunFactory rf = new RunFactory(); Run run = rf.CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1); string massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt"; string deconToolsResultFile = @"D:\Temp\output7\targetedFeatures.txt"; DeconToolsTargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); TargetedAligner aligner = new TargetedAligner(run, parameters); aligner.SetMassTags(massTagFile); aligner.ImportedFeaturesFilename = deconToolsResultFile; aligner.Execute(); }
public void ProblemTesting_correlationProb1() { //see JIRA https://jira.pnnl.gov/jira/browse/OMCS-628 var executorParameters = new BasicTargetedWorkflowExecutorParameters(); var testDatasetPath = @"D:\Data\O16O18\Vlad_Mouse\mhp_plat_test_1B_8Apr13_Cougar_13-03-25.raw"; executorParameters.IsMassAlignmentPerformed = true; executorParameters.IsNetAlignmentPerformed = true; executorParameters.ReferenceTargetsFilePath = @"\\protoapps\DataPkgs\Public\2013\795_Iq_analysis_of_mouse_O16O18\Targets\MT_Mouse_MHP_O18_Set3_P892_targets.txt"; var run = new RunFactory().CreateRun(testDatasetPath); var executor = new IqExecutor(executorParameters, run); var targetsFile = @"\\protoapps\DataPkgs\Public\2013\795_Iq_analysis_of_mouse_O16O18\Targets\MT_Mouse_MHP_O18_Set3_P892_targets.txt"; executor.LoadAndInitializeTargets(targetsFile); executor.SetupMassAndNetAlignment(); var testTarget = 6955012; executor.Targets = (from n in executor.Targets where n.ID == testTarget select n).ToList(); var targetedWorkflowParameters = new BasicTargetedWorkflowParameters(); targetedWorkflowParameters.LoadParameters(@"\\protoapps\DataPkgs\Public\2013\795_Iq_analysis_of_mouse_O16O18\Parameters\O16O18WorkflowParameters_2011_08_23_sum5.xml"); //define workflows for parentTarget and childTargets var parentWorkflow = new O16O18ParentIqWorkflow(run, targetedWorkflowParameters); var childWorkflow = new O16O18IqWorkflow(run, targetedWorkflowParameters); var workflowAssigner = new IqWorkflowAssigner(); workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets); workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets); executor.DoAlignment(); executor.Execute(); }
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 findSingleMassTag_checkAlignmentData_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.CreateAndLoadPeaks(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(); var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult; Assert.AreEqual(false, 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(5947m, (decimal)Math.Round(result.ChromPeakSelected.XValue)); Assert.AreEqual(5.91, (decimal)(Math.Round(result.GetMassErrorAfterAlignmentInPPM(), 2))); Assert.AreEqual(0.0001585m, (decimal)(Math.Round(result.GetNETAlignmentError(), 7))); RunUtilities.AlignRunUsingAlignmentInfoInFiles(run); //these might change due to unit tests elsewhere. Need a better way of doing this //Assert.AreEqual(1.99290383722318m, (decimal)result.GetMassErrorAfterAlignmentInPPM()); //Assert.AreEqual(0.00076708197593689m, (decimal)result.GetNETAlignmentError()); }
public void ChromPeakAnalyzerWorkflowTest() { //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-884 var testFile = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var run = new RunFactory().CreateRun(testFile); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); var testTarget = new ChromPeakIqTarget(); ITheorFeatureGenerator TheorFeatureGen = new JoshTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005); var testPeak = new ChromPeak(5184, 840963, 50, 0); var executorBaseParameters = new BasicTargetedWorkflowExecutorParameters(); var executor = new TopDownMSAlignExecutor(executorBaseParameters, run); executor.ChromSourceDataFilePath = peaksTestFile; var workflow = new ChromPeakAnalyzerIqWorkflow(run, parameters); testTarget.SetWorkflow(workflow); testTarget.ID = 1; testTarget.Code = "NGIIMMENR"; testTarget.EmpiricalFormula = "C43H76N14O14S2"; testTarget.MonoMassTheor = 1076.510631; testTarget.ChromPeak = testPeak; testTarget.ChargeState = 1; testTarget.TheorIsotopicProfile = TheorFeatureGen.GenerateTheorProfile(testTarget.EmpiricalFormula, testTarget.ChargeState); var testTargetList = new List <IqTarget>(); IqTarget testParent = new IqChargeStateTarget(); testParent.AddTarget(testTarget); testTargetList.Add(testTarget); executor.Execute(testTargetList); var result = testTarget.GetResult(); Assert.NotNull(result.LCScanSetSelected); Assert.AreNotEqual(1, result.FitScore); Assert.AreEqual(true, result.IsotopicProfileFound); }
public void findSingleModifiedMassTagTest1() { var testFile = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_NETVals0.3-0.33.txt"; var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 189685150; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); Assert.AreEqual(true, run.CurrentMassTag.ContainsMods); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromatogramCorrelationIsPerformed = true; var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult; Assert.AreEqual(false, result.FailedResult); result.DisplayToConsole(); Assert.IsNotNull(result.IsotopicProfile); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.AreEqual(2, result.IsotopicProfile.ChargeState); Assert.AreEqual(959.48m, (decimal)Math.Round(result.IsotopicProfile.GetMZ(), 2)); //Assert.AreEqual(6070, (decimal)Math.Round(result.ChromPeakSelected.XValue)); foreach (var dataItem in result.ChromCorrelationData.CorrelationDataItems) { Console.WriteLine(dataItem); } }
public void createPeaksTest1() { var testFile = @"D:\Data\Orbitrap\BrianIQTesting\QC_Shew_11_02_pt5-b_6Jun11_Sphinx_11-03-27.RAW"; var run = new RunFactory().CreateRun(testFile); var parameters = new PeakDetectAndExportWorkflowParameters(); TargetedWorkflowParameters deconParam = new BasicTargetedWorkflowParameters(); deconParam.ChromGenSourceDataPeakBR = 3; parameters.PeakBR = deconParam.ChromGenSourceDataPeakBR; parameters.PeakFitType = DeconTools.Backend.Globals.PeakFitType.QUADRATIC; parameters.SigNoiseThreshold = deconParam.ChromGenSourceDataSigNoise; var peakCreator = new PeakDetectAndExportWorkflow(run, parameters); peakCreator.Execute(); }
public void TargetedWorkflowUsingMsgfInputsTest1() { var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.TargetsFilePath = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Targets\Yellow_C13_070_23Mar10_Griffin_10-01-28_msgfplus.tsv"; executorParameters.TargetedAlignmentIsPerformed = false; executorParameters.SaveParametersToXML( @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\IQConsoleDemo\IqExecutorParameters.xml"); var workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.ChromSmootherNumPointsInSmooth = 9; workflowParameters.ChromPeakDetectorPeakBR = 1; workflowParameters.ChromPeakDetectorSigNoise = 3; workflowParameters.ChromGenTolerance = 20; workflowParameters.ChromNETTolerance = 0.025; workflowParameters.MSToleranceInPPM = 20; workflowParameters.SaveParametersToXML( @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\IQConsoleDemo\IqWorkflowParameters.xml"); var workflow = new BasicTargetedWorkflow(workflowParameters); var testDatasetPath = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28.raw"; TargetedWorkflowExecutor executor = new BasicTargetedWorkflowExecutor(executorParameters, workflow, testDatasetPath); executor.Targets.TargetList = executor.Targets.TargetList.Take(10).ToList(); executor.Execute(); }
public void LocalQCShewProcessingTest1() { var parameterFileName = @"C:\Users\d3x720\Documents\Data\QCShew\IQ\IQExecutorParameterFile1.xml"; var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.TargetsFilePath = @"C:\Users\d3x720\Documents\Data\QCShew\IQ\QCShew_Formic_MassTags_Bin10_first10.txt"; executorParameters.SaveParametersToXML(parameterFileName); var workflowParameters = new BasicTargetedWorkflowParameters(); var workflow = new BasicTargetedWorkflow(workflowParameters); var testDatasetPath = @"C:\Users\d3x720\Documents\Data\QCShew\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; TargetedWorkflowExecutor executor = new BasicTargetedWorkflowExecutor(executorParameters, workflow, testDatasetPath); var testTargetID = 24749; var testTargetZ = 3; executor.Targets.TargetList = executor.Targets.TargetList.Where(p => p.ID == testTargetID && p.ChargeState == testTargetZ).ToList(); executor.Execute(); //TestUtilities.DisplayXYValues(executor.TargetedWorkflow.ChromatogramXYData); foreach (var chrompeak in executor.TargetedWorkflow.ChromPeaksDetected) { Console.WriteLine(chrompeak.XValue.ToString("0.0000") + "\t" + chrompeak.Height.ToString("0") + "\t" + chrompeak.Width.ToString("0.000") + "\n"); } }
public void ensure_alignmentIsBeingUsed_duringProcessing_test2() { var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; var mzAlignmentInfoFilename = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16_MZAlignment.txt"; var NETAlignmentInfoFilename = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16_NETAlignment.txt"; var rawDataFile = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16.RAW"; var peaksDataFile = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16_peaks.txt"; var run = DeconTools.Backend.Utilities.RunUtilities.CreateAndLoadPeaks(rawDataFile, peaksDataFile); var importer = new MassAlignmentInfoFromTextImporter(mzAlignmentInfoFilename); var massAlignmentData = importer.Import(); var massAlignmentInfo = new MassAlignmentInfoLcmsWarp(); massAlignmentInfo.SetMassAlignmentData(massAlignmentData); run.MassAlignmentInfo = massAlignmentInfo; var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24730; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); //first will execute workflow on a dataset that was NOT aligned TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromNETTolerance = 0.2; //use a very wide tolerance parameters.ChromGenTolerance = 5; parameters.MSToleranceInPPM = 15; var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); Assert.IsTrue(result.ChromPeakSelected != null); Assert.AreEqual(9367, (int)result.ChromPeakSelected.XValue); var netDiff = result.Target.NormalizedElutionTime - result.GetNET(); Console.WriteLine("NET diff before alignment = " + netDiff); var expectedNETDiff = 0.071m; Assert.AreEqual(expectedNETDiff, (decimal)Math.Round(netDiff, 3)); //import NET alignment information var netAlignmentInfoImporter = new NETAlignmentFromTextImporter(NETAlignmentInfoFilename); var scanNETdata = netAlignmentInfoImporter.Import(); run.NetAlignmentInfo.SetScanToNETAlignmentData(scanNETdata); parameters = new BasicTargetedWorkflowParameters(); parameters.ChromNETTolerance = 0.01; //use a more narrow tolerance parameters.ChromGenTolerance = 5; parameters.MSToleranceInPPM = 15; workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); netDiff = result.Target.NormalizedElutionTime - result.GetNET(); Console.WriteLine("NET diff after alignment = " + netDiff); Assert.IsTrue(result.ChromPeakSelected != null); var expectedNETDiffMaximum = 0.01; Assert.IsTrue(netDiff < expectedNETDiffMaximum); }
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 findSingleMassTag_alternateQCShew() { var testFile = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16.RAW"; var peaksTestFile = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16_peaks.txt"; var massTagFile = @"D:\Data\Orbitrap\QC_Shew_08_04-pt1-3_15Apr09_Sphinx_09-02-16_peakMatchedFeatures.txt"; var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 24709; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 4 select n).First(); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromNETTolerance = 0.2; parameters.MSToleranceInPPM = 25; parameters.ChromatogramCorrelationIsPerformed = true; var workflow = new BasicTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult; result.DisplayToConsole(); Assert.IsNotNull(result.IsotopicProfile); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.AreEqual(4, result.IsotopicProfile.ChargeState); // Assert.AreEqual(610.81m, (decimal)Math.Round(result.IsotopicProfile.GetMZ(), 2)); //Assert.AreEqual(6483, (decimal)Math.Round(result.ChromPeakSelected.XValue)); double maxIntensity = result.IsotopicProfile.Peaklist.Max(p => p.Height); for (var i = 0; i < result.IsotopicProfile.Peaklist.Count; i++) { double correctedRatio = 0; if (i < result.ChromCorrelationData.CorrelationDataItems.Count) { var correlationSlope = result.ChromCorrelationData.CorrelationDataItems[i].CorrelationSlope; if (correlationSlope != null) { correctedRatio = (double)correlationSlope; } } else { correctedRatio = 0; } var observedRelIntensity = result.IsotopicProfile.Peaklist[i].Height / maxIntensity; Console.WriteLine(i + "\t" + observedRelIntensity + "\t" + correctedRatio); } }
public void executeWorkflowTest1() { var testFile = FileRefs.SipperRawDataFile; var exportedResultFile = Path.Combine(FileRefs.OutputFolderPath, "ExportedSipperResults1.txt"); var peaksFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_peaks.txt"; var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksFile); var lcmsfeaturesFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_LCMSFeatures.txt"; // load LCMSFeatures as targets var importer = new LcmsTargetFromFeaturesFileImporter(lcmsfeaturesFile); var lcmsTargetCollection = importer.Import(); // load MassTags var massTagFile1 = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_MassTags.txt"; var massTagImporter = new MassTagFromTextFileImporter(massTagFile1); var massTagCollection = massTagImporter.Import(); //enriched var testMassTags = new int[] { 355116553, 355129038, 355160150, 355162540, 355163371 }; var filteredLcmsFeatureTargets = (from n in lcmsTargetCollection.TargetList where testMassTags.Contains(((LcmsFeatureTarget)n).FeatureToMassTagID) select n).ToList(); TargetCollection.UpdateTargetsWithMassTagInfo(filteredLcmsFeatureTargets, massTagCollection.TargetList); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromPeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget; var workflow = new SipperTargetedWorkflow(run, parameters); foreach (var target in filteredLcmsFeatureTargets) { run.CurrentMassTag = target; workflow.Execute(); } var results = run.ResultCollection.GetMassTagResults(); var repo = new TargetedResultRepository(); repo.AddResults(run.ResultCollection.GetMassTagResults()); var exporter = new SipperResultToLcmsFeatureExporter(exportedResultFile); exporter.ExportResults(repo.Results); }
public override void LoadAndInitializeTargets(string targetsFilePath) { if (string.IsNullOrEmpty(targetsFilePath)) { IqLogger.Log.Info("IqMassAndNetAligner - no alignment targets were loaded. The inputted targets file path is NULL."); return; } if (!File.Exists(targetsFilePath)) { IqLogger.Log.Info("IqMassAndNetAligner - no alignment targets were loaded. The inputted targets file path is does not exist."); return; } var importer = new IqTargetsFromFirstHitsFileImporter(targetsFilePath); Targets = importer.Import().Where(p => p.QualityScore < 0.01).OrderBy(p => p.ID).ToList(); //Targets = Targets.Where(p => p.Code.Contains("FEQDGENYTGTIDGNMGAYAR")).ToList(); var filteredList = new List <IqTarget>(); //calculate empirical formula for targets using Code and then monoisotopic mass foreach (var iqTarget in Targets) { iqTarget.Code = _peptideUtils.CleanUpPeptideSequence(iqTarget.Code); if (_peptideUtils.ValidateSequence(iqTarget.Code)) { iqTarget.EmpiricalFormula = _peptideUtils.GetEmpiricalFormulaForPeptideSequence(iqTarget.Code, true, true); var calcMonoMass = EmpiricalFormulaUtilities.GetMonoisotopicMassFromEmpiricalFormula(iqTarget.EmpiricalFormula); var monoMassFromFirstHitsFile = iqTarget.MonoMassTheor; var massCalculationsAgree = Math.Abs(monoMassFromFirstHitsFile - calcMonoMass) < 0.02; if (massCalculationsAgree) { iqTarget.MonoMassTheor = calcMonoMass; iqTarget.ElutionTimeTheor = iqTarget.ScanLC / (double)Run.MaxLCScan; filteredList.Add(iqTarget); _targetUtilities.UpdateTargetMissingInfo(iqTarget, true); var chargeStateTarget = new IqTargetMsgfFirstHit(); _targetUtilities.CopyTargetProperties(iqTarget, chargeStateTarget); iqTarget.AddTarget(chargeStateTarget); } } } filteredList = (from n in filteredList group n by new { n.Code, n.ChargeState } into grp select grp.OrderBy(p => p.QualityScore).First() ).ToList(); Targets = filteredList; TargetedWorkflowParameters workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.ChromNETTolerance = 0.005; workflowParameters.ChromGenTolerance = 50; //define workflows for parentTarget and childTargets var parentWorkflow = new ChromPeakDeciderIqWorkflow(Run, workflowParameters); var childWorkflow = new ChargeStateChildIqWorkflow(Run, workflowParameters); var workflowAssigner = new IqWorkflowAssigner(); workflowAssigner.AssignWorkflowToParent(parentWorkflow, Targets); workflowAssigner.AssignWorkflowToChildren(childWorkflow, Targets); if (Targets.Count > 0) { IqLogger.Log.Info("IqMassAndNetAligner - Loaded " + Targets.Count + " targets for use in mass and net alignment"); } else { IqLogger.Log.Info("IqMassAndNetAligner - NOTE - no targets have been loaded."); } //IqWorkflowAssigner workflowAssigner = new IqWorkflowAssigner(); //workflowAssigner.AssignWorkflowToParent(workflow, Targets); }
public void HemePeptidesProcessingTest1() { var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.TargetsFilePath = @"\\protoapps\DataPkgs\Public\2013\686_IQ_analysis_of_heme_peptides\Targets\SL-MtoA_peptides_formulas.txt"; var testDatasetPath = @"D:\Data\From_EricMerkley\HisHemeSL-MtrA_002_2Feb11_Sphinx_10-12-01.RAW"; var workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.ChromNETTolerance = 0.5; workflowParameters.ChromSmootherNumPointsInSmooth = 9; var workflow = new BasicTargetedWorkflow(workflowParameters); TargetedWorkflowExecutor executor = new BasicTargetedWorkflowExecutor(executorParameters, workflow, testDatasetPath); var testTargetID = 1950; var testTargetZ = 3; testTargetID = 240; testTargetZ = 4; testTargetID = 359; testTargetZ = 3; testTargetID = 750; testTargetZ = 5; executor.Targets.TargetList = executor.Targets.TargetList.Where(p => p.ID == testTargetID && p.ChargeState == testTargetZ).ToList(); //executor.Targets.TargetList = executor.Targets.TargetList.Where(p => p.ID == testTargetID).ToList(); executor.InitializeRun(testDatasetPath); executor.Run.CurrentMassTag = executor.Targets.TargetList.First(); double[] chromParamValues = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 25 }; //chromPeakBRValues =new double[] {10,15,25}; foreach (var value in chromParamValues) { var parameters = executor.TargetedWorkflow.WorkflowParameters as BasicTargetedWorkflowParameters; parameters.ChromPeakDetectorPeakBR = 5; parameters.ChromPeakDetectorSigNoise = value; executor.TargetedWorkflow = new BasicTargetedWorkflow(executor.Run, parameters); executor.TargetedWorkflow.Execute(); Console.WriteLine("PeakBR=" + value + " num chrom peaks= " + executor.TargetedWorkflow.ChromPeaksDetected.Count); foreach (var chrompeak in executor.TargetedWorkflow.ChromPeaksDetected) { Console.WriteLine(chrompeak.XValue.ToString("0.0000") + "\t" + chrompeak.Height.ToString("0") + "\t" + chrompeak.Width.ToString("0.000")); } } foreach (var chrompeak in executor.TargetedWorkflow.ChromPeaksDetected) { Console.WriteLine(chrompeak.XValue.ToString("0.0000") + "\t" + chrompeak.Height.ToString("0") + "\t" + chrompeak.Width.ToString("0.000")); } Console.WriteLine(); Console.WriteLine(); //TestUtilities.DisplayXYValues(executor.TargetedWorkflow.ChromatogramXYData); //TestUtilities.DisplayIsotopicProfileData(executor.TargetedWorkflow.Result.Target.IsotopicProfile); // Console.WriteLine(executor.TargetedWorkflow.Result.Target.EmpiricalFormula); }
public void IqExecutor_StandardO16O18Testing_VladAlz() { //see JIRA https://jira.pnnl.gov/jira/browse/OMCS-628 var executorParametersFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Parameters\ExecutorParameters1.xml"; var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.LoadParameters(executorParametersFile); executorParameters.OutputFolderBase = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz"; var testDatasetPath = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\RawData\Alz_P01_A01_097_26Apr12_Roc_12-03-15.RAW"; executorParameters.IsMassAlignmentPerformed = true; executorParameters.IsNetAlignmentPerformed = true; executorParameters.ReferenceTargetsFilePath = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2.txt"; var expectedResultsFilename = Path.Combine(executorParameters.OutputFolderBase, "IqResults", RunUtilities.GetDatasetName(testDatasetPath) + "_iqResults.txt"); if (File.Exists(expectedResultsFilename)) { File.Delete(expectedResultsFilename); } var autoSavedExecutorParametersFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Parameters\ExecutorParameters1_autosaved.xml"; executorParameters.SaveParametersToXML(autoSavedExecutorParametersFile); var run = new RunFactory().CreateRun(testDatasetPath); var executor = new IqExecutor(executorParameters, run); var targetsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2_First60.txt"; targetsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2.txt"; executor.LoadAndInitializeTargets(targetsFile); executor.SetupMassAndNetAlignment(); var testTarget = 9282; executor.Targets = (from n in executor.Targets where n.ID == testTarget select n).ToList(); var targetedWorkflowParameters = new BasicTargetedWorkflowParameters(); targetedWorkflowParameters.ChromNETTolerance = 0.025; targetedWorkflowParameters.ChromGeneratorMode = Globals.ChromatogramGeneratorMode.O16O18_THREE_MONOPEAKS; //define workflows for parentTarget and childTargets var parentWorkflow = new O16O18ParentIqWorkflow(run, targetedWorkflowParameters); var childWorkflow = new O16O18IqWorkflow(run, targetedWorkflowParameters); var workflowAssigner = new IqWorkflowAssigner(); workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets); workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets); executor.DoAlignment(); executor.Execute(); IqResultImporter importer = new IqResultImporterBasic(expectedResultsFilename); var allResults = importer.Import(); var result1 = allResults.First(p => p.Target.ID == 9282 && p.Target.ChargeState == 2); Assert.AreEqual(9282, result1.Target.ID); Assert.AreEqual(0.32678m, (decimal)result1.ElutionTimeObs); Assert.AreEqual(4545, result1.LcScanObs); Assert.AreEqual(0.02, (decimal)result1.FitScore); }
public void ExecutorTest1() { Console.WriteLine(Environment.CurrentDirectory); var util = new IqTargetUtilities(); var testFile = @"\\proto-5\External_Waters_TOF_Xfer\MzML_Files\130716_iPRG14_004.mzML"; //string peaksTestFile = //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_scans5500-6500_peaks.txt"; var targetsFile = @"\\protoapps\UserData\Fujimoto\SangtaeBottomUp\msgfPlus\C~~data~iPRG 2014~130716_iPRG14_004.raw.-1_Filtered.tsv"; WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters(); executorBaseParameters.ChromGenSourceDataPeakBR = 3; executorBaseParameters.ChromGenSourceDataSigNoise = 2; executorBaseParameters.TargetsFilePath = targetsFile; executorBaseParameters.OutputFolderBase = @"\\protoapps\UserData\Fujimoto\SangtaeBottomUp\Results"; var expectedResultsFilename = Path.Combine(executorBaseParameters.OutputFolderBase, "IqResults", RunUtilities.GetDatasetName(testFile) + "_iqResults.txt"); if (File.Exists(expectedResultsFilename)) { File.Delete(expectedResultsFilename); } var run = new RunFactory().CreateRun(testFile); var executor = new IqExecutor(executorBaseParameters, run); //executor.ChromSourceDataFilePath = peaksTestFile; executor.LoadAndInitializeTargets(targetsFile); var targetedWorkflowParameters = new BasicTargetedWorkflowParameters(); targetedWorkflowParameters.ChromNETTolerance = 0.05; //define workflows for parentTarget and childTargets var parentWorkflow = new ChromPeakDeciderIqWorkflow(run, targetedWorkflowParameters); var childWorkflow = new ChargeStateChildIqWorkflow(run, targetedWorkflowParameters); var workflowAssigner = new IqWorkflowAssigner(); workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets); workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets); //SipperDataDump.DataDumpSetup(@"\\pnl\projects\MSSHARE\Merkley_Eric\For_Grant\IqResults\EXP6B_F1_CSCL_LIGHT_130520020056\EXP6B_F1_CSCL_LIGHT_FULLRESULTS.txt"); //Main line for executing IQ: executor.Execute(); //Test the results... var numResultsInResultsFile = 0; var outputToConsole = true; using (var reader = new StreamReader(expectedResultsFilename)) { while (reader.Peek() != -1) { var line = reader.ReadLine(); numResultsInResultsFile++; if (outputToConsole) { Console.WriteLine(line); } } } }
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); } }
public void ExecuteMultipleTargetsTest1() { var util = new IqTargetUtilities(); var testFile = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1; var peaksTestFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_scans5500-6500_peaks.txt"; var targetsFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt"; WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters(); executorBaseParameters.ChromGenSourceDataPeakBR = 3; executorBaseParameters.ChromGenSourceDataSigNoise = 2; executorBaseParameters.TargetsFilePath = targetsFile; executorBaseParameters.OutputFolderBase = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled"; var expectedResultsFilename = Path.Combine(executorBaseParameters.OutputFolderBase, "IqResults", RunUtilities.GetDatasetName(testFile) + "_iqResults.txt"); if (File.Exists(expectedResultsFilename)) { File.Delete(expectedResultsFilename); } var run = new RunFactory().CreateRun(testFile); var executor = new IqExecutor(executorBaseParameters, run); executor.ChromSourceDataFilePath = peaksTestFile; executor.LoadAndInitializeTargets(targetsFile); executor.Targets = (from n in executor.Targets where n.ElutionTimeTheor > 0.305 && n.ElutionTimeTheor < 0.325 select n).Take(10).ToList(); var targetedWorkflowParameters = new BasicTargetedWorkflowParameters(); targetedWorkflowParameters.ChromNETTolerance = 0.5; //define workflows for parentTarget and childTargets var parentWorkflow = new BasicIqWorkflow(run, targetedWorkflowParameters); var childWorkflow = new BasicIqWorkflow(run, targetedWorkflowParameters); var workflowAssigner = new IqWorkflowAssigner(); workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets); workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets); //Main line for executing IQ: executor.Execute(); //Test the results... Assert.IsTrue(File.Exists(expectedResultsFilename), "results file doesn't exist"); var numResultsInResultsFile = 0; var outputToConsole = true; using (var reader = new StreamReader(expectedResultsFilename)) { while (reader.Peek() != -1) { var line = reader.ReadLine(); numResultsInResultsFile++; if (outputToConsole) { Console.WriteLine(line); } } } Assert.IsTrue(numResultsInResultsFile > 1, "No results in output file"); //the Result Tree is flattened out in the results file. Assert.IsTrue(numResultsInResultsFile == 11); //the results in the Executor are in the a Result tree. So there should be just 10. Assert.AreEqual(10, executor.Results.Count); }
public void targetedWorkflow_alignUsingDataFromFiles() { // https://jira.pnnl.gov/jira/browse/OMCS-714 var executorParameters = new BasicTargetedWorkflowExecutorParameters(); executorParameters.TargetsFilePath = baseFolder + @"\Targets\QCShew_Formic_MassTags_Bin10_MT24702_Z3.txt"; executorParameters.TargetedAlignmentIsPerformed = true; executorParameters.TargetedAlignmentWorkflowParameterFile = baseFolder + @"\Parameters\TargetedAlignmentWorkflowParameters1.xml"; var workflowParameters = new BasicTargetedWorkflowParameters(); workflowParameters.ChromSmootherNumPointsInSmooth = 9; workflowParameters.ChromPeakDetectorPeakBR = 1; workflowParameters.ChromPeakDetectorSigNoise = 3; workflowParameters.ChromGenTolerance = 20; workflowParameters.ChromNETTolerance = 0.025; workflowParameters.MSToleranceInPPM = 20; var workflow = new BasicTargetedWorkflow(workflowParameters); var testDatasetPath = baseFolder + @"\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; TargetedWorkflowExecutor executor = new BasicTargetedWorkflowExecutor(executorParameters, workflow, testDatasetPath); executor.Execute(); var expectedResultsFilename = @"C:\Users\d3x720\Documents\Data\QCShew\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_results.txt"; var result = executor.TargetedWorkflow.Result; Assert.IsTrue(workflow.Success); Assert.IsFalse(result.FailedResult); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.IsTrue(result.Score < 0.1); Assert.AreEqual(3, result.NumChromPeaksWithinTolerance); Assert.AreEqual(8627, (decimal)Math.Round(result.ChromPeakSelected.XValue, 0)); //non-calibrated mass directly from mass spectrum Assert.AreEqual(2920.49120m, (decimal)Math.Round(result.IsotopicProfile.MonoIsotopicMass, 5)); //calibrated mass Assert.AreEqual(2920.50017m, (decimal)Math.Round(result.MonoIsotopicMassCalibrated, 5)); Console.WriteLine("theor monomass= \t" + result.Target.MonoIsotopicMass); Console.WriteLine("monomass= \t" + result.IsotopicProfile.MonoIsotopicMass); Console.WriteLine("calibrated monomass= \t" + result.MonoIsotopicMassCalibrated); Console.WriteLine("ppmError before= \t" + result.MassErrorBeforeAlignment); Console.WriteLine("ppmError after= \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); //Dataset TargetID Code EmpiricalFormula ChargeState Scan ScanStart ScanEnd NumMSSummed NET NETError NumChromPeaksWithinTol NumQualityChromPeaksWithinTol MonoisotopicMass MonoisotopicMassCalibrated MassErrorInPPM MonoMZ IntensityRep FitScore IScore FailureType ErrorDescription //QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18 24702 LLKEEGYIADYAVADEAKPELEITLK C133H213N29O44 3 8624 8596 8659 0 0.42916 -0.009395 3 1 2920.49120 2920.50018 13.96 974.50434 7529645 0.0193 0.0000 }
public void executeWorkflowTest1() { var testFile = FileRefs.SipperRawDataFile; var peaksFile = @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\2012\C12C13YellowStone\2011_02_20_SIPPER_workflow_standards\Yellow_C13_070_23Mar10_Griffin_10-01-28_peaks.txt"; peaksFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_peaks.txt"; var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksFile); var lcmsfeaturesFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_LCMSFeatures.txt"; // load LCMSFeatures as targets var importer = new LcmsTargetFromFeaturesFileImporter(lcmsfeaturesFile); var lcmsTargetCollection = importer.Import(); // load MassTags var massTagFile1 = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\SIPPER_standard_testing\Yellow_C13_070_23Mar10_Griffin_10-01-28_MassTags.txt"; var massTagImporter = new MassTagFromTextFileImporter(massTagFile1); var massTagCollection = massTagImporter.Import(); var masstagIDlist = (from n in massTagCollection.TargetList select n.ID).ToList(); // Update LCMSFeatures using MassTag info int[] testMassTags = { 344540889, 344972415, 354881152, 355157363, 355162540, 355315129, 355054192, 355160150 }; //testMassTags = new[] {344540889}; //testMassTags = new int[] // { // 354942933, 355066611, 354882356, 354928525, 17440471, 355046165, 355008036, 354977066, // 355166304, 354879605, 344965520, 354870998, 355084057, 355034961, 354963652, 344969970, // 355157492, 355176429, 355162540, 355244316, 355139611, 355036935, 355044786, 355139579, // 355163558, 355065622, 355167968, 355033793, 354879421, 355090391, 355034165, 354880925, // 344747857, 354879494, 355315129, 344968376, 355022502, 354879347, 354881152, 354879406, // 344968302, 355037491, 355033717, 355034652, 354879414, 344972415, 355039789, 355025762, // 355129038, 355355053, 354879164, 355037247, 355033862, 355034180, 355033668, 344540889, // 355160123, 345073233, 354880183, 354879165, 354879192, 354879842, 355046211, 355033627, // 355030074, 355033620, 354879142, 354879360, 355034183, 354879174, 354879150 // }; //no enrichment peptides: //testMassTags = new int[] { 355057553, 355058671, 355084418 }; //enriched //testMassTags = new int[] { 355116553, 355129038, 355160150, 355162540, 355163371 }; //testMassTags = new int[] { 355008295 }; //co-elution peptides //testMassTags = new int[] {355034154, 355033668, 355154211, 355035781}; //testMassTags = new int[] { 355033668 }; //testMassTags = new int[]{355157492}; testMassTags = new int[] { 355033977 }; var filteredLcmsFeatureTargets = (from n in lcmsTargetCollection.TargetList where testMassTags.Contains(((LcmsFeatureTarget)n).FeatureToMassTagID) select n).ToList(); foreach (LcmsFeatureTarget target in filteredLcmsFeatureTargets) { if (masstagIDlist.Contains(target.FeatureToMassTagID)) { var mt = massTagCollection.TargetList.Where(p => p.ID == target.FeatureToMassTagID).First(); target.Code = mt.Code; target.EmpiricalFormula = mt.EmpiricalFormula; } else { //get target's code + empirical formula based on averagine model } } TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromPeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget; var workflow = new SipperTargetedWorkflow(run, parameters); var outputFolder = @"C:\data\temp\SipperOutput"; if (!Directory.Exists(outputFolder)) { Directory.CreateDirectory(outputFolder); } var stopwatch = new Stopwatch(); stopwatch.Start(); foreach (var target in filteredLcmsFeatureTargets) { run.CurrentMassTag = target; workflow.Execute(); OutputMassSpectrum(outputFolder, workflow.MassSpectrumXYData, target, workflow.Result as SipperLcmsTargetedResult); } stopwatch.Stop(); foreach (var targetedResultBase in (run.ResultCollection.MassTagResultList)) { var result = (SipperLcmsTargetedResult)targetedResultBase.Value; Console.WriteLine(result + "\t" + result.Target.IsotopicProfile.Peaklist.Count); } Console.WriteLine("Total workflow time (ms) = " + stopwatch.ElapsedMilliseconds); Console.WriteLine("Time per target (ms) = " + stopwatch.ElapsedMilliseconds / (double)filteredLcmsFeatureTargets.Count); }
public AutoprocessorViewModel() { ExecutorParameters = new BasicTargetedWorkflowExecutorParameters(); TargetedWorkflowParameters = new BasicTargetedWorkflowParameters(); }