public void agilentDeconTest1() { RunFactory runFact = new RunFactory(); Run run = runFact.CreateRun(agilentFile); MSGeneratorFactory msfactory = new MSGeneratorFactory(); Task msgen = msfactory.CreateMSGenerator(run.MSFileType); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(); peakDet.PeakBackgroundRatio = 7; peakDet.SigNoiseThreshold = 3; HornDeconvolutor decon = new HornDeconvolutor(); ScanSet scan1821 = new ScanSet(1821); run.CurrentScanSet = scan1821; msgen.Execute(run.ResultCollection); run.XYData = run.XYData.TrimData(450, 520, TODO); peakDet.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList); }
public void weirdZeroValuesForMZsAtEarlyFramesTest1() { UIMFRun run = new UIMFRun(uimfTestfile1); FrameSetCollectionCreator framecreator = new FrameSetCollectionCreator(run, 1, 10, 5, 1); framecreator.Create(); ScanSetCollectionCreator scanCreator = new ScanSetCollectionCreator(run, 1, 1); scanCreator.Create(); Task msgen = new UIMF_MSGenerator(0, 5000); Task peakDet = new DeconToolsPeakDetector(); int scanstop = 599; int scanstart = 0; for (int i = scanstart; i < scanstop; i++) { run.CurrentFrameSet = run.FrameSetCollection.GetFrameSet(1); run.CurrentScanSet = run.ScanSetCollection.GetScanSet(i); msgen.Execute(run.ResultCollection); if (run.XYData != null && run.XYData.Xvalues != null && run.XYData.Xvalues[0] == 0) { reportXYValues(run); } } }
public void test1() { Run run = new XCaliburRun(lowmwRawfile); ResultCollection results = new ResultCollection(run); run.CurrentScanSet = new ScanSet(1); Task msgen = new GenericMSGenerator(0, 1000); msgen.Execute(results); DeconToolsPeakDetector peakdetector = new DeconToolsPeakDetector(); peakdetector.PeakBackgroundRatio = 0.5; peakdetector.PeakFitType = DeconTools.Backend.Globals.PeakFitType.QUADRATIC; peakdetector.SigNoiseThreshold = 3; peakdetector.IsDataThresholded = true; peakdetector.Execute(results); //Task rapidDecon = new RapidDeconvolutor(); //rapidDecon.Execute(results); Task simpleDecon = new SimpleDecon(0.0005); simpleDecon.Execute(results); Console.WriteLine(results.Run.PeakList.Count); Console.WriteLine(results.ResultList.Count); string reportedResults = reportResults(results.ResultList); Console.WriteLine(reportedResults); }
public void test1() { Run run = new ICR2LSRun(icr2LSRawDatafile1); run.CurrentScanSet = new ScanSet(2210); Task msGen = new GenericMSGenerator(732, 746); msGen.Execute(run.ResultCollection); Task peakdetector = new DeconToolsPeakDetector(); ((DeconToolsPeakDetector)peakdetector).PeakBackgroundRatio = 5; ((DeconToolsPeakDetector)peakdetector).SigNoiseThreshold = 2; peakdetector.Execute(run.ResultCollection); Console.WriteLine("Peaks detected = " + run.PeakList.Count); TomN14N15Analyzer analyzer = new TomN14N15Analyzer(); analyzer.ExtractN14N15Values(run.ResultCollection); Console.WriteLine("Peaks detected = " + run.PeakList.Count); Assert.AreEqual(14, run.PeakList.Count); }
public void test1() { Run run = new XCaliburRun(bsaO16O18file1); MSGeneratorFactory msgenFact = new MSGeneratorFactory(); Task msgen = msgenFact.CreateMSGenerator(run.MSFileType); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, true); O16O18FeatureFinder finder = new O16O18FeatureFinder(); List <MassTag> massTagList = TestUtilities.CreateO16O18TestMassTagList1(); run.CurrentMassTag = massTagList[0]; TomTheorFeatureGenerator theorFeatureGen = new TomTheorFeatureGenerator(); theorFeatureGen.GenerateTheorFeature(run.CurrentMassTag); run.CurrentScanSet = new ScanSet(3294); msgen.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); IsotopicProfile o16O18profile = finder.FindFeature(run.PeakList, run.CurrentMassTag.IsotopicProfile, 10, true); TestUtilities.DisplayIsotopicProfileData(o16O18profile); }
public void outputToSqlite_uimf_test1() { List <Run> runcoll = new List <Run>(); Run run = new UIMFRun(uimfFile1); runcoll.Add(run); FrameSetCollectionCreator fsc = new FrameSetCollectionCreator(run, 800, 809, 3, 1); fsc.Create(); ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 200, 220, 9, 1); sscc.Create(); Task msgen = new UIMF_MSGenerator(); Task peakDetector = new DeconToolsPeakDetector(); Task decon = new RapidDeconvolutor(); Task driftTimeExtractor = new DeconTools.Backend.ProcessingTasks.UIMFDriftTimeExtractor(); Task origIntensExtr = new DeconTools.Backend.ProcessingTasks.OriginalIntensitiesExtractor(); Task ticExtractor = new DeconTools.Backend.ProcessingTasks.UIMF_TICExtractor(); Task scanResultUpdater = new ScanResultUpdater(); Task sqliteExporter = new DeconTools.Backend.ProcessingTasks.ResultExporters.ScanResultExporters.UIMFScanResult_SqliteExporter(uimf_Sqlite_ScanResultOutputFile1); Stopwatch sw; foreach (FrameSet frame in ((UIMFRun)run).FrameSetCollection.FrameSetList) { ((UIMFRun)run).CurrentFrameSet = frame; foreach (ScanSet scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); ticExtractor.Execute(run.ResultCollection); scanResultUpdater.Execute(run.ResultCollection); driftTimeExtractor.Execute(run.ResultCollection); origIntensExtr.Execute(run.ResultCollection); sw = new Stopwatch(); sw.Start(); sqliteExporter.Execute(run.ResultCollection); sw.Stop(); if (sw.ElapsedMilliseconds > 10) { Console.WriteLine("SqliteExporter execution time = \t" + sw.ElapsedMilliseconds); } } } }
public List <Task> getStandardTaskList(Run run) { Task peakChromGen = new PeakChromatogramGenerator(chromPPMTolerance); Task smoother = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2); Task peakDet = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 0.5); Task chromPeakSel = new DeconTools.Backend.ProcessingTasks.ChromPeakSelector(1, 0.01, Globals.PeakSelectorMode.CLOSEST_TO_TARGET); MSGeneratorFactory msgenFactory = new MSGeneratorFactory(); Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType); DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 3, false, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC); Task mspeakDet = new DeconToolsPeakDetector(peakParams); Task theorFeatureGen = new TomTheorFeatureGenerator(); Task finder = new N14N15TFFTask(5); Task quant = new N14N15QuantifierTask(1); Task fitScoreCalc = new IsotopicProfileFitScoreCalculator(); List <Task> taskList = new List <Task>(); taskList.Add(peakChromGen); taskList.Add(smoother); taskList.Add(peakDet); taskList.Add(chromPeakSel); taskList.Add(msgen); taskList.Add(mspeakDet); taskList.Add(theorFeatureGen); taskList.Add(finder); taskList.Add(quant); taskList.Add(fitScoreCalc); return(taskList); }
public void exporterTest1() { Run run = new IMFRun(imfFilepath); run.CurrentScanSet = new ScanSet(233); ResultCollection results = new ResultCollection(run); Task msGen = new GenericMSGenerator(); msGen.Execute(results); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(results); DeconToolsV2.HornTransform.clsHornTransformParameters hornParams = new DeconToolsV2.HornTransform.clsHornTransformParameters(); Task decon = new HornDeconvolutor(hornParams); decon.Execute(results); Exporter <ResultCollection> exporter = new BasicIsosExporter(exporterTest1OutputName); exporter.Export(results); }
public void deconvoluteXCalibur_MS_DataTest1() //good ms data... expect to find isotopic profiles... { Run run = new XCaliburRun(xcaliburTestfile); run.MSParameters = new DeconTools.Backend.Parameters.MSParameters(); run.CurrentScanSet = new ScanSet(6067); ResultCollection rc = new ResultCollection(run); Task msGen = new GenericMSGenerator(); msGen.Execute(rc); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; Task peakdetector = new DeconToolsPeakDetector(detectorParams); peakdetector.Execute(rc); Task rapid = new RapidDeconvolutor(); rapid.Execute(rc); Assert.AreEqual(95, rc.ResultList.Count); }
public void criticalErrorInPeakDetectorTest1() { UIMFRun run = new DeconTools.Backend.Runs.UIMFRun(fpgaUIMFFilePath2); FrameSetCollectionCreator ffcc = new FrameSetCollectionCreator(run, 425, 432, 3, 1); ffcc.Create(); ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 1, 500, 9, 1); sscc.Create(); MSGeneratorFactory factory = new MSGeneratorFactory(); Task msgen = factory.CreateMSGenerator(run.MSFileType); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(); peakDet.PeakBackgroundRatio = 4; peakDet.SigNoiseThreshold = 3; foreach (var frame in run.FrameSetCollection.FrameSetList) { run.CurrentFrameSet = frame; foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); } } }
public void exportAllPeaksInXCaliburFile() { if (File.Exists(xcaliburAllPeaksFileName)) { File.Delete(xcaliburAllPeaksFileName); } Run run = new XCaliburRun(xcaliburTestfile); ScanSetCollectionCreator scansetCreator = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, 1, 1, false); scansetCreator.Create(); Task msgen = new GenericMSGenerator(); DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 1.3, true, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC); Task peakDetector = new DeconToolsPeakDetector(peakParams); ((DeconToolsPeakDetector)peakDetector).StorePeakData = true; Task exporter = new DeconTools.Backend.ProcessingTasks.PeakListExporters.PeakListTextExporter(run.MSFileType, 1000000, xcaliburAllPeaksFileName); //trigger of 1E5 = 310 sec (memory = 150 MB); trigger of 1E6 = 231 Sec (memory = 250 MB); foreach (ScanSet scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); exporter.Execute(run.ResultCollection); } exporter.Cleanup(); Assert.AreEqual(true, File.Exists(xcaliburAllPeaksFileName)); }
public void uimfTest1() { UIMFRun run = new UIMFRun(uimfFile1); MSGeneratorFactory msgenFactory = new MSGeneratorFactory(); Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType); Task peakDetector = new DeconToolsPeakDetector(); Task decon = new HornDeconvolutor(); Task suspPeakFlagger = new LeftOfMonoPeakLooker(); run.CurrentFrameSet = new FrameSet(501, 500, 502); run.CurrentScanSet = new ScanSet(250, 246, 254); msgen.Execute(run.ResultCollection); peakDetector.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); foreach (var result in run.ResultCollection.ResultList) { ((LeftOfMonoPeakLooker)suspPeakFlagger).CurrentResult = result; suspPeakFlagger.Execute(run.ResultCollection); } Assert.AreEqual(38, run.ResultCollection.ResultList.Count); List <IsosResult> flaggedResults = run.ResultCollection.ResultList.Where(p => p.Flags.Count > 0).ToList(); Assert.AreEqual(13, flaggedResults.Count); TestUtilities.DisplayIsotopicProfileData(flaggedResults[0].IsotopicProfile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(flaggedResults[1].IsotopicProfile); }
public void peakDetectionOnXCaliburTest2_effectOfThresholdingOnPeakDetector() { Run run = new XCaliburRun(xcaliburTestfile); ResultCollection results = new ResultCollection(run); run.CurrentScanSet = new ScanSet(4003); Task msgen = new GenericMSGenerator(0, 2000); msgen.Execute(results); run.IsDataThresholded = true; //fyi... by default, xcalibur runs are set to be true Task peakDetector = new DeconToolsPeakDetector(); ((DeconToolsPeakDetector)(peakDetector)).PeakBackgroundRatio = 1.3; ((DeconToolsPeakDetector)(peakDetector)).PeakFitType = Globals.PeakFitType.QUADRATIC; ((DeconToolsPeakDetector)(peakDetector)).SigNoiseThreshold = 2; peakDetector.Execute(results); Assert.AreEqual(646, results.Run.PeakList.Count); run.IsDataThresholded = false; peakDetector = new DeconToolsPeakDetector(); ((DeconToolsPeakDetector)(peakDetector)).PeakBackgroundRatio = 1.3; ((DeconToolsPeakDetector)(peakDetector)).PeakFitType = Globals.PeakFitType.QUADRATIC; ((DeconToolsPeakDetector)(peakDetector)).SigNoiseThreshold = 2; peakDetector.Execute(results); Assert.AreEqual(636, results.Run.PeakList.Count); }
public void peakDetectionOnXCaliburTest1() { Run run = new XCaliburRun(xcaliburTestfile, 6000, 7000); ScanSetCollection scansetCollection = new ScanSetCollection(); for (int i = 6000; i < 6015; i++) { scansetCollection.ScanSetList.Add(new ScanSet(i)); } ResultCollection results = new ResultCollection(run); foreach (ScanSet scanset in scansetCollection.ScanSetList) { run.CurrentScanSet = scanset; Task msgen = new GenericMSGenerator(); msgen.Execute(results); Task peakDetector = new DeconToolsPeakDetector(); peakDetector.Execute(results); Task scanResultUpdater = new ScanResultUpdater(); scanResultUpdater.Execute(results); } Assert.AreEqual(2, results.ScanResultList.Count); }
public MercuryDistributionCreator() { avergineFormulaCreator = new DeconToolsV2.HornTransform.clsAveragine(); hornParameters = new DeconToolsV2.HornTransform.clsHornTransformParameters(); decon2LSMercuryDistribution = new DeconToolsV2.clsMercuryIsotopeDistribution(); peakDetector = new DeconToolsPeakDetector(); }
public void serializeUIMFDataTest1() { Run run = new UIMFRun(uimfFilepath2); List <Run> runCollection = new List <Run>(); runCollection.Add(run); int startFrame = 1200; int stopFrame = 1205; int numFramesSummed = 3; int numScansSummed = 3; FrameSetCollectionCreator framesetCreator = new FrameSetCollectionCreator(run, startFrame, stopFrame, numFramesSummed, 1); framesetCreator.Create(); ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(run, numScansSummed, 1); scanSetCreator.Create(); Task msgen = new UIMF_MSGenerator(); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = true; Task peakdetector = new DeconToolsPeakDetector(detectorParams); Task decon = new RapidDeconvolutor(); TaskCollection taskcollection = new TaskCollection(); taskcollection.TaskList.Add(msgen); taskcollection.TaskList.Add(peakdetector); taskcollection.TaskList.Add(decon); TaskController taskcontroller = new UIMF_TaskController(taskcollection); taskcontroller.IsosResultThresholdNum = 50; taskcontroller.Execute(runCollection); ResultCollection results; IsosResultDeSerializer deserializer = new IsosResultDeSerializer(run.Filename + "_tmp.bin"); int counter = 0; do { counter++; results = deserializer.GetNextSetOfResults(); } while (results != null); Assert.AreEqual(8, counter); }
public void fitterOnHornDataTest1() { Run run = new XCaliburRun(xcaliburTestfile); ResultCollection results = new ResultCollection(run); run.CurrentScanSet = new ScanSet(6067); Task msGen = new GenericMSGenerator(1154, 1158); msGen.Execute(results); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 0.5; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(results); DeconToolsV2.HornTransform.clsHornTransformParameters hornParameters = new DeconToolsV2.HornTransform.clsHornTransformParameters(); hornParameters.PeptideMinBackgroundRatio = 2; Task decon = new HornDeconvolutor(hornParameters); decon.Execute(results); IsosResult result1 = results.ResultList[0]; MercuryDistributionCreator distcreator = new MercuryDistributionCreator(); double resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM(); distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution); distcreator.OffsetDistribution(result1.IsotopicProfile); XYData theorXYData = distcreator.Data; StringBuilder sb = new StringBuilder(); TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues); Console.WriteLine(sb.ToString()); AreaFitter areafitter = new AreaFitter(theorXYData, run.XYData, 10); double fitval = areafitter.getFit(); Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval); Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score); Assert.AreEqual(0.0209385414928986, (decimal)fitval); //TODO: fix this test... i'm getting 0.0207350903681061m }
public void turnRAPIDScoreIntoHornScoreAndCompareTest1() { Run run = new XCaliburRun(xcaliburTestfile, 6000, 6050); int numScansSummed = 1; ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, numScansSummed, 1, false); scanSetCreator.Create(); Task msgen = new GenericMSGenerator(); DeconToolsV2.Peaks.clsPeakProcessorParameters detParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detParams.PeakBackgroundRatio = 3; detParams.SignalToNoiseThreshold = 3; Task peakDet = new DeconToolsPeakDetector(detParams); Task rapid = new RapidDeconvolutor(); Task horn = new HornDeconvolutor(); Task fitcalc = new DeconToolsFitScoreCalculator(); run.CurrentScanSet = run.ScanSetCollection.GetScanSet(6005); msgen.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); horn.Execute(run.ResultCollection); //string isosData = reportIsotopicProfiles(run); //Console.Write(isosData); //First evaluate HornTransform score Assert.AreEqual(481.274105402604, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.GetMZ()); Assert.AreEqual(0.0101245114907111, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.Score); run.ResultCollection.ClearAllResults(); horn.Execute(run.ResultCollection); fitcalc.Execute(run.ResultCollection); Assert.AreEqual(0.00583991502104572, (decimal)run.ResultCollection.ResultList[0].IsotopicProfile.Score); run.ResultCollection.ClearAllResults(); //Run RAPID and evaluate the score Rapid gives it rapid.Execute(run.ResultCollection); Assert.AreEqual(481.274105402604, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.GetMZ()); Assert.AreEqual(1.52062147024669, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score); //Run the DeconToolsFitScoreCalculator fitcalc.Execute(run.ResultCollection); //Evaluate the score given by the fitscore calculator Assert.AreNotEqual(1.52062147024669, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score); Assert.AreEqual(0.00583991502104572m, (decimal)run.ResultCollection.ResultList[7].IsotopicProfile.Score); }
public void simpleAddTest1() { //first deconvolute with THRASH //then deconvolute with RAPID, using comboMode = 'simplyAddIt' //so there will be duplicate results Project.Reset(); Run run = new XCaliburRun(xcaliburTestfile, 6000, 6050); Project.getInstance().RunCollection.Add(run); ResultCollection results = new ResultCollection(run); TaskCollection taskCollection = new TaskCollection(); ScanSetCollectionCreator scansetCreator = new ScanSetCollectionCreator(run, run.MinScan, run.MaxScan, 1, 1, false); scansetCreator.Create(); Task msgen = new GenericMSGenerator(); DeconToolsV2.Peaks.clsPeakProcessorParameters peakDetParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); peakDetParams.SignalToNoiseThreshold = 3; peakDetParams.PeakBackgroundRatio = 0.5; Task peakDetector = new DeconToolsPeakDetector(peakDetParams); Task thrashDecon = new HornDeconvolutor(); Task rapidDecon = new RapidDeconvolutor(); taskCollection.TaskList.Add(msgen); taskCollection.TaskList.Add(peakDetector); taskCollection.TaskList.Add(thrashDecon); TaskController taskcontroller = new BasicTaskController(taskCollection); taskcontroller.Execute(Project.getInstance().RunCollection); Assert.AreEqual(644, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count); taskCollection.TaskList.Remove(thrashDecon); taskCollection.TaskList.Add(rapidDecon); Project.getInstance().RunCollection[0].ResultCollection.ResultList.Clear(); taskcontroller.Execute(Project.getInstance().RunCollection); Assert.AreEqual(2472, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count); Project.getInstance().RunCollection[0].ResultCollection.ResultList.Clear(); taskCollection.TaskList.Remove(rapidDecon); taskCollection.TaskList.Add(thrashDecon); taskCollection.TaskList.Add(rapidDecon); taskcontroller.Execute(Project.getInstance().RunCollection); Assert.AreEqual(2472 + 644, Project.getInstance().RunCollection[0].ResultCollection.ResultList.Count); }
public void uimf_data_preLoaded() // in this case, data is preloaded, preventing re-accessing the same drifttimes over and over { Run run = new UIMFRun(uimfFilepath); FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, 800, 801, 3, 1); fscc.Create(); ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 220, 270, 9, 1); sscc.Create(); ((UIMFRun)run).GetFrameDataAllFrameSets(); // this is the key line... loads data necessary for drift time calc and correction UIMF_MSGenerator msgen = new UIMF_MSGenerator(); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(); peakDet.PeakBackgroundRatio = 6; peakDet.SigNoiseThreshold = 3; HornDeconvolutor decon = new HornDeconvolutor(); UIMFDriftTimeExtractor driftTimeExtractor = new UIMFDriftTimeExtractor(); StringBuilder sb = new StringBuilder(); foreach (var frame in ((UIMFRun)run).FrameSetCollection.FrameSetList) { ((UIMFRun)run).CurrentFrameSet = frame; foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); driftTimeExtractor.Execute(run.ResultCollection); } } foreach (var item in run.ResultCollection.ResultList) { UIMFIsosResult isosresult = (UIMFIsosResult)item; sb.Append(isosresult.FrameSet.PrimaryFrame); sb.Append("\t"); sb.Append(isosresult.ScanSet.PrimaryScanNumber); sb.Append("\t"); sb.Append(isosresult.IsotopicProfile.MonoPeakMZ.ToString("0.000")); sb.Append("\t"); sb.Append(isosresult.DriftTime.ToString("0.000")); sb.Append(Environment.NewLine); } Console.Write(sb.ToString()); }
public void fitterOnHornDataTest2() { Run run = new XCaliburRun(xcaliburTestfile); ResultCollection results = new ResultCollection(run); run.CurrentScanSet = new ScanSet(6005); Task msGen = new GenericMSGenerator(579, 582); msGen.Execute(results); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 0.5; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(results); Task decon = new HornDeconvolutor(); decon.Execute(results); IsosResult result1 = results.ResultList[1]; double resolution = result1.IsotopicProfile.GetMZofMostAbundantPeak() / result1.IsotopicProfile.GetFWHM(); MercuryDistributionCreator distcreator = new MercuryDistributionCreator(); distcreator.CreateDistribution(result1.IsotopicProfile.MonoIsotopicMass, result1.IsotopicProfile.ChargeState, resolution); StringBuilder sb = new StringBuilder(); XYData theorXYData = distcreator.Data; //TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues); distcreator.OffsetDistribution(result1.IsotopicProfile); TestUtilities.GetXYValuesToStringBuilder(sb, theorXYData.Xvalues, theorXYData.Yvalues); Console.WriteLine(sb.ToString()); AreaFitter areafitter = new AreaFitter(theorXYData, run.XYData, 10); double fitval = areafitter.getFit(); Console.WriteLine(result1.IsotopicProfile.Score + "\t" + fitval); Console.WriteLine((result1.IsotopicProfile.Score - fitval) / result1.IsotopicProfile.Score * 100); Assert.AreEqual(0.0704215577242672, (decimal)fitval); }
public void checkIntegrityOfUIMF_RawDataTest1() { UIMFRun run = new DeconTools.Backend.Runs.UIMFRun(fpgaUIMFFilePath2); FrameSetCollectionCreator ffcc = new FrameSetCollectionCreator(run, 696, 696, 3, 1); ffcc.Create(); ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 350, 500, 9, 1); sscc.Create(); MSGeneratorFactory factory = new MSGeneratorFactory(); Task msgen = factory.CreateMSGenerator(run.MSFileType); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(); peakDet.PeakBackgroundRatio = 6; peakDet.SigNoiseThreshold = 3; StringBuilder sb = new StringBuilder(); sb.Append("frame\tscan\tmaxIntens\tnumZeros\n"); foreach (var frame in run.FrameSetCollection.FrameSetList) { run.CurrentFrameSet = frame; foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); List <int> indices = getIndicesOf0MZValues(run.XYData.Xvalues); double maxY = run.XYData.GetMaxY(); if (indices.Count > -1) { sb.Append(frame.PrimaryFrame); sb.Append("\t"); sb.Append(scan.PrimaryScanNumber); sb.Append("\t"); sb.Append(maxY); sb.Append("\t"); sb.Append(indices.Count); sb.Append("\n"); } } } Console.WriteLine(sb.ToString()); }
public void xcaliburSpeed_RAPID_Test1() { Run run = new XCaliburRun(xcaliburTestfile); int startScan = 6005; int stopScan = 7000; int numScansSummed = 1; ScanSetCollectionCreator scanSetCreator = new ScanSetCollectionCreator(run, startScan, stopScan, numScansSummed, 1); scanSetCreator.Create(); ResultCollection results = new ResultCollection(run); List <timingResult> timingResults = new List <timingResult>(); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); foreach (ScanSet scanset in run.ScanSetCollection.ScanSetList) { if (results.Run.GetMSLevel(scanset.PrimaryScanNumber) != 1) { continue; } sw.Reset(); timingResult timeresult = new timingResult(); timeresult.frameNum = -1; timeresult.scanNum = scanset.PrimaryScanNumber; sw.Start(); run.CurrentScanSet = scanset; Task msgen = new GenericMSGenerator(); msgen.Execute(results); timeresult.msGenTime = sw.ElapsedMilliseconds; sw.Reset(); sw.Start(); Task peakDetector = new DeconToolsPeakDetector(); peakDetector.Execute(results); timeresult.peakDetectorTime = sw.ElapsedMilliseconds; sw.Reset(); sw.Start(); Task rapid = new RapidDeconvolutor(); rapid.Execute(results); timeresult.deconTime = sw.ElapsedMilliseconds; sw.Reset(); sw.Start(); Task scanResultUpdater = new ScanResultUpdater(); scanResultUpdater.Execute(results); timeresult.resultUpdaterTime = sw.ElapsedMilliseconds; timingResults.Add(timeresult); } reportTimingEachScan(timingResults); }
public void uimf_data_not_preLoaded() // in this case the drift time is calculated every time by looking up sqlite data from uimf file { Run run = new UIMFRun(uimfFilepath); FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, 800, 801, 3, 1); fscc.Create(); ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 220, 270, 9, 1); sscc.Create(); UIMF_MSGenerator msgen = new UIMF_MSGenerator(); DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(); peakDet.PeakBackgroundRatio = 6; peakDet.SigNoiseThreshold = 3; HornDeconvolutor decon = new HornDeconvolutor(); UIMFDriftTimeExtractor driftTimeExtractor = new UIMFDriftTimeExtractor(); StringBuilder sb = new StringBuilder(); foreach (var frame in ((UIMFRun)run).FrameSetCollection.FrameSetList) { ((UIMFRun)run).CurrentFrameSet = frame; foreach (var scan in run.ScanSetCollection.ScanSetList) { run.CurrentScanSet = scan; msgen.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); decon.Execute(run.ResultCollection); driftTimeExtractor.Execute(run.ResultCollection); } } foreach (var item in run.ResultCollection.ResultList) { UIMFIsosResult isosresult = (UIMFIsosResult)item; sb.Append(isosresult.FrameSet.PrimaryFrame); sb.Append("\t"); sb.Append(isosresult.ScanSet.PrimaryScanNumber); sb.Append("\t"); sb.Append(isosresult.IsotopicProfile.MonoPeakMZ.ToString("0.000")); sb.Append("\t"); sb.Append(isosresult.DriftTime.ToString("0.000")); sb.Append(Environment.NewLine); } Console.Write(sb.ToString()); }
public void test1() { Run run = new XCaliburRun(xcaliburTestfile); List <MassTag> mass_tagList = TestUtilities.CreateTestMassTagList(); MassTag mt = mass_tagList[0]; run.CurrentScanSet = new ScanSet(9017, new int[] { 9010, 9017, 9024 }); run.CurrentMassTag = mt; MSGeneratorFactory msgenFactory = new MSGeneratorFactory(); Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType); DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 1.3, true, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC); Task mspeakDet = new DeconToolsPeakDetector(peakParams); Task theorFeatureGen = new TomTheorFeatureGenerator(); Task targetedFeatureFinder = new BasicTFF(0.01); IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator(); msgen.Execute(run.ResultCollection); //run.XYData.Display(); mspeakDet.Execute(run.ResultCollection); theorFeatureGen.Execute(run.ResultCollection); targetedFeatureFinder.Execute(run.ResultCollection); fitScoreCalc.Execute(run.ResultCollection); MassTagResultBase result = run.ResultCollection.GetMassTagResult(mt); TestUtilities.DisplayIsotopicProfileData(result.IsotopicProfile); Console.WriteLine("Fit val = " + result.IsotopicProfile.Score); /* * * * ------------------- MassTag = 24769--------------------------- * monoMass = 2086.0595; monoMZ = 1044.0370; ChargeState = 2; NET = 0.452; Sequence = DFNEALVHQVVVAYAANAR * ****** Match ****** ******NET = 0.452 ******ChromPeak ScanNum = 9016.48992535631 ******ChromPeak NETVal = 0.453 ******ScanSet = { 9010, 9017, 9024, } ******Observed MZ and intensity = 1044.03290771556 1.269842E+07 ******------------------------------ end -------------------------- * * * * * */ }
public void examineIMFFile_Scan233MZ630() { Run run = new IMFRun(imfFilepath); run.MSParameters = new DeconTools.Backend.Parameters.MSParameters(); run.CurrentScanSet = new ScanSet(233, 229, 237); run.MSParameters.MinMZ = 100; run.MSParameters.MaxMZ = 631.5; int numPeaks = 0; for (double n = 629; n < 630; n = n + 0.01) { ResultCollection rc = new ResultCollection(run); Task msGen = new GenericMSGenerator(n, run.MSParameters.MaxMZ); msGen.Execute(rc); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task zeroFiller = new DeconToolsZeroFiller(3); //zeroFiller.Execute(rc); Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(rc); Task decon = new RapidDeconvolutor(); decon.Execute(rc); StringBuilder sb = new StringBuilder(); for (int i = 0; i < rc.ResultList.Count; i++) { IsosResult result = rc.ResultList[i]; if (result.IsotopicProfile.Peaklist[0].XValue > 629 && result.IsotopicProfile.Peaklist[0].XValue < 631) { sb.Append(n.ToString("0.00")); sb.Append("\t"); sb.Append(result.IsotopicProfile.Peaklist[0].XValue.ToString("0.00")); sb.Append("\t"); sb.Append(result.IsotopicProfile.Score.ToString("0.00")); sb.Append("\t"); sb.Append(result.Run.PeakList.Count); sb.Append("\t"); sb.Append(result.Run.XYData.Xvalues.Length); sb.Append("\n"); } } Console.Write(sb.ToString()); } }
public void test1() { Run run = new MSScanFromTextFileRun(imfMSScanTextfile); ResultCollection resultcollection = new ResultCollection(run); Task msgen = new GenericMSGenerator(); msgen.Execute(resultcollection); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task peakdetector = new DeconToolsPeakDetector(detectorParams); peakdetector.Execute(resultcollection); Task rapidDecon = new RapidDeconvolutor(); rapidDecon.Execute(resultcollection); int counter = 0; foreach (StandardIsosResult result in resultcollection.ResultList) { IsotopicProfile profile = result.IsotopicProfile; Console.Write("------------ profile" + counter + "; Charge state = " + profile.ChargeState + "; Score= " + profile.Score.ToString("0.00") + " ----------------\n"); int peakcounter = 0; Console.Write("idx" + "\t" + "mz" + "\t" + "intensity" + "\t" + "SN" + "\t" + "FWHM" + "\n"); foreach (MSPeak peak in profile.Peaklist) { Console.Write(peakcounter + "\t" + peak.XValue + "\t" + peak.Height + "\t" + peak.SN + "\t" + peak.Width + "\n"); peakcounter++; } counter++; } Assert.AreEqual(9, resultcollection.ResultList.Count); Assert.AreEqual(582.820684517665, Convert.ToDecimal(resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].XValue)); Assert.AreEqual(2984.0, resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].Height); Assert.AreEqual(0.05905123, (decimal)resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].Width); Assert.AreEqual(157.0526, (decimal)resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].SN); Assert.AreEqual(4593, resultcollection.ResultList[0].IsotopicProfile.GetAbundance()); Assert.AreEqual(1, resultcollection.ResultList[8].IsotopicProfile.GetNumOfIsotopesInProfile()); Assert.AreEqual(2488.07303881522, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.AverageMass)); Assert.AreEqual(3, resultcollection.ResultList[8].IsotopicProfile.ChargeState); Assert.AreEqual(18802, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.IntensityAggregate)); Assert.AreEqual(2486.09777364184, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.MonoIsotopicMass)); }
public void ExportMultipleScansTest1() { Run run = new IMFRun(imfFilepath); ScanSetCollection scanSetCollection = new ScanSetCollection(); scanSetCollection.ScanSetList.Add(new ScanSet(232)); scanSetCollection.ScanSetList.Add(new ScanSet(233)); scanSetCollection.ScanSetList.Add(new ScanSet(234)); ResultCollection results = new ResultCollection(run); foreach (ScanSet scanset in scanSetCollection.ScanSetList) { run.CurrentScanSet = scanset; Task msGen = new GenericMSGenerator(); msGen.Execute(results); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(results); Task decon = new RapidDeconvolutor(); decon.Execute(results); Task scanResultUpdater = new ScanResultUpdater(); scanResultUpdater.Execute(results); } Assert.AreEqual(3, results.ScanResultList.Count); Assert.AreEqual(92, results.ScanResultList[0].NumPeaks); Assert.AreEqual(82, results.ScanResultList[1].NumPeaks); Assert.AreEqual(72, results.ScanResultList[2].NumPeaks); Assert.AreEqual(11, results.ScanResultList[0].NumIsotopicProfiles); Assert.AreEqual(9, results.ScanResultList[1].NumIsotopicProfiles); Assert.AreEqual(9, results.ScanResultList[2].NumIsotopicProfiles); Assert.AreEqual(830.045752112968, (Decimal)results.ScanResultList[0].BasePeak.XValue); Assert.AreEqual(10438, results.ScanResultList[0].BasePeak.Height); Assert.AreEqual(0.09454554, (Decimal)results.ScanResultList[0].BasePeak.Width); Assert.AreEqual(434.9167, (Decimal)results.ScanResultList[0].BasePeak.SN); Exporter <ResultCollection> exporter = new BasicScansExporter(scansExporterTest1output); exporter.Export(results); }
public void test1_summing() { Project.Reset(); Project project = Project.getInstance(); UIMFRun run = new UIMFRun(uimfFilepath, 1201, 1201); project.RunCollection.Add(run); int numFramesSummed = 3; int numScansSummed = 3; ScanSetCollectionCreator sscc = new ScanSetCollectionCreator(run, 250, 270, numScansSummed, 1); sscc.Create(); FrameSetCollectionCreator fscc = new FrameSetCollectionCreator(run, run.MinFrame, run.MaxFrame, numFramesSummed, 1); fscc.Create(); Task msGen = new UIMF_MSGenerator(200, 2000); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; Task peakDetector = new DeconToolsPeakDetector(detectorParams); Task decon = new HornDeconvolutor(); Task scanResultsUpdater = new ScanResultUpdater(); Task originalIntensitiesExtractor = new OriginalIntensitiesExtractor(); project.TaskCollection.TaskList.Add(msGen); project.TaskCollection.TaskList.Add(peakDetector); project.TaskCollection.TaskList.Add(decon); project.TaskCollection.TaskList.Add(scanResultsUpdater); project.TaskCollection.TaskList.Add(originalIntensitiesExtractor); TaskController controller = new UIMF_TaskController(project.TaskCollection); controller.Execute(project.RunCollection); ResultCollection rc = project.RunCollection[0].ResultCollection; Assert.AreEqual(180, rc.ResultList.Count); StringBuilder sb = new StringBuilder(); IsosResultUtilities.DisplayResults(sb, rc.ResultList); Console.Write(sb.ToString()); }
public void examineRAWFile_Scan6757() { Run run = new XCaliburRun(xcaliburTestfile); run.MSParameters = new DeconTools.Backend.Parameters.MSParameters(); run.CurrentScanSet = new ScanSet(6757); run.MSParameters.MinMZ = 0; run.MSParameters.MaxMZ = 10000; ResultCollection rc = new ResultCollection(run); Task msGen = new GenericMSGenerator(run.MSParameters.MinMZ, run.MSParameters.MaxMZ); msGen.Execute(rc); DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(); detectorParams.PeakBackgroundRatio = 3; detectorParams.PeakFitType = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC; detectorParams.SignalToNoiseThreshold = 3; detectorParams.ThresholdedData = false; Task zeroFiller = new DeconToolsZeroFiller(3); //zeroFiller.Execute(rc); Task peakDetector = new DeconToolsPeakDetector(detectorParams); peakDetector.Execute(rc); Task decon = new RapidDeconvolutor(); decon.Execute(rc); StringBuilder sb = new StringBuilder(); for (int i = 0; i < rc.ResultList.Count; i++) { IsosResult result = rc.ResultList[i]; if (result.IsotopicProfile.Peaklist[0].XValue > 0 && result.IsotopicProfile.Peaklist[0].XValue < 10000) { sb.Append(result.IsotopicProfile.Peaklist[0].XValue.ToString("0.00")); sb.Append("\t"); sb.Append(result.IsotopicProfile.Score.ToString("0.00")); sb.Append("\t"); sb.Append(result.IsotopicProfile.Peaklist[0].SN.ToString("0.0")); sb.Append("\t"); sb.Append(result.Run.PeakList.Count); sb.Append("\t"); sb.Append(result.Run.XYData.Xvalues.Length); sb.Append("\n"); } } Console.Write(sb.ToString()); }