Exemplo n.º 1
0
        public void getIsotopicProfileTest1()
        {
            var utils   = new PeptideUtils();
            var formula = utils.GetEmpiricalFormulaForPeptideSequence("SAMPLERPAMPLERSAMPLERPAMPLERSAMPLERPAMPLERSAMPLERPAMPLER");

            var iso1 = isotopicDistributionCalculator.GetIsotopePattern(formula);

            PeakUtilities.TrimIsotopicProfile(iso1, 0.001);

            var tomGen = new TomIsotopicPattern();
            var iso2   = tomGen.GetIsotopePattern(formula);

            PeakUtilities.TrimIsotopicProfile(iso2, 0.001);

            for (var i = 0; i < iso1.Peaklist.Count; i++)
            {
                var roundedI1 = (decimal)Math.Round(iso1.Peaklist[i].Height, 2);
                var roundedI2 = (decimal)Math.Round(iso2.Peaklist[i].Height, 2);

                Assert.AreEqual(roundedI1, roundedI2);
            }

            TestUtilities.DisplayIsotopicProfileData(iso1);
        }
Exemplo n.º 2
0
        public IsotopicProfile GetDHIsotopicProfile2(TargetBase mt, double lowpeakCutoff, double fractionLabeling, double molarMixingofH)
        {
            Check.Require(mt != null, "Mass tag not defined");
            Check.Require(mt.IsotopicProfile != null, "Mass tag's theor isotopic profile not defined");
            Check.Require(mt.ChargeState != 0, "Can't have a charge state of '0'");

            //int numNitrogens = mt.GetAtomCountForElement("N");
            var numDeuterium = 0;

            //_isotopicDistributionCalculator.SetLabeling("H", H_ISOTOPE_NUMBER, this.HLabelingAmount, D_ISOTOPE_NUMBER, this.DLabelingAmount);
            var hydrogenTheoreticalProfile = _isotopicDistributionCalculator.GetIsotopePattern(mt.EmpiricalFormula);

            var deuteriumTheoreticalProfile = _isotopicDistributionCalculator.GetIsotopePattern(mt.EmpiricalFormula);

            HLabelingAmount = molarMixingofH;
            DLabelingAmount = 1 - molarMixingofH;

            //convert to floats
            var labelingAmountFraction = Convert.ToSingle(fractionLabeling);
            var HLabelingAmountMix     = Convert.ToSingle(HLabelingAmount);
            var DLabelingAmountMix     = Convert.ToSingle(DLabelingAmount);

            //initialization
            float maxHeightForNormalization = 0;

            if (hydrogenTheoreticalProfile.Peaklist.Count > 0)
            {
                maxHeightForNormalization = hydrogenTheoreticalProfile.Peaklist[0].Height * HLabelingAmountMix;
            }

            //add deuterated peaks as an offset index
            for (var i = 0; i < hydrogenTheoreticalProfile.Peaklist.Count; i++)
            {
                var    peakH = hydrogenTheoreticalProfile.Peaklist[i];
                MSPeak peakD;
                if (i == 0) //initial peak where there is no D contribution
                {
                    peakD = new MSPeak(0);
                }
                else
                {
                    peakD = deuteriumTheoreticalProfile.Peaklist[i - 1];
                }

                var contributionH = peakH.Height * HLabelingAmountMix;
                var contributionD = (1 - labelingAmountFraction) * peakD.Height * DLabelingAmountMix + labelingAmountFraction * peakD.Height * DLabelingAmountMix;

                peakH.Height = contributionH + contributionD;

                //peakH.Height = peakH.Height + (1-Convert.ToSingle(fractionLabeling)) * peakD.Height +Convert.ToSingle(fractionLabeling) * peakD.Height;

                //find true hightes peak in combined distribusion
                if (peakH.Height > maxHeightForNormalization)
                {
                    maxHeightForNormalization = peakH.Height;
                }
            }

            //rename for clarity
            var labeledTheoreticalProfile = hydrogenTheoreticalProfile;

            //normalize to 1
            foreach (var peak in labeledTheoreticalProfile.Peaklist)
            {
                peak.Height /= maxHeightForNormalization;
            }

            //should be good up to here

            addMZInfoToTheorProfile(mt.IsotopicProfile, labeledTheoreticalProfile, numDeuterium, mt.ChargeState);//Keep this as the H mass?

            //_isotopicDistributionCalculator.ResetToUnlabeled();

            PeakUtilities.TrimIsotopicProfile(labeledTheoreticalProfile, lowpeakCutoff);

            labeledTheoreticalProfile.ChargeState = mt.ChargeState;

            return(labeledTheoreticalProfile);
        }