Beispiel #1
0
        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();
        }
Beispiel #2
0
        public override void Execute(ResultCollection resultList)
        {
            Check.Require(resultList.Run.CurrentMassTag != null, string.Format("{0} failed. Mass tags haven't been defined.", Name));
            if (resultList.Run.CurrentMassTag == null)
            {
                return;
            }

            resultList.ResultType = Globals.ResultType.N14N15_TARGETED_RESULT;

            _FeatureGenerator.GenerateTheorFeature(resultList.Run.CurrentMassTag);   //generate theor profile for unlabeled feature
            var labeledProfile = _N15IsotopicProfileGenerator.GetN15IsotopicProfile(resultList.Run.CurrentMassTag, 0.005);

            var chromExtractor = new IsotopicProfileMultiChromatogramExtractor(
                NumPeaksForGeneratingChrom, ToleranceInPPM);

            var massTagResult = resultList.CurrentTargetedResult;

            if (!(massTagResult is N14N15_TResult n14n15result))
            {
                throw new InvalidOperationException(string.Format("{0} failed. There was a problem with the Result type; massTagResult is not class N14N15_TResult ", Name));
            }

            n14n15result.UnlabeledPeakChromData = chromExtractor.GetChromatogramsForIsotopicProfilePeaks(resultList.MSPeakResultList, resultList.Run.CurrentMassTag.IsotopicProfile);
            n14n15result.LabeledPeakChromData   = chromExtractor.GetChromatogramsForIsotopicProfilePeaks(resultList.MSPeakResultList, labeledProfile);
        }
Beispiel #3
0
        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 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.
        }
Beispiel #5
0
        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 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.
        }
Beispiel #7
0
        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 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 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
        }