Пример #1
0
        public static double CalculateProteoformMass(string sequence, List <Ptm> ptm_combination)
        {
            if (Sweet.lollipop.theoretical_database.aaIsotopeMassList == null)
            {
                Sweet.lollipop.theoretical_database.populate_aa_mass_dictionary();
            }

            if (!Sweet.lollipop.use_average_mass)
            {
                double        proteoformMass = 18.010565; // start with water
                char[]        aminoAcids     = sequence.ToCharArray();
                List <double> aaMasses       = new List <double>();
                for (int i = 0; i < sequence.Length; i++)
                {
                    if (Sweet.lollipop.theoretical_database.aaIsotopeMassList.ContainsKey(aminoAcids[i]))
                    {
                        aaMasses.Add(Sweet.lollipop.theoretical_database.aaIsotopeMassList[aminoAcids[i]]);
                    }
                }

                return(proteoformMass + aaMasses.Sum() +
                       ptm_combination.Sum(p => Math.Round((double)p.modification.MonoisotopicMass, 5)));
            }

            //if most abundant mass, calculate iso distrubution, set modified/unmodified masses to most abundant.
            var formula = new Proteomics.AminoAcidPolymer.Peptide(sequence).GetChemicalFormula();

            // append mod formulas
            foreach (var mod in ptm_combination)
            {
                var modCf = mod.modification.ChemicalFormula;

                if (modCf != null)
                {
                    formula.Add(modCf);
                }
            }

            //Calculate isotopic distribution of the full peptide
            //var dist = IsotopicDistribution.GetDistribution(formula, 0.1, 1e-12);

            //double[] masses = dist.Masses.ToArray();
            //double[] intensities = dist.Intensities.ToArray();
            //double max = intensities.Max();
            //int modeMassIndex = Array.IndexOf(intensities, max);
            //return masses[modeMassIndex];
            return(formula.AverageMass);
        }
Пример #2
0
        public ChemicalFormula GetChemicalFormula()
        {
            var formula = new Proteomics.AminoAcidPolymer.Peptide(sequence).GetChemicalFormula();

            // append mod formulas
            foreach (var mod in ptm_list)
            {
                var modCf = mod.modification.ChemicalFormula;

                if (modCf != null)
                {
                    formula.Add(modCf);
                }
                else
                {
                    return(null);
                }
            }

            return(formula);
        }