Exemple #1
0
        public static Molecule GetPeptideMolecule(string aaseq)
        {
            Dictionary <char, int> counts = new Dictionary <char, int>();

            foreach (char c in aaseq)
            {
                if (!LetterToAa.ContainsKey(c))
                {
                    return(null);
                }
                if (!counts.ContainsKey(c))
                {
                    counts.Add(c, 0);
                }
                counts[c]++;
            }
            char[]     keys = counts.Keys.ToArray();
            Molecule[] mol  = new Molecule[keys.Length + 1];
            int[]      n    = new int[keys.Length + 1];
            for (int i = 0; i < keys.Length; i++)
            {
                mol[i] = letterToAa[keys[i]];
                n[i]   = counts[keys[i]];
            }
            mol[keys.Length] = new Molecule("H2O");
            n[keys.Length]   = 1;
            return(Molecule.Sum(mol, n));
        }
 public Molecule GetMolecule()
 {
     Molecule[] x = new Molecule[ModificationTypes.Length];
     for (int i = 0; i < x.Length; i++)
     {
         Modification mod = Tables.ModificationList[ModificationTypes[i]];
         x[i] = mod.GetMolecule();
     }
     return(Molecule.Sum(x, ModificationCounts));
 }