public void SpeedTest1() { var fileName = FileRefs.RawDataMSFiles.OrbitrapStdFile1; var run = new RunFactory().CreateRun(fileName); run.ScanSetCollection.Create(run, 5500, 5550, 1, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakBr = 1.3;//0.25; var peakDetector = new DeconToolsPeakDetectorV2(peakBr, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = peakBr; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters); var watch = new Stopwatch(); watch.Start(); foreach (var scanSet in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scanSet; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity; newDeconvolutor.Execute(run.ResultCollection); } watch.Stop(); Console.WriteLine("Time per scan (INFORMED) = " + watch.ElapsedMilliseconds / run.ScanSetCollection.ScanSetList.Count); }
public void CompareToScottsData1() { var fileName = FileRefs.RawDataMSFiles.OrbitrapStdFile1; var run = new RunFactory().CreateRun(fileName); run.ScanSetCollection.Create(run, 5509, 5509, 1, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakBr = 1.9;//1.3; var peakDetector = new DeconToolsPeakDetectorV2(peakBr, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = peakBr; thrashParameters.MaxFit = 0.4; var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters); var scanset = new ScanSet(5509); run.CurrentScanSet = scanset; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); run.CurrentScanSet.BackgroundIntensity = peakDetector.BackgroundIntensity; newDeconvolutor.Execute(run.ResultCollection); var scottMzVals = ReadScottsAnnotationsScan5509().ToArray(); var myMzVals = run.ResultCollection.ResultList.Select(p => p.IsotopicProfile.MonoPeakMZ).OrderBy(p => p).ToArray(); var comparisions = new Dictionary <decimal, double>(); foreach (var scottVal in scottMzVals) { var tolerance = 0.01; var indexInThrash = MathUtils.BinarySearchWithTolerance(myMzVals, scottVal, 0, myMzVals.Length - 1, tolerance); var myMzVal = indexInThrash == -1 ? 0.0d : myMzVals[indexInThrash]; comparisions.Add((decimal)scottVal, myMzVal); } var numCorrect = comparisions.Values.Count(p => p > 0); var numMissing = scottMzVals.Count() - numCorrect; Console.WriteLine("Total annotated= \t" + scottMzVals.Count()); Console.WriteLine("Number correct = \t" + numCorrect); Console.WriteLine("Number missing = \t" + numMissing); }
public void Stolen_ThrashV2OnOrbitrapTest1() { //Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); var fileName = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw"; //Run run = RunUtilities.CreateAndLoadPeaks(fileName); var run = new RunFactory().CreateRun(fileName); 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 InformedThrashDeconvolutor(parameters); //var deconvolutor2 = new 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 TestAndComparingScottsData() { var fileName = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\Orbitrap\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.raw"; var run = new RunFactory().CreateRun(fileName); run.ScanSetCollection.Create(run, 5509, 5509, 1, 1, false); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var peakBr = 0.5; var peakDetector = new DeconToolsPeakDetectorV2(peakBr, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); var thrashParameters = new ThrashParameters(); thrashParameters.MinMSFeatureToBackgroundRatio = peakBr;//3; thrashParameters.MaxFit = 0.4; //var newDeconvolutor = new ThrashDeconvolutorV2(thrashParameters); var newDeconvolutor = new InformedThrashDeconvolutor(thrashParameters); var scanset = new ScanSet(5509); //For summing mass spectra: //scanset = new ScanSetFactory().CreateScanSet(run, 6005, 5); run.CurrentScanSet = scanset; var oldDeconvolutor = new HornDeconvolutor(); oldDeconvolutor.MinPeptideBackgroundRatio = peakBr; 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); var scottsData = GetScottsData(); var scottsDataArray = scottsData.ToArray(); GetScottComparisons(sharedIsos, uniqueToNew, uniqueToOld, scottsDataArray); 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); }