public void MSGeneratorOnUIMFTest1() { var uimfFile = FileRefs.RawDataMSFiles.UIMFStdFile3; var run = new RunFactory().CreateRun(uimfFile); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true); var zeroFiller = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 1; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); var testLCScan = 500; var testIMSScan = 120; var numIMSScanSummed = 7; var lowerIMSScan = testIMSScan - (numIMSScanSummed - 1) / 2; var upperIMSScan = testIMSScan + (numIMSScanSummed - 1) / 2; var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1); run.CurrentScanSet = scanSet; ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan); msgen.Execute(run.ResultCollection); Assert.IsTrue(run.XYData.Xvalues.Length > 100); }
public static Run CreateResultsFromThreeScansOfStandardOrbitrapData() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); run.ScanSetCollection.Create(run, 6000, 6020, 1, 1, false); Task msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); Task peakDetector = new DeconToolsPeakDetectorV2(); Task decon = new ThrashDeconvolutorV2(); Task msScanInfoCreator = new ScanResultUpdater(); Task flagger = new ResultValidatorTask(); foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); msScanInfoCreator.Execute(run.ResultCollection); flagger.Execute(run.ResultCollection); } return(run); }
public void ThrashPreferPlusOneChargeStateTest1() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(0.5, 2, Globals.PeakFitType.QUADRATIC, true); peakDetector.IsDataThresholded = true; var parameters = new ThrashParameters(); parameters.MinMSFeatureToBackgroundRatio = 1; parameters.MaxFit = 0.3; parameters.CheckAllPatternsAgainstChargeState1 = true; var deconvolutor = new ThrashDeconvolutorV2(parameters); var scan = new ScanSet(6005); run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); run.PeakList = run.PeakList.Where(p => p.XValue > 750 && p.XValue < 753).ToList(); deconvolutor.Execute(run.ResultCollection); Assert.IsTrue(run.ResultCollection.ResultList.Count > 0); var result1 = run.ResultCollection.ResultList.First(); Assert.AreEqual(1, result1.IsotopicProfile.ChargeState); Console.WriteLine("--------- Prefer +1 charge state ----------------"); TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); run.ResultCollection.ResultList.Clear(); run.ResultCollection.IsosResultBin.Clear(); deconvolutor.Parameters.CheckAllPatternsAgainstChargeState1 = false; deconvolutor.Execute(run.ResultCollection); Console.WriteLine("\n--------- No charge state bias ----------------"); TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); Assert.IsTrue(run.ResultCollection.ResultList.Count > 0); result1 = run.ResultCollection.ResultList.First(); Assert.AreEqual(3, result1.IsotopicProfile.ChargeState); }
public void ThrashV2OnIMSDataTest1() { var uimfFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\UIMF\Sarc_MS2_90_6Apr11_Cheetah_11-02-19.uimf"; var run = new RunFactory().CreateRun(uimfFile); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true); var zeroFiller = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 1; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); var testLCScan = 500; var testIMSScan = 120; var numIMSScanSummed = 7; var lowerIMSScan = testIMSScan - (numIMSScanSummed - 1) / 2; var upperIMSScan = testIMSScan + (numIMSScanSummed - 1) / 2; var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1); run.CurrentScanSet = scanSet; ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan); msgen.Execute(run.ResultCollection); zeroFiller.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); newDeconvolutor.Execute(run.ResultCollection); TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); Assert.IsTrue(run.ResultCollection.ResultList.Count > 0); Assert.AreEqual(33, run.ResultCollection.ResultList.Count); var result1 = run.ResultCollection.ResultList[0]; Assert.AreEqual(13084442, (decimal)Math.Round(result1.IntensityAggregate)); Assert.AreEqual(960.53365m, (decimal)Math.Round(result1.IsotopicProfile.MonoIsotopicMass, 5)); Assert.AreEqual(2, result1.IsotopicProfile.ChargeState); }
public void UIMFTesting1() { var uimfFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\UIMF\Sarc_MS2_90_6Apr11_Cheetah_11-02-19.uimf"; var run = new RunFactory().CreateRun(uimfFile); var testLCScan = 500; var testIMSScan = 120; var numIMSScanSummed = 7; var lowerIMSScan = testIMSScan - (numIMSScanSummed - 1) / 2; var upperIMSScan = testIMSScan + (numIMSScanSummed - 1) / 2; var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(2, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 2; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); run.CurrentScanSet = scanSet; ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan); msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); //6 500 728.6907 729.69800 1 34678 0.252 0.000 run.PeakList = (from n in run.PeakList where n.XValue > 729 && n.XValue < 731 select n).ToList(); newDeconvolutor.Execute(run.ResultCollection); TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); }
public static Run CreateResultsFromTwoFramesOfStandardUIMFData() { var run = new UIMFRun(FileRefs.RawDataMSFiles.UIMFStdFile1); run.ResultCollection.ResultType = Globals.ResultType.UIMF_TRADITIONAL_RESULT; run.ScanSetCollection.Create(run, 500, 501, 3, 1); run.IMSScanSetCollection.Create(run, 250, 270, 9, 1); Task msgen = new UIMF_MSGenerator(); Task peakDetector = new DeconToolsPeakDetectorV2(); Task decon = new ThrashDeconvolutorV2(); Task msScanInfoCreator = new ScanResultUpdater(); Task flagger = new ResultValidatorTask(); Task ticExtractor = new DeconTools.Backend.ProcessingTasks.UIMF_TICExtractor(); Task driftTimeextractor = new UIMFDriftTimeExtractor(); foreach (var frame in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = frame; foreach (IMSScanSet scan in run.IMSScanSetCollection.ScanSetList) { run.CurrentIMSScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); flagger.Execute(run.ResultCollection); driftTimeextractor.Execute(run.ResultCollection); msScanInfoCreator.Execute(run.ResultCollection); ticExtractor.Execute(run.ResultCollection); } } return(run); }
public static Run CreatePeakDataFromStandardOrbitrapData() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); run.ScanSetCollection.Create(run, 6000, 6050, 1, 1, false); Task msgen = new GenericMSGenerator(); var peakDetector = new DeconToolsPeakDetectorV2(); peakDetector.PeaksAreStored = true; Task decon = new ThrashDeconvolutorV2(); Task msScanInfoCreator = new ScanResultUpdater(); Task flagger = new ResultValidatorTask(); foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); } return(run); }
public void ThrashV2OnOrbitrapTest1() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true); peakDetector.IsDataThresholded = true; var parameters = new ThrashParameters(); parameters.MinMSFeatureToBackgroundRatio = 1; parameters.MaxFit = 0.3; var deconvolutor = new ThrashDeconvolutorV2(parameters); var scan = new ScanSet(6005); run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); deconvolutor.Execute(run.ResultCollection); Console.WriteLine(run.ResultCollection.MSPeakResultList); // TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); Assert.IsTrue(run.ResultCollection.ResultList.Count > 0); //Assert.AreEqual(187, run.ResultCollection.ResultList.Count); var result1 = run.ResultCollection.ResultList[0]; Assert.AreEqual(13084442, (decimal)Math.Round(result1.IntensityAggregate)); Assert.AreEqual(960.53365m, (decimal)Math.Round(result1.IsotopicProfile.MonoIsotopicMass, 5)); Assert.AreEqual(2, result1.IsotopicProfile.ChargeState); }
public void Stolen_CompareOldAndNewDeconvolutorsOrbitrap() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); //string fileName = @"C:\Users\Klin638\Documents\Visual Studio 2010\Backup Files\New folder\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw"; //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\Vorbi\Yellow_C12_099_18Mar10_Griffin_10-01-13.raw"; //@"C:\Users\Klin638\Documents\Visual Studio 2010\Backup Files\New folder\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; // //Run run = RunUtilities.CreateAndLoadPeaks(fileName); //Run run = new RunFactory().CreateRun(fileName); run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false); //to sum //run.ScanSetCollection.Create(run, 6005, 6005, 5, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 3; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); //var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters); var scanset = new ScanSet(6005); //For summing mass spectra: //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5); run.CurrentScanSet = scanset; var oldDeconvolutor = new HornDeconvolutor(); oldDeconvolutor.MinPeptideBackgroundRatio = 3; oldDeconvolutor.MaxFitAllowed = 0.4; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); //run.PeakList = run.PeakList.Where(p => p.XValue > 634 && p.XValue < 642).ToList(); //run.DeconToolsPeakList = run.DeconToolsPeakList.Where(p => p.mdbl_mz > 634 && p.mdbl_mz < 642).ToArray(); run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity; newDeconvolutor.Execute(run.ResultCollection); //Console.WriteLine("\n--------------New decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var newResults = new List <IsosResult>(run.ResultCollection.ResultList); //TestUtilities.DisplayMSFeatures(newResults); //return; // DisplayPPMErrorsForeachPeakOfMSFeature(newResults); run.ResultCollection.ResultList.Clear(); run.ResultCollection.IsosResultBin.Clear(); oldDeconvolutor.Execute(run.ResultCollection); var oldResults = new List <IsosResult>(run.ResultCollection.ResultList); //Console.WriteLine("\n--------------Old decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var sharedIsos = new List <IsosResult>(); var uniqueToNew = new List <IsosResult>(); var uniqueToOld = new List <IsosResult>(); GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld); Console.WriteLine("\n--------------Common to new and Old ------------------"); TestUtilities.DisplayMSFeatures(sharedIsos); Console.WriteLine("\n--------------Unique to new ------------------"); TestUtilities.DisplayMSFeatures(uniqueToNew); var outputFilename = @"C:\Temp\ThrashTesting\exportedIsos.csv"; var exporter = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Globals.ExporterType.Text, outputFilename); exporter.ExportIsosResults(uniqueToNew); Console.WriteLine("\n--------------Unique to old ------------------"); TestUtilities.DisplayMSFeatures(uniqueToOld); }
public void CompareOldAndNewDeconvolutorsUIMF() { var uimfFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\UIMF\Sarc_MS2_90_6Apr11_Cheetah_11-02-19.uimf"; var run = new RunFactory().CreateRun(uimfFile); var testLCScan = 500; var testIMSScan = 120; var numIMSScanSummed = 7; var lowerIMSScan = testIMSScan - (numIMSScanSummed - 1) / 2; var upperIMSScan = testIMSScan + (numIMSScanSummed - 1) / 2; var scanSet = new ScanSetFactory().CreateScanSet(run, testLCScan, 1); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true); var zeroFiller = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 1; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); var oldDeconvolutor = new HornDeconvolutor(); oldDeconvolutor.MinPeptideBackgroundRatio = 1; oldDeconvolutor.MaxFitAllowed = 0.4; run.CurrentScanSet = scanSet; ((UIMFRun)run).CurrentIMSScanSet = new IMSScanSet(testIMSScan, lowerIMSScan, upperIMSScan); msgen.Execute(run.ResultCollection); zeroFiller.Execute(run.ResultCollection); //smoother.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); newDeconvolutor.Execute(run.ResultCollection); //Console.WriteLine("\n--------------New decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var newResults = new List <IsosResult>(run.ResultCollection.ResultList); // TestUtilities.DisplayMSFeatures(newResults); //DisplayPPMErrorsForeachPeakOfMSFeature(newResults); //return; run.ResultCollection.ResultList.Clear(); run.ResultCollection.IsosResultBin.Clear(); oldDeconvolutor.Execute(run.ResultCollection); var oldResults = new List <IsosResult>(run.ResultCollection.ResultList); //Console.WriteLine("\n--------------Old decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var sharedIsos = new List <IsosResult>(); var uniqueToNew = new List <IsosResult>(); var uniqueToOld = new List <IsosResult>(); var toleranceForComparison = 0.05; foreach (var newresult in newResults) { var foundMatch = false; for (var i = 0; i < oldResults.Count; i++) { var oldResult = oldResults[i]; if (Math.Abs(newresult.IsotopicProfile.MonoIsotopicMass - oldResult.IsotopicProfile.MonoIsotopicMass) < toleranceForComparison && newresult.IsotopicProfile.ChargeState == oldResult.IsotopicProfile.ChargeState) { foundMatch = true; } } if (foundMatch) { sharedIsos.Add(newresult); } else { uniqueToNew.Add(newresult); } } foreach (var oldResult in oldResults) { var foundMatch = false; for (var i = 0; i < newResults.Count; i++) { var newresult = newResults[i]; if (Math.Abs(newresult.IsotopicProfile.MonoIsotopicMass - oldResult.IsotopicProfile.MonoIsotopicMass) < toleranceForComparison && newresult.IsotopicProfile.ChargeState == oldResult.IsotopicProfile.ChargeState) { foundMatch = true; } } if (!foundMatch) { uniqueToOld.Add(oldResult); } } Console.WriteLine("\n--------------Common to new and Old ------------------"); TestUtilities.DisplayMSFeatures(sharedIsos); Console.WriteLine("\n--------------Unique to new ------------------"); TestUtilities.DisplayMSFeatures(uniqueToNew); Console.WriteLine("\n--------------Unique to old ------------------"); TestUtilities.DisplayMSFeatures(uniqueToOld); }
public void CompareOldAndNewDeconvolutorsOrbitrap() { Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); //run.ScanSetCollection.Create(run, 6005, 6005, 1, 1, false); //to sum run.ScanSetCollection.Create(run, 6005, 6005, 5, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDetector = new DeconToolsPeakDetectorV2(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = 3; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); var scanset = new ScanSet(6005); //For summing mass spectra: //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5); run.CurrentScanSet = scanset; var oldDeconvolutor = new HornDeconvolutor(); oldDeconvolutor.MinPeptideBackgroundRatio = 3; oldDeconvolutor.MaxFitAllowed = 0.4; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); //run.PeakList = run.PeakList.Where(p => p.XValue > 634 && p.XValue < 642).ToList(); //run.DeconToolsPeakList = run.DeconToolsPeakList.Where(p => p.mdbl_mz > 634 && p.mdbl_mz < 642).ToArray(); run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity; newDeconvolutor.Execute(run.ResultCollection); //Console.WriteLine("\n--------------New decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var newResults = new List <IsosResult>(run.ResultCollection.ResultList); //TestUtilities.DisplayMSFeatures(newResults); //return; // DisplayPPMErrorsForeachPeakOfMSFeature(newResults); run.ResultCollection.ResultList.Clear(); run.ResultCollection.IsosResultBin.Clear(); oldDeconvolutor.Execute(run.ResultCollection); var oldResults = new List <IsosResult>(run.ResultCollection.ResultList); //Console.WriteLine("\n--------------Old decon ------------------"); //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); var sharedIsos = new List <IsosResult>(); var uniqueToNew = new List <IsosResult>(); var uniqueToOld = new List <IsosResult>(); GetComparisons(newResults, oldResults, sharedIsos, uniqueToNew, uniqueToOld); Console.WriteLine("\n--------------Common to new and Old ------------------"); TestUtilities.DisplayMSFeatures(sharedIsos); Console.WriteLine("\n--------------Unique to new ------------------"); TestUtilities.DisplayMSFeatures(uniqueToNew); var diOutputFolder = new DirectoryInfo(@"C:\Temp\ThrashTesting"); if (!diOutputFolder.Exists) { diOutputFolder.Create(); } var outputFilename = Path.Combine(diOutputFolder.FullName, "exportedIsos.csv"); var exporter = IsosExporterFactory.CreateIsosExporter(run.ResultCollection.ResultType, Globals.ExporterType.Text, outputFilename); exporter.ExportIsosResults(uniqueToNew); Console.WriteLine("\n--------------Unique to old ------------------"); TestUtilities.DisplayMSFeatures(uniqueToOld); }
public void BPISaturationCorrectedTest1() { var filename = @"D:\Data\UIMF\Sarc_P13_C10_1186_23Sep11_Cheetah_11-09-06.uimf"; var run = new RunFactory().CreateRun(filename); run.ScanSetCollection = new ScanSetCollection(); //scanSetCollection.Create(run, 500, 550,1,1); var startFrame = 477; var stopFrame = 477; //startFrame = run.MinLCScan; //stopFrame = run.MaxLCScan; run.ScanSetCollection.Create(run, startFrame, stopFrame, 1, 1); ((UIMFRun)run).IMSScanSetCollection = new IMSScanSetCollection(); ((UIMFRun)run).IMSScanSetCollection.Create(run, 122, 122, 1, 1); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakDet = new DeconToolsPeakDetectorV2(); peakDet.PeakToBackgroundRatio = 2; peakDet.SignalToNoiseThreshold = 2; peakDet.IsDataThresholded = true; var _zeroFiller = new DeconToolsZeroFiller(); var _deconvolutor = new ThrashDeconvolutorV2(); _deconvolutor.UseAutocorrelationChargeDetermination = true; _deconvolutor.Parameters.MaxFit = 0.8; var saturationWorkflow = new SaturationIMSScanBasedWorkflow(new DeconToolsParameters(), run); var outputFile = @"C:\Users\d3x720\Documents\PNNL\My_DataAnalysis\2013\Saturation_Correction\chromOuputSatCorrected.txt"; using (var writer = new StreamWriter(outputFile)) { var uimfRun = (UIMFRun)run; var _unsummedMSFeatures = new List <IsosResult>(); foreach (var lcScanSet in run.ScanSetCollection.ScanSetList) { Console.WriteLine("Scanset= " + lcScanSet); uimfRun.ResultCollection.MSPeakResultList.Clear(); _unsummedMSFeatures.Clear(); var unsummedFrameSet = new ScanSet(lcScanSet.PrimaryScanNumber); //get saturated MSFeatures for unsummed data uimfRun.CurrentScanSet = unsummedFrameSet; var sb = new StringBuilder(); var errorInFrame = false; var numIMSScans = uimfRun.IMSScanSetCollection.ScanSetList.Count; for (var imsScanNum = 0; imsScanNum < numIMSScans; imsScanNum++) { var imsScanSet = uimfRun.IMSScanSetCollection.ScanSetList[imsScanNum]; uimfRun.ResultCollection.IsosResultBin.Clear(); //clear any previous MSFeatures var unsummedIMSScanset = new IMSScanSet(imsScanSet.PrimaryScanNumber); uimfRun.CurrentIMSScanSet = unsummedIMSScanset; try { msgen.Execute(run.ResultCollection); _zeroFiller.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); _deconvolutor.Deconvolute(uimfRun.ResultCollection); //adds to IsosResultBin } catch (Exception ex) { errorInFrame = true; } _unsummedMSFeatures.AddRange(run.ResultCollection.IsosResultBin); var basePeakIntensity = 0; //iterate over unsummed MSFeatures and check for saturation foreach (var isosResult in uimfRun.ResultCollection.IsosResultBin) { var isPossiblySaturated = isosResult.IntensityAggregate > 1e7; if (isPossiblySaturated) { var theorIso = new IsotopicProfile(); saturationWorkflow.RebuildSaturatedIsotopicProfile(run.XYData, isosResult, uimfRun.PeakList, out theorIso); saturationWorkflow.AdjustSaturatedIsotopicProfile(isosResult.IsotopicProfile, theorIso, true, true); } TestUtilities.DisplayIsotopicProfileData(isosResult.IsotopicProfile); var height = (int)isosResult.IsotopicProfile.getMostIntensePeak().Height; if (height > basePeakIntensity) { basePeakIntensity = height; } } sb.Append(basePeakIntensity); var isNotLastIMSScan = imsScanNum != numIMSScans - 1; if (isNotLastIMSScan) { sb.Append("\t"); } } if (errorInFrame) { } else { writer.WriteLine(sb.ToString()); } } } }