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 test1() { Run run = new XCaliburRun(xcaliburTestfile); MassTag mt = TestUtilities.GetMassTagStandard(1); PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburPeakDataFile); peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList); run.CurrentMassTag = mt; Task theorFeatureGen = new TomTheorFeatureGenerator(); theorFeatureGen.Execute(run.ResultCollection); int numPeaksForExtractingChrom = 3; int toleranceInPPM = 25; IsotopicProfileMultiChromatogramExtractor multiChromExtractor = new IsotopicProfileMultiChromatogramExtractor( numPeaksForExtractingChrom, toleranceInPPM); List <int> ms1Levels = run.GetMSLevelScanValues(); Dictionary <MSPeak, XYData> chromDataForIsotopicProfile = multiChromExtractor.GetChromatogramsForIsotopicProfilePeaks(run.ResultCollection.MSPeakResultList, run.CurrentMassTag.IsotopicProfile, true, ms1Levels); multiChromExtractor.SmoothChromatograms(chromDataForIsotopicProfile, new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2)); XYData xydata1 = chromDataForIsotopicProfile.Values.First(); XYData xydata2 = chromDataForIsotopicProfile.Values.ElementAt(1); XYData xydata3 = chromDataForIsotopicProfile.Values.ElementAt(2); TestUtilities.DisplayXYValues(xydata3); }
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 getPeakChromatogramTest2() { var mt = TestUtilities.GetMassTagStandard(1); Run run = new XCaliburRun2(FileRefs.RawDataMSFiles.OrbitrapStdFile1); var peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500); peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList); run.CurrentMassTag = mt; var unlabelledTheorGenerator = new TomTheorFeatureGenerator(); unlabelledTheorGenerator.GenerateTheorFeature(mt); var peakChromGen = new PeakChromatogramGenerator(10, Globals.ChromatogramGeneratorMode.TOP_N_PEAKS); peakChromGen.TopNPeaksLowerCutOff = 0.4; peakChromGen.Execute(run.ResultCollection); Assert.AreEqual(133, run.XYData.Xvalues.Length); Assert.AreEqual(5543, (int)run.XYData.Xvalues[35]); //Assert.AreEqual(7319569, (int)run.XYData.Yvalues[35]); run.XYData.Display(); }
public void getTheorIsotopicProfileXYDataTest1() { MassTag mt = new MassTag(); mt.ID = 56488; mt.MonoIsotopicMass = 2275.1694779; mt.PeptideSequence = "TTPSIIAYTDDETIVGQPAKR"; mt.NETVal = 0.3520239f; mt.CreatePeptideObject(); mt.ChargeState = 2; Run run = new XCaliburRun(); ResultCollection rc = new ResultCollection(run); rc.Run.CurrentMassTag = mt; Task theorGen = new TomTheorFeatureGenerator(); theorGen.Execute(rc); mt.CalculateMassesForIsotopicProfile(mt.ChargeState); TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfile); XYData xydata = TheorXYDataCalculationUtilities.Get_Theoretical_IsotopicProfileXYData(mt.IsotopicProfile, 0.02); TestUtilities.DisplayXYValues(xydata); }
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 TomGenerateTheorProfileTest1() { var mt = TestDataCreationUtilities.CreateN14N15TestMassTagList().First(p => p.ID == 23085473); var theorGenerator = new TomTheorFeatureGenerator(); theorGenerator.GenerateTheorFeature(mt); TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfile); //TODO: add an Assert, with a manually confirmed number. }
public void n14N15LabelledData_TFFTest1() { double featureFinderTol = 15; var featureFinderRequiresMonoPeak = false; var n14n15Util = new N14N15TestingUtilities(); //get sample MS from Test Data var massSpectrum = n14n15Util.GetSpectrumAMTTag23140708_Z3_Sum3(); //this is the diff b/w previous test and this one var mt23140708 = n14n15Util.CreateMT23140708_Z3(); //get ms peaks var peakDet = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, false); var msPeakList = peakDet.FindPeaks(massSpectrum, 0, 0); //TestUtilities.DisplayPeaks(msPeakList); //generate theor unlabelled profile var unlabelledfeatureGen = new TomTheorFeatureGenerator(); unlabelledfeatureGen.GenerateTheorFeature(mt23140708); //generate theor N15-labelled profile var n15featureGen = new TomTheorFeatureGenerator(Globals.LabellingType.N15, 0.005); n15featureGen.GenerateTheorFeature(mt23140708); //find features in experimental data, using the theoretical profiles var msfeatureFinder = new BasicTFF(); msfeatureFinder.ToleranceInPPM = featureFinderTol; msfeatureFinder.NeedMonoIsotopicPeak = featureFinderRequiresMonoPeak; var n14profile = msfeatureFinder.FindMSFeature(msPeakList, mt23140708.IsotopicProfile); var n15profile = msfeatureFinder.FindMSFeature(msPeakList, mt23140708.IsotopicProfileLabelled); Console.WriteLine(mt23140708.GetEmpiricalFormulaFromTargetCode()); TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfileLabelled); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(n14profile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(n15profile); }
public void getVeryLowN15ProfileWithIterativeTFFTest1() { var n14n15Util = new N14N15TestingUtilities(); //get sample MS from Test Data var rf = new RunFactory(); var run = rf.CreateRun(N14N15TestingUtilities.MS_AMTTag23085904_z2_sum1_lowN15); run.XYData = N14N15TestingUtilities.GetTestSpectrum(N14N15TestingUtilities.MS_AMTTag23085904_z2_sum1_lowN15); var mt23140708 = n14n15Util.CreateMT23085904_Z2(); run.CurrentMassTag = mt23140708; run.ResultCollection.ResultType = Globals.ResultType.N14N15_TARGETED_RESULT; var theorN14FeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005); theorN14FeatureGen.GenerateTheorFeature(mt23140708); var theorN15FeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.N15, 0.005); theorN15FeatureGen.GenerateTheorFeature(mt23140708); var parameters = new IterativeTFFParameters(); parameters.IsotopicProfileType = Globals.IsotopicProfileType.LABELLED; parameters.ToleranceInPPM = 30; var itff = new IterativeTFF(parameters); itff.Execute(run.ResultCollection); // IsotopicProfile iso = itff.iterativelyFindMSFeature(run, mt23140708.IsotopicProfileLabelled); var result = (N14N15_TResult)run.ResultCollection.GetTargetedResult(run.CurrentMassTag); Assert.IsNotNull(result.IsotopicProfileLabeled); Assert.AreEqual(82280, (int)result.IntensityAggregate); Assert.AreEqual(3, result.IsotopicProfileLabeled.MonoIsotopicPeakIndex); TestUtilities.DisplayIsotopicProfileData(result.IsotopicProfileLabeled); }
public void TomGenerateN15LabelledTheorProfileTest1() { var mt = TestDataCreationUtilities.CreateN14N15TestMassTagList().First(p => p.ID == 23085473); var unlabelledTheorGenerator = new TomTheorFeatureGenerator(); unlabelledTheorGenerator.GenerateTheorFeature(mt); var n15theorGenerator = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.N15, 0.005); n15theorGenerator.GenerateTheorFeature(mt); TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfileLabelled); //TODO: add an Assert, with a manually confirmed number. }
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(); Task exporter = new BasicMTResultSQLiteExporter(exporterOutputFile1); msgen.Execute(run.ResultCollection); //run.XYData.Display(); mspeakDet.Execute(run.ResultCollection); theorFeatureGen.Execute(run.ResultCollection); targetedFeatureFinder.Execute(run.ResultCollection); fitScoreCalc.Execute(run.ResultCollection); exporter.Execute(run.ResultCollection); exporter.Cleanup(); MassTagResultBase result = run.ResultCollection.GetMassTagResult(mt); TestUtilities.DisplayIsotopicProfileData(result.IsotopicProfile); }
public void TomGenerateN15LabelledTheorProfileTest2() { var mt = TestDataCreationUtilities.CreateN14N15TestMassTagList().First(p => p.ID == 23085470); mt.EmpiricalFormula = mt.GetEmpiricalFormulaFromTargetCode(); Console.WriteLine("Total nitrogens = " + mt.GetAtomCountForElement("N")); var unlabelledTheorGenerator = new TomTheorFeatureGenerator(); unlabelledTheorGenerator.GenerateTheorFeature(mt); var n15theorGenerator = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.N15, 0.005); n15theorGenerator.GenerateTheorFeature(mt); //TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfile); TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfileLabelled); //TODO: add an Assert, with a manually confirmed number. }
public void test1() { MassTag mt = new MassTag(); mt.ID = 56488; mt.MonoIsotopicMass = 2275.1694779; mt.PeptideSequence = "TTPSIIAYTDDETIVGQPAKR"; mt.NETVal = 0.3520239f; mt.CreatePeptideObject(); mt.ChargeState = 2; Run run = new XCaliburRun(); ResultCollection rc = new ResultCollection(run); rc.Run.CurrentMassTag = mt; Task theorGen = new TomTheorFeatureGenerator(); theorGen.Execute(rc); mt.CalculateMassesForIsotopicProfile(mt.ChargeState); MercuryDistributionCreator distcreator = new MercuryDistributionCreator(); distcreator.CreateDistribution(mt.MonoIsotopicMass, mt.ChargeState, 40000); distcreator.getIsotopicProfile(); TestUtilities.DisplayIsotopicProfileData(mt.IsotopicProfile); //TestUtilities.DisplayIsotopicProfileData(distcreator.IsotopicProfile); Assert.AreEqual(7, mt.IsotopicProfile.Peaklist.Count); Assert.AreEqual(1138.59201544m, (decimal)mt.IsotopicProfile.Peaklist[0].XValue); Assert.AreEqual((1138.59201544m + 1.00235m / 2m), (decimal)mt.IsotopicProfile.Peaklist[1].XValue); }
public void test1() { Run run = new XCaliburRun(xcaliburTestfile); MassTagCollection massTagColl = new MassTagCollection(); MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(cysteineMassTagSourceFile1, '\t'); mtidImporter.Import(massTagColl); MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_Shewanella_ProdTest_P352", "porky"); importer.Import(massTagColl); Assert.AreEqual(737, massTagColl.MassTagIDList.Count); Assert.AreEqual(826, massTagColl.MassTagList.Count); ChromAlignerUsingVIPERInfo chromAligner = new ChromAlignerUsingVIPERInfo(); chromAligner.Execute(run); PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburAllPeaksFile); peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList); Task peakChromGen = new PeakChromatogramGenerator(20); 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, 0.75, true, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC); Task mspeakDet = new DeconToolsPeakDetector(peakParams); Task theorFeatureGen = new TomTheorFeatureGenerator(); Task targetedFeatureFinder = new BasicTFF(6); Task exporter = new BasicMTResultSQLiteExporter(cysteineAnalysisOutput1); IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator(); int successCounter = 0; List <long> timingResults = new List <long>(); foreach (MassTag mt in massTagColl.MassTagList) { run.CurrentMassTag = mt; mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS; Console.WriteLine(); Console.WriteLine(); Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------"); Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NETVal.ToString("0.000") + "; Sequence = " + mt.PeptideSequence + "\n"); Stopwatch sw = new Stopwatch(); sw.Start(); try { peakChromGen.Execute(run.ResultCollection); smoother.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); chromPeakSel.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); mspeakDet.Execute(run.ResultCollection); theorFeatureGen.Execute(run.ResultCollection); targetedFeatureFinder.Execute(run.ResultCollection); fitScoreCalc.Execute(run.ResultCollection); MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[mt]; massTagResult.DisplayToConsole(); Console.WriteLine("------------------------------ end --------------------------"); } catch (Exception ex) { Console.WriteLine("Task failed. Message: " + ex.Message + ex.StackTrace); } sw.Stop(); timingResults.Add(sw.ElapsedMilliseconds); if (mt == massTagColl.MassTagList.Last()) { exporter.Execute(run.ResultCollection); } } exporter.Cleanup(); //List<IMassTagResult> successfulResults = run.ResultCollection.GetSuccessfulMassTagResults(); foreach (long tr in timingResults) { Console.WriteLine(tr); } Console.WriteLine("-------- Analysis time for all MTs = " + timingResults.Sum()); Console.WriteLine("-------- Average time for each MT = " + timingResults.Average()); Console.WriteLine(); }
public void run_fullAnalysisTest1() { Run run = new BrukerRun(rsph_AOnly_28_run1File); MassTagCollection massTagColl = new MassTagCollection(); run.ResultCollection.MassTagResultType = DeconTools.Backend.Globals.MassTagResultType.N14N15_MASSTAG_RESULT; massTagColl.MassTagIDList = fourTestMTs; MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_R_sphaeroides241_P513", "Albert"); importer.chargeStateFilterThreshold = 0.05; importer.Import(massTagColl); Assert.AreEqual(7, massTagColl.MassTagList.Count); ChromAlignerUsingVIPERInfo chromAligner = new ChromAlignerUsingVIPERInfo(); chromAligner.Execute(run); PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(rsph_Aonly_28_run1_scans500_1000_peaks); peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList); Task peakChromGen = new PeakChromatogramGenerator(20); 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(); N14N15TFFTask finder = new N14N15TFFTask(0.01); N14N15QuantifierTask quant = new N14N15QuantifierTask(1); IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator(); List <long> timingResults = new List <long>(); foreach (MassTag mt in massTagColl.MassTagList) { run.CurrentMassTag = mt; mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS; Console.WriteLine(); Console.WriteLine(); Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------"); Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NETVal.ToString("0.000") + "; Sequence = " + mt.PeptideSequence + "\n"); Stopwatch sw = new Stopwatch(); sw.Start(); try { peakChromGen.Execute(run.ResultCollection); smoother.Execute(run.ResultCollection); peakDet.Execute(run.ResultCollection); chromPeakSel.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); mspeakDet.Execute(run.ResultCollection); theorFeatureGen.Execute(run.ResultCollection); finder.Execute(run.ResultCollection); quant.Execute(run.ResultCollection); fitScoreCalc.Execute(run.ResultCollection); MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[mt]; massTagResult.DisplayToConsole(); Console.WriteLine("------------------------------ end --------------------------"); } catch (Exception ex) { Console.WriteLine("Task failed. Message: " + ex.Message + ex.StackTrace); } sw.Stop(); timingResults.Add(sw.ElapsedMilliseconds); } foreach (long tr in timingResults) { Console.WriteLine(tr); } Console.WriteLine("-------- Analysis time for all MTs = " + timingResults.Sum()); Console.WriteLine("-------- Average time for each MT = " + timingResults.Average()); Console.WriteLine(); }
public void test01_mt230140708_z3() { double featureFinderTol = 15; var featureFinderRequiresMonoPeak = false; var numPeaksUsedInQuant = 3; var n14n15Util = new N14N15TestingUtilities(); //get MS var massSpectrum = n14n15Util.GetSpectrumAMTTag23140708_Z3_Sum3(); //this is the diff b/w previous test and this one var smoother = new DeconTools.Backend.ProcessingTasks.Smoothers.SavitzkyGolaySmoother(3, 2); massSpectrum = smoother.Smooth(massSpectrum); //get target MT var mt23140708 = n14n15Util.CreateMT23140708_Z3(); //get ms peaks var peakDet = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, false); var msPeakList = peakDet.FindPeaks(massSpectrum, 0, 0); //TestUtilities.DisplayPeaks(msPeakList); var featureGen = new TomTheorFeatureGenerator(); featureGen.GenerateTheorFeature(mt23140708); TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfile); var featureGen2 = new JoshTheorFeatureGenerator(); featureGen2.GenerateTheorFeature(mt23140708); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfile); var gen = new N15IsotopeProfileGenerator(); var theorN15Profile = gen.GetN15IsotopicProfile(mt23140708, 0.005); var bff = new BasicTFF(featureFinderTol, featureFinderRequiresMonoPeak); var n14Profile = bff.FindMSFeature(msPeakList, mt23140708.IsotopicProfile); var n15Profile = bff.FindMSFeature(msPeakList, theorN15Profile); Console.WriteLine(mt23140708.GetEmpiricalFormulaFromTargetCode()); TestUtilities.DisplayIsotopicProfileData(mt23140708.IsotopicProfile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(theorN15Profile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(n14Profile); Console.WriteLine(); TestUtilities.DisplayIsotopicProfileData(n15Profile); var quant = new BasicN14N15Quantifier(featureFinderTol); double ratioContribIso1; double ratioContribIso2; double ratio; quant.GetRatioBasedOnTopPeaks(n14Profile, n15Profile, mt23140708.IsotopicProfile, theorN15Profile, peakDet.BackgroundIntensity, numPeaksUsedInQuant, out ratio, out ratioContribIso1, out ratioContribIso2); Console.WriteLine("--------------------------------"); Console.WriteLine("Background intensity = " + peakDet.BackgroundIntensity); Console.WriteLine("--------------------------------"); Console.WriteLine("Ratio = " + ratio); Console.WriteLine("Ratio contrib Iso1 = " + ratioContribIso1); Console.WriteLine("Ratio contrib Iso2 = " + ratioContribIso2); Console.WriteLine("--------------------------------"); Assert.AreEqual(1.458267m, (decimal)Math.Round(ratio, 6)); //see 'N14N15Quantification_manualValidation_of_algorithm.xls' for manual validation }
public void smartChromPeakSelectorTest_noSumming() { var run = new RunFactory().CreateRun(xcaliburTestfile); run.Close(); run = new RunFactory().CreateRun(xcaliburTestfile); var massTagColl = new TargetCollection(); var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1); massTagColl = masstagImporter.Import(); var chromAligner = new ChromAlignerUsingVIPERInfo(); chromAligner.Execute(run); var theorFeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005); var chromPeakDet = new ChromPeakDetector(0.5, 1); var smartchromParam = new SmartChromPeakSelectorParameters(); var smartChromPeakSelector = new SmartChromPeakSelector(smartchromParam); var basicChromParam = new ChromPeakSelectorParameters(); var basicChromPeakSelector = new BasicChromPeakSelector(basicChromParam); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var iterativeTff = new IterativeTFF(new IterativeTFFParameters()); var fitscoreCalc = new IsotopicProfileFitScoreCalculator(); var testChromatogramDataFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TargetedWorkflowStandards\massTag635428_chromatogramData.txt"; var xydata = TestUtilities.LoadXYDataFromFile(testChromatogramDataFile); Assert.IsNotNull(xydata); run.XYData = xydata; // run.XYData.Display(); run.CurrentMassTag = massTagColl.TargetList.Where(p => p.ID == 635428).First(); Console.WriteLine("------MT = " + run.CurrentMassTag.ToString()); theorFeatureGen.Execute(run.ResultCollection); chromPeakDet.Execute(run.ResultCollection); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); //first run the standard peak selector basicChromPeakSelector.Execute(run.ResultCollection); Assert.AreEqual(10066, (int)Math.Round(result.ChromPeakSelected.XValue)); //now run the smart chrom peak selector run.XYData = xydata; chromPeakDet.Execute(run.ResultCollection); smartChromPeakSelector.Parameters.NETTolerance = 0.025f; smartChromPeakSelector.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); iterativeTff.Execute(run.ResultCollection); TestUtilities.DisplayPeaks(run.PeakList); fitscoreCalc.Execute(run.ResultCollection); Assert.AreEqual(9579, (int)Math.Round(result.ChromPeakSelected.XValue)); //result.DisplayToConsole(); TestUtilities.DisplayIsotopicProfileData(result.Target.IsotopicProfile); }
public void find_targetMassTag_131959Test1() { var run = new RunFactory().CreateRun(xcaliburTestfile); var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1); var massTagColl = masstagImporter.Import(); Assert.AreEqual(2719, massTagColl.TargetList.Count); var chromAligner = new ChromAlignerUsingVIPERInfo(); chromAligner.Execute(run); var peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburAllPeaksFile); peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList); //int mtID = 635428; var mtID = 131959; Task peakChromGen = new PeakChromatogramGenerator(20); Task smoother = new DeconTools.Backend.ProcessingTasks.Smoothers.SavitzkyGolaySmoother(23, 2); Task zeroFill = new DeconTools.Backend.ProcessingTasks.ZeroFillers.DeconToolsZeroFiller(3); Task peakDet = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 1); Task msPeakDet = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, true); var basicChromPeakSelParam = new ChromPeakSelectorParameters(); basicChromPeakSelParam.NETTolerance = 0.1f; basicChromPeakSelParam.PeakSelectorMode = Globals.PeakSelectorMode.ClosestToTarget; Task chromPeakSel = new BasicChromPeakSelector(basicChromPeakSelParam); Task msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); run.CurrentMassTag = massTagColl.TargetList.Find(p => p.ID == mtID); var mt = run.CurrentMassTag; mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS; Task theorFeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005); Task targetedFeatureFinder = new BasicTFF(); Task fitScoreCalc = new IsotopicProfileFitScoreCalculator(); theorFeatureGen.Execute(run.ResultCollection); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------"); Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NormalizedElutionTime.ToString("0.000") + "; Sequence = " + mt.Code + "; EmpiricalFormula= " + mt.EmpiricalFormula + "\n"); peakChromGen.Execute(run.ResultCollection); smoother.Execute(run.ResultCollection); //TestUtilities.DisplayXYValues(run.ResultCollection); peakDet.Execute(run.ResultCollection); TestUtilities.DisplayPeaks(run.PeakList); chromPeakSel.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); //TestUtilities.DisplayXYValues(run.ResultCollection); msPeakDet.Execute(run.ResultCollection); targetedFeatureFinder.Execute(run.ResultCollection); fitScoreCalc.Execute(run.ResultCollection); var massTagResult = run.ResultCollection.MassTagResultList[mt]; massTagResult.DisplayToConsole(); //Console.WriteLine("------------------------------ end --------------------------"); }
public void smartChromPeakSelectorTest_withDynamicSumming() { var run = new RunFactory().CreateRun(xcaliburTestfile); var massTagColl = new TargetCollection(); var masstagImporter = new MassTagFromTextFileImporter(massTagTestList1); massTagColl = masstagImporter.Import(); var chromAligner = new ChromAlignerUsingVIPERInfo(); chromAligner.Execute(run); var theorFeatureGen = new TomTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005); var chromPeakDet = new ChromPeakDetector(0.5, 1); var smartchromParam = new SmartChromPeakSelectorParameters(); var smartChromPeakSelector = new SmartChromPeakSelector(smartchromParam); var basicChromPeakSelector = new BasicChromPeakSelector(new ChromPeakSelectorParameters()); var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType); var iterativeTff = new IterativeTFF(new IterativeTFFParameters()); var fitscoreCalc = new IsotopicProfileFitScoreCalculator(); var testChromatogramDataFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TargetedWorkflowStandards\massTag635428_chromatogramData.txt"; var xydata = TestUtilities.LoadXYDataFromFile(testChromatogramDataFile); Assert.IsNotNull(xydata); run.XYData = new XYData(); run.XYData.Xvalues = xydata.Xvalues; run.XYData.Yvalues = xydata.Yvalues; // run.XYData.Display(); run.CurrentMassTag = massTagColl.TargetList.Where(p => p.ID == 635428).First(); Console.WriteLine("------MT = " + run.CurrentMassTag.ToString()); theorFeatureGen.Execute(run.ResultCollection); chromPeakDet.Execute(run.ResultCollection); //first run the standard peak selector basicChromPeakSelector.Execute(run.ResultCollection); var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag); Assert.AreEqual(10066, (int)Math.Round(result.ChromPeakSelected.XValue)); //now run the smart chrom peak selector run.XYData = new XYData(); run.XYData.Xvalues = xydata.Xvalues; run.XYData.Yvalues = xydata.Yvalues; chromPeakDet.Execute(run.ResultCollection); smartChromPeakSelector.Parameters.NETTolerance = 0.025f; smartChromPeakSelector.Parameters.MaxScansSummedInDynamicSumming = 51; smartChromPeakSelector.Parameters.SummingMode = SummingModeEnum.SUMMINGMODE_DYNAMIC; smartChromPeakSelector.Parameters.AreaOfPeakToSumInDynamicSumming = 1; smartChromPeakSelector.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); iterativeTff.Execute(run.ResultCollection); fitscoreCalc.Execute(run.ResultCollection); Console.WriteLine(result.ScanSet); Assert.AreEqual(14, result.ScanSet.IndexValues.Count); Assert.AreEqual(0.0104m, (decimal)Math.Round(result.Score, 4)); Assert.AreEqual("9575 {9534, 9540, 9547, 9554, 9561, 9568, 9575, 9582, 9589, 9596, 9603, 9610, 9617, 9624}", result.ScanSet.ToString()); run.XYData = new XYData(); run.XYData.Xvalues = xydata.Xvalues; run.XYData.Yvalues = xydata.Yvalues; chromPeakDet.Execute(run.ResultCollection); smartChromPeakSelector.Parameters.NETTolerance = 0.025f; smartChromPeakSelector.Parameters.MaxScansSummedInDynamicSumming = 51; smartChromPeakSelector.Parameters.SummingMode = SummingModeEnum.SUMMINGMODE_DYNAMIC; smartChromPeakSelector.Parameters.AreaOfPeakToSumInDynamicSumming = 2; smartChromPeakSelector.Execute(run.ResultCollection); msgen.Execute(run.ResultCollection); iterativeTff.Execute(run.ResultCollection); fitscoreCalc.Execute(run.ResultCollection); result.DisplayToConsole(); Assert.AreEqual(9579, (int)Math.Round(result.ChromPeakSelected.XValue)); Assert.AreEqual(0.025m, (decimal)(Math.Round(result.Score, 4))); //Console.WriteLine(result.ScanSet); Assert.AreEqual(26, result.ScanSet.IndexValues.Count); Assert.AreEqual("9575 {9493, 9500, 9506, 9513, 9520, 9527, 9534, 9540, 9547, 9554, 9561, 9568, 9575, 9582, 9589, 9596, 9603, 9610, 9617, 9624, 9631, 9638, 9645, 9652, 9658, 9665}", result.ScanSet.ToString()); }