public void GetPeakChromatogram_IQStyle_Test3() { var run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); var target = TestUtilities.GetIQTargetStandard(1); var chromGen = new PeakChromatogramGenerator(); chromGen.ChromatogramGeneratorMode = Globals.ChromatogramGeneratorMode.TOP_N_PEAKS; chromGen.TopNPeaksLowerCutOff = 0.4; chromGen.Tolerance = 100; var lowerScan = 6087; var upperScan = 6418; var massOfInterest = new List <double>(); massOfInterest.Add(target.TheorIsotopicProfile.Peaklist[0].XValue); massOfInterest.Add(target.TheorIsotopicProfile.Peaklist[1].XValue); var chromXYData = chromGen.GenerateChromatogram(run, massOfInterest, lowerScan, upperScan, chromGen.Tolerance, chromGen.ToleranceUnit); Assert.IsNotNull(chromXYData); Assert.AreEqual(96, chromXYData.Xvalues.Length); TestUtilities.DisplayXYValues(chromXYData); }
public void GetChromatogramsTest1() { string testDatasetPath = @"D:\Data\From_Vlad\Bruker\2013_01_29_ALZ_CTRL_5_0p5_1_01_228.d"; Run run = RunUtilities.CreateAndLoadPeaks(testDatasetPath); PeakChromatogramGenerator chromGen = new PeakChromatogramGenerator(10); double targetMZ = 663.3404; int chargeState = 2; int peakNum = 4; targetMZ = targetMZ + peakNum * Globals.MASS_DIFF_BETWEEN_ISOTOPICPEAKS / chargeState; double toleranceInPPM = 10; int startScan = 230; int stopScan = 300; chromGen.GenerateChromatogram(run, startScan, stopScan, targetMZ, toleranceInPPM); run.XYData = run.XYData.TrimData(startScan, stopScan); TestUtilities.DisplayXYValues(run.XYData); }
public void Get3DElutionAndExportToFileTest1() { var peaksFile = FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var orbiFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1; var run = RunUtilities.CreateAndLoadPeaks(orbiFile, peaksFile); var outputFile = Path.Combine(run.DataSetPath, run.DatasetName + "_sample3DelutionProfile.txt"); Assert.IsNotNull(run); Assert.IsTrue(run.ResultCollection.MSPeakResultList.Count > 0); var extractor = new IsotopicProfileElutionExtractor(); var minScan = 5900; var maxScan = 6300; double minMZ = 749; double maxMZ = 754; int[] scans; float[] intensities; double[] mzBinVals; extractor.Get3DElutionProfileFromPeakLevelData(run, minScan, maxScan, minMZ, maxMZ, out scans, out mzBinVals, out intensities); var intensities2D = extractor.GetIntensitiesAs2DArray(); extractor.OutputElutionProfileToFile(outputFile); }
public void TestFindMassTag() { const string testFile = @"\\protoapps\UserData\Kaipo\TopDown\test2\Proteus_Peri_intact_ETD.raw"; const string peaksTestFile = @"\\protoapps\UserData\Kaipo\TopDown\test2\Proteus_Peri_intact_ETD_peaks.txt"; const string massTagFile = @"\\protoapps\UserData\Kaipo\TopDown\test2\Proteus_Peri_intact_ETD_MSAlign_ResultTable.txt"; Run run = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile); TargetCollection mtc = new TargetCollection(); var mtimporter = new MassTagFromMSAlignFileImporter(massTagFile); mtc = mtimporter.Import(); const int testMassTagID = 14; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID select n).First(); TargetedWorkflowParameters parameters = new TopDownTargetedWorkflowParameters(); var workflow = new TopDownTargetedWorkflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); if (result.FailedResult) { Console.WriteLine(result.ErrorDescription); } Assert.IsFalse(result.FailedResult); result.DisplayToConsole(); }
public void featuresFoundByTargetedProcessing_thenAligned_test1() { string peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile1; Console.WriteLine("loading peaks."); Run run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, peaksTestFile); Console.WriteLine("done."); string massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt"; DeconToolsTargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromNETTolerance = 0.2; parameters.ChromToleranceInPPM = 25; parameters.ChromGeneratorMode = Backend.ProcessingTasks.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK; parameters.ChromPeakDetectorPeakBR = 2; parameters.ChromPeakDetectorSigNoise = 2; parameters.MSToleranceInPPM = 25; TargetedAligner aligner = new TargetedAligner(run, parameters); aligner.UpperFitScoreAllowedCriteria = 0.1; aligner.IScoreAllowedCriteria = 0.15; Console.WriteLine("Loading Mass tags..."); aligner.SetMassTags(massTagFile); Console.WriteLine("Done."); aligner.Execute(); }
public void Get3DElutionTest1() { var peaksFile = FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500; var orbiFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1; var run = RunUtilities.CreateAndLoadPeaks(orbiFile, peaksFile); Assert.IsNotNull(run); Assert.IsTrue(run.ResultCollection.MSPeakResultList.Count > 0); var extractor = new IsotopicProfileElutionExtractor(); var minScan = 5900; var maxScan = 6300; double minMZ = 749; double maxMZ = 754; int[] scans; float[] intensities; double[] mzBinVals; extractor.Get3DElutionProfileFromPeakLevelData(run, minScan, maxScan, minMZ, maxMZ, out scans, out mzBinVals, out intensities); var intensities2D = extractor.GetIntensitiesAs2DArray(); Console.WriteLine(extractor.OutputElutionProfileAsString()); }
public void standardQCShewDatasetTest1() { var datasetFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; var massTagFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\MassTags\QCShew_Formic_MassTags_for_alignment.txt"; var workflowParameterFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\WorkflowParameterFiles\TargetedAlignmentWorkflowParameters1.xml"; var run = RunUtilities.CreateAndLoadPeaks(datasetFile, datasetFile.Replace(".RAW", "_peaks.txt")); var parameters = new TargetedAlignerWorkflowParameters(); parameters.LoadParameters(workflowParameterFile); parameters.ChromNETTolerance = 0.3; parameters.ChromGenTolerance = 60; parameters.MSToleranceInPPM = 60; Console.WriteLine(parameters.ToStringWithDetails()); var aligner = new TargetedAlignerWorkflow(run, parameters); aligner.outputToConsole = true; aligner.SetMassTags(massTagFile); aligner.Execute(); }
public void FailureToFindAnyChromatogramDataTest1() { 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); TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters(); parameters.ChromGenTolerance = 1; //very narrow tolerance IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters); IqTarget target = new IqChargeStateTarget(iqWorkflow); target.EmpiricalFormula = DeconTools.Backend.Utilities.IsotopeDistributionCalculation.IsotopicDistributionCalculator.Instance.GetAveragineFormulaAsString(1399); target.ElutionTimeTheor = 0.3; target.ChargeState = 1; target.DoWorkflow(); var result = target.GetResult(); Assert.IsTrue(result.Target.TheorIsotopicProfile != null); Assert.IsTrue(result != null); Assert.IsTrue(result.IqResultDetail.Chromatogram == null); var reportString = result.ToStringWithDetailedReport(); Console.WriteLine(reportString); }
public void problemVladDatasetTest1() { var datasetFile = @"\\protoapps\UserData\Slysz\Data\O16O18\Vlad_O16O18\RawData\test.RAW"; var massTagFile = @"\\protoapps\UserData\Slysz\Data\O16O18\Vlad_O16O18\Targets\massTags_found_across_all_5_datasets.txt"; var workflowParameterFile = @"\\protoapps\UserData\Slysz\Data\O16O18\Vlad_O16O18\Workflow_Parameters\TargetedAlignmentWorkflowParameters1.xml"; var run = RunUtilities.CreateAndLoadPeaks(datasetFile, datasetFile.Replace(".RAW", "_peaks.txt")); var parameters = new TargetedAlignerWorkflowParameters(); parameters.LoadParameters(workflowParameterFile); parameters.ChromNETTolerance = 0.3; parameters.ChromGenTolerance = 60; parameters.MSToleranceInPPM = 60; Console.WriteLine(parameters.ToStringWithDetails()); var aligner = new TargetedAlignerWorkflow(run, parameters); aligner.outputToConsole = true; aligner.SetMassTags(massTagFile); aligner.Execute(); }
public void featuresFoundByTargetedProcessing_thenAligned_test1() { var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile1; var run = RunUtilities.CreateAndLoadPeaks(DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1, peaksTestFile); var massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_NETVals0.3-0.33.txt"; var parameters = new TargetedAlignerWorkflowParameters(); parameters.ChromNETTolerance = 0.2; parameters.ChromGenTolerance = 25; parameters.ChromGeneratorMode = Globals.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK; parameters.ChromPeakDetectorPeakBR = 2; parameters.ChromPeakDetectorSigNoise = 2; parameters.MSToleranceInPPM = 25; parameters.UpperFitScoreAllowedCriteria = 0.1; parameters.IScoreAllowedCriteria = 0.15; var aligner = new TargetedAlignerWorkflow(run, parameters); aligner.SetMassTags(massTagFile); aligner.Execute(); Console.WriteLine(aligner.GetAlignmentReport1()); Assert.IsNotNull(run.AlignmentInfo); Assert.AreEqual(-4.2m, (decimal)(Math.Round(run.AlignmentInfo.GetPPMShiftFromMZ(600.0f), 1))); }
public void getPeakChromatogramTest1() { var run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); var targetMZ = 759.4032; var startScan = 5500; var stopScan = 6500; double toleranceInPPM = 20; var chromGen = new PeakChromatogramGenerator(); var mt = TestUtilities.GetMassTagStandard(1); run.CurrentMassTag = mt; var unlabelledTheorGenerator = new JoshTheorFeatureGenerator(); unlabelledTheorGenerator.GenerateTheorFeature(mt); var peakChromGen = new PeakChromatogramGenerator(toleranceInPPM); peakChromGen.Execute(run.ResultCollection); run.XYData.Display(); Assert.AreEqual(133, run.XYData.Xvalues.Length); Assert.AreEqual(5543, (int)run.XYData.Xvalues[35]); Assert.AreEqual(7319569, (int)run.XYData.Yvalues[35]); //make sure that the 0's are not trimmed off Assert.AreEqual(0, run.XYData.Yvalues[1]); }
public void Get3DElutionAndExportToFileTest1() { var rawFile = @"\\protoapps\UserData\Fujimoto\TopDownPaperData\FINAL_DATA\_004\SBEP_STM_004_02272012_Aragon.raw"; var peaksFile = @"\\protoapps\UserData\Fujimoto\TopDownPaperData\FINAL_DATA\_004\SBEP_STM_004_02272012_Aragon_peaks.txt"; var run = RunUtilities.CreateAndLoadPeaks(rawFile, peaksFile); //var run = new RunFactory().CreateRun(rawFile); var outputFile = @"\\protoapps\UserData\Fujimoto\TopDownPaperData\FINAL_DATA\_004\3D_PLOT\3DelutionProfile.txt"; Assert.IsNotNull(run); Assert.IsTrue(run.ResultCollection.MSPeakResultList.Count > 0); var extractor = new IsotopicProfileElutionExtractor(); var minScan = 3270; var maxScan = 3350; double minMZ = 700; double maxMZ = 1700; int[] scans; float[] intensities; double[] mzBinVals; extractor.Get3DElutionProfileFromPeakLevelData(run, minScan, maxScan, minMZ, maxMZ, out scans, out mzBinVals, out intensities); var intensities2D = extractor.GetIntensitiesAs2DArray(); extractor.OutputElutionProfileToFile(outputFile); }
public XicAdaptor(string rawPath, string peaksPath) { Run run = RunUtilities.CreateAndLoadPeaks(rawPath, peaksPath); m_run = run; NetWindow = .02; MzPpmWindow = 20; }
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 GetPeakChromatogram_usePPMTolerance_Test1() { var run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); var targetMZ = 759.4032; var startScan = 5500; var stopScan = 6500; double toleranceInPPM = 20; var chromGen = new PeakChromatogramGenerator(); var xydata = chromGen.GenerateChromatogram(run, startScan, stopScan, targetMZ, toleranceInPPM, Globals.ToleranceUnit.PPM); Assert.IsNotNull(xydata); TestUtilities.DisplayXYValues(xydata); }
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 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 findSingleMassTag_test1() { var testFile = @"D:\Data\O16O18\Weijun\TechTest_O18_02\TechTest_O18_02_RunA_10Dec09_Doc_09-11-08.RAW"; var massTagFile = @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\2011\O16O18_TargetedProcessing\Targets\MassTags_MousePlasma_1709_allChargeStates_nonRedundant.txt"; var peakTestFile = testFile.Replace(".RAW", "_peaks.txt"); var run = RunUtilities.CreateAndLoadPeaks(testFile, peakTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 6643962; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new O16O18WorkflowParameters(); parameters.ChromNETTolerance = 0.1; parameters.MSToleranceInPPM = 10; var workflow = new O16O18Workflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); Assert.IsNotNull(result); result.DisplayToConsole(); Assert.IsNotNull(result.IsotopicProfile); Assert.IsNotNull(result.ScanSet); Assert.IsNotNull(result.ChromPeakSelected); Assert.AreEqual(2, result.IsotopicProfile.ChargeState); Assert.AreEqual(6865, result.ScanSet.PrimaryScanNumber); }
public void Test1() { var testFile = @"\\protoapps\UserData\Slysz\Data\O16O18\BSA\BSA_18O_99_8Jan11_Falcon_10-12-09.RAW"; var massTagFile = @"\\protoapps\UserData\Slysz\Data\O16O18\BSA\Targets\BSAmassTags_MinimalInfo_withScans.txt"; var peakTestFile = testFile.Replace(".RAW", "_peaks.txt"); var run = RunUtilities.CreateAndLoadPeaks(testFile, peakTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 3; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new O16O18WorkflowParameters(); parameters.ChromNETTolerance = 0.2; parameters.MSToleranceInPPM = 10; parameters.ChromPeakSelectorMode = Globals.PeakSelectorMode.MostIntense; parameters.ChromGeneratorMode = DeconTools.Backend.Globals.ChromatogramGeneratorMode.O16O18_THREE_MONOPEAKS; parameters.ChromSmootherNumPointsInSmooth = 31; var workflow = new O16O18Workflow(run, parameters); workflow.Execute(); Assert.IsTrue(workflow.Result.Target.ScanLCTarget > 0); Assert.IsNotNull(workflow.ChromPeakSelected); Assert.AreEqual(10622, (int)workflow.ChromPeakSelected.XValue); Console.WriteLine("ChromPeak scan value = " + workflow.ChromPeakSelected.XValue); }
public void GetPeakChromatogram_IQStyle_Test1() { var run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); var target = TestUtilities.GetIQTargetStandard(1); //TestUtilities.DisplayIsotopicProfileData(target.TheorIsotopicProfile); var chromGen = new PeakChromatogramGenerator(); chromGen.ChromatogramGeneratorMode = Globals.ChromatogramGeneratorMode.TOP_N_PEAKS; chromGen.TopNPeaksLowerCutOff = 0.4; chromGen.Tolerance = 10; var chromXYData = chromGen.GenerateChromatogram(run, target.TheorIsotopicProfile, target.ElutionTimeTheor); Assert.IsNotNull(chromXYData); TestUtilities.DisplayXYValues(chromXYData); }
public void highMassError_DatasetTest1() { 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_for_alignment.txt"; var workflowParameterFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\WorkflowParameterFiles\TargetedAlignmentWorkflowParameters1.xml"; var run = RunUtilities.CreateAndLoadPeaks(datasetFile, datasetFile.Replace(".RAW", "_peaks.txt")); var parameters = new TargetedAlignerWorkflowParameters(); parameters.LoadParameters(workflowParameterFile); parameters.ChromNETTolerance = 0.3; parameters.ChromGenTolerance = 60; parameters.MSToleranceInPPM = 60; Console.WriteLine(parameters.ToStringWithDetails()); var aligner = new TargetedAlignerWorkflow(run, parameters); aligner.outputToConsole = true; aligner.SetMassTags(massTagFile); aligner.Execute(); }
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 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 void GetPeakChromatogram_IQStyle_Test1() { //Run run = RunUtilities.CreateAndLoadPeaks(FileRefs.RawDataMSFiles.OrbitrapStdFile1, // FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); var fileName = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw"; var run = RunUtilities.CreateAndLoadPeaks(fileName); var target = TestUtilities.GetIQTargetStandard(1); //TestUtilities.DisplayIsotopicProfileData(target.TheorIsotopicProfile); var chromGen = new PeakChromatogramGenerator(); chromGen.ChromatogramGeneratorMode = Globals.ChromatogramGeneratorMode.TOP_N_PEAKS; //chromGen.ChromatogramGeneratorMode = Globals.ChromatogramGeneratorMode.; chromGen.TopNPeaksLowerCutOff = 0.4; chromGen.Tolerance = 10; //var chromXYData = chromGen.GenerateChromatogram(run, target.TheorIsotopicProfile, target.ElutionTimeTheor); // var chromXYData = chromGen.GenerateChromatogram(run, new List<double> { 481.27410, 481.77542, 482.27683 }, 4000, 6500, 0.009, Globals.ToleranceUnit.MZ); // var chromXYData = chromGen.GenerateChromatogram(run,500,7000,490.26483,0.005,Globals.ToleranceUnit.MZ); // Assert.IsNotNull(chromXYData); Console.WriteLine("481.27410"); var chromXYData1 = chromGen.GenerateChromatogram(run, 500, 7000, 481.27410, 0.005, Globals.ToleranceUnit.MZ); TestUtilities.DisplayXYValues(chromXYData1); // TestUtilities.DisplayXYValues(chromXYData); var minx1 = chromXYData1.Xvalues.Min(); var maxx1 = chromXYData1.Xvalues.Max(); Console.WriteLine("481.77542"); // chromXYData1. var chromXYData2 = chromGen.GenerateChromatogram(run, 500, 7000, 481.77542, 0.005, Globals.ToleranceUnit.MZ); TestUtilities.DisplayXYValues(chromXYData2); // TestUtilities.DisplayXYValues(chromXYData); var minx2 = chromXYData2.Xvalues.Min(); var maxx2 = chromXYData2.Xvalues.Max(); Console.WriteLine("482.27683"); var chromXYData3 = chromGen.GenerateChromatogram(run, 500, 7000, 482.27683, 0.005, Globals.ToleranceUnit.MZ); TestUtilities.DisplayXYValues(chromXYData3); TestUtilities.DisplayXYValues(chromXYData3); var minx3 = chromXYData3.Xvalues.Min(); var maxx3 = chromXYData3.Xvalues.Max(); var minxhelper = Math.Max(minx1, minx2); var minx = Math.Max(minxhelper, minx3); var maxxhelper = Math.Min(maxx1, maxx2); var maxX = Math.Min(maxxhelper, maxx3); var c1start = chromXYData1.GetClosestXVal(minx); var c2start = chromXYData2.GetClosestXVal(minx); var c3start = chromXYData3.GetClosestXVal(minx); var c1stop = chromXYData1.GetClosestXVal(maxX); var c2stop = chromXYData2.GetClosestXVal(maxX); var c3stop = chromXYData3.GetClosestXVal(maxX); chromXYData1.NormalizeYData(); chromXYData2.NormalizeYData(); chromXYData3.NormalizeYData(); var c1 = new double[c1stop - c1start + 1]; var c2 = new double[c2stop - c2start + 1]; var c3 = new double[c3stop - c3start + 1]; for (int i = c1start, j = 0; i <= c1stop; i++, j++) { c1[j] = chromXYData1.Yvalues[i]; } for (int i = c2start, j = 0; i <= c2stop; i++, j++) { c2[j] = chromXYData2.Yvalues[i]; } for (int i = c3start, j = 0; i <= c3stop; i++, j++) { c3[j] = chromXYData3.Yvalues[i]; } for (var i = 0; i < c1.Length; i++) { Console.WriteLine("{0}\t{1}\t{2}", c1[i], c2[i], c3[i]); } // double c1chromEven= chromXYData1.Xvalues var corr1 = MathNet.Numerics.Statistics.Correlation.Pearson(c1, c2); var corr2 = MathNet.Numerics.Statistics.Correlation.Pearson(c1, c3); Console.WriteLine("HERE IS THE CORRELATION: " + corr1); Console.WriteLine("HERE IS THE CORRELATION: " + corr2); //bool alldone = false, done1 = false, done2 = false, done3 = false; //int onestarting=0,twostarting=0,threestarting=0; //while (!alldone) //{ // if (!done1) // { // if (chromXYData1.Xvalues[onestarting]==minx) // { // done1 = true; // } // else // { // } // } // if (!done2) // { // } // if (!done3) // { // } // alldone = done1 && done2 && done3; //} }
public void Test1() { var testFile = @"D:\Data\Orbitrap\BrianIQTesting\QC_Shew_11_02_pt5-b_6Jun11_Sphinx_11-03-27.RAW"; var peaksTestFile = @"D:\Data\Orbitrap\BrianIQTesting\QC_Shew_11_02_pt5-b_6Jun11_Sphinx_11-03-27_peaks.txt"; var run = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile); var target = new LcmsFeatureTarget(); target.ID = 0; target.MZ = 715.39214; target.ScanLCTarget = 7343; target.ElutionTimeUnit = Globals.ElutionTimeUnit.ScanNum; run.CurrentMassTag = target; var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); double chromPeakGeneratorTolInPPM = 20; var chromGeneratorMode = Globals.ChromatogramGeneratorMode.MZ_BASED; var chromGen = new PeakChromatogramGenerator(chromPeakGeneratorTolInPPM, chromGeneratorMode); // If we want to use the Execute Command //BLL .1 and .5 NET windows work. .02 NET window does not BR and SN was set to 1 however) chromGen.ChromWindowWidthForNonAlignedData = .02F; var pointsToSmooth = 5; var chromSmoother = new SavitzkyGolaySmoother(pointsToSmooth, 2); //BLL We also tried to set the BR and SIG NOISE to 0. This did not work var chromPeakDetectorPeakBR = 0.5; var chromPeakDetectorSigNoise = 0.5; var chromPeakDetector = new ChromPeakDetector(chromPeakDetectorPeakBR, chromPeakDetectorSigNoise); var chromPeakSelectorParameters = new ChromPeakSelectorParameters(); chromPeakSelectorParameters.PeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget; var chromPeakSelector = new BasicChromPeakSelector(chromPeakSelectorParameters); var smartChromPeakParameters = new SmartChromPeakSelectorParameters(); var smartChromPeakSelector = new SmartChromPeakSelector(smartChromPeakParameters); //this generates an extracted ion chromatogram // Since we are not using the built in generator, chromGen.Execute(run.ResultCollection); //this smooths the data - very important step! //BLL. This didnt work for me when we first started, instead of using the NET window above. //chromGen.GenerateChromatogram(run, // target.ScanLCTarget - 300, // target.ScanLCTarget + 300, // target.MZ, // chromPeakGeneratorTolInPPM); chromSmoother.Execute(run.ResultCollection); //this detects peaks within an extracted ion chromatogram chromPeakDetector.Execute(run.ResultCollection); //this selects the peak chromPeakSelector.Execute(run.ResultCollection); //smartChromPeakSelector.Execute(run.ResultCollection); //TestUtilities.DisplayXYValues(run.XYData); TestUtilities.DisplayPeaks(run.PeakList); Console.WriteLine("Number of peaks detected = " + run.PeakList.Count); Console.WriteLine("Selected peak= " + result.ChromPeakSelected); }
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 checkO16O18ChromGenMode_test1() { // var testFile = @"D:\Data\O16O18\Weijun\TechTest_O18_02\TechTest_O18_02_RunA_10Dec09_Doc_09-11-08.RAW"; var massTagFile = @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\2011\O16O18_TargetedProcessing\Targets\MassTags_MousePlasma_1709_allChargeStates_nonRedundant.txt"; var peakTestFile = testFile.Replace(".RAW", "_peaks.txt"); var run = RunUtilities.CreateAndLoadPeaks(testFile, peakTestFile); var mtc = new TargetCollection(); var mtimporter = new MassTagFromTextFileImporter(massTagFile); mtc = mtimporter.Import(); var testMassTagID = 20746149; run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First(); TargetedWorkflowParameters parameters = new O16O18WorkflowParameters(); parameters.ChromNETTolerance = 0.1; parameters.MSToleranceInPPM = 10; parameters.ChromGeneratorMode = DeconTools.Backend.Globals.ChromatogramGeneratorMode.O16O18_THREE_MONOPEAKS; parameters.ChromPeakDetectorPeakBR = 1; var workflow = new O16O18Workflow(run, parameters); workflow.Execute(); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); result.DisplayToConsole(); // Assert.AreEqual(3498, result.ScanSet.PrimaryScanNumber); Console.WriteLine("O16O18 ChromMode PeaksWithinTol = " + result.NumChromPeaksWithinTolerance); Console.WriteLine("O16O18 ChromMode HQPeaksWithinTol = " + result.NumQualityChromPeaks); //foreach (var item in workflow.ChromPeaksDetected) //{ // Console.WriteLine("peak\t" + item.XValue.ToString("0.0") + "\t" + item.Height.ToString("0")); //} // TestUtilities.DisplayXYValues(workflow.ChromatogramXYData); parameters.ChromGeneratorMode = Globals.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK; workflow = new O16O18Workflow(run, parameters); workflow.Execute(); result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); Console.WriteLine("MonoChromMode PeaksWithinTol = " + result.NumChromPeaksWithinTolerance); Console.WriteLine("O16O18 ChromMode HQPeaksWithinTol = " + result.NumQualityChromPeaks); // TestUtilities.DisplayXYValues(workflow.ChromatogramXYData); //foreach (var item in workflow.ChromPeaksDetected) //{ // Console.WriteLine("peak\t" + item.XValue.ToString("0.0") + "\t" + item.Height.ToString("0")); //} result.DisplayToConsole(); }