Exemplo n.º 1
0
        public void Test1()
        {
            double featureFinderTol = 15;
            var    featureFinderRequiresMonoPeak = false;

            var n14n15Util = new N14N15TestingUtilities();
            //get MS
            var massSpectrum = n14n15Util.GetSpectrumAMTTag23140708_Z3_Sum3();  //this is the diff b/w previous test and this one


            var mt23140708 = n14n15Util.CreateMT23140708_Z3();


            var featureGen2 = new JoshTheorFeatureGenerator();

            featureGen2.GenerateTheorFeature(mt23140708);



            //get ms peaks
            var peakDet    = new DeconToolsPeakDetectorV2(1.3, 2, Globals.PeakFitType.QUADRATIC, false);
            var msPeakList = peakDet.FindPeaks(massSpectrum, 0, 0);

            var bff        = new BasicTFF(featureFinderTol, featureFinderRequiresMonoPeak);
            var n14Profile = bff.FindMSFeature(msPeakList, mt23140708.IsotopicProfile);

            var theorXYData = mt23140708.IsotopicProfile.GetTheoreticalIsotopicProfileXYData(n14Profile.GetFWHM());


            var    theorMaxY = theorXYData.Yvalues.Max();
            double obsMaxY   = n14Profile.getMostIntensePeak().Height;


            for (var i = 0; i < theorXYData.Xvalues.Length; i++)
            {
                theorXYData.Yvalues[i] = theorXYData.Yvalues[i] * obsMaxY;
            }

            offsetDistribution(theorXYData, mt23140708.IsotopicProfile, n14Profile);


            var subtracted = XYDataUtilities.SubtractXYData(massSpectrum, theorXYData, n14Profile.MonoPeakMZ - 1,
                                                            n14Profile.MonoPeakMZ + 3, 0.01);



            var outputFileMS           = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TextFile\massSpectrum1.txt";
            var outputFileMSSubtracted = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\TextFile\massSpectrum1_withDataSubtracted.txt";

            TestUtilities.WriteToFile(massSpectrum, outputFileMS);
            TestUtilities.WriteToFile(subtracted, outputFileMSSubtracted);



            // XYDataUtilities.NormalizeXYData()
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }