Beispiel #1
0
 public static Modification2[] FromStrings(IList <string> modNames)
 {
     if (modNames == null)
     {
         return(new Modification2[0]);
     }
     Modification2[] result = new Modification2[modNames.Count];
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = new Modification2(modNames[i]);
     }
     return(result);
 }
Beispiel #2
0
        private static double GetDeltaMass(Modification2 mod, string sequence, bool isNterm, bool isCterm)
        {
            ModificationPosition pos = mod.Position;
            double deltaMass         = 0;

            for (int i = 0; i < mod.AaCount; i++)
            {
                for (int j = 0; j < sequence.Length; j++)
                {
                    if ((pos == ModificationPosition.notNterm || pos == ModificationPosition.notTerm) && j == 0)
                    {
                        continue;
                    }
                    if ((pos == ModificationPosition.notCterm || pos == ModificationPosition.notTerm) && j == sequence.Length - 1)
                    {
                        continue;
                    }
                    if (sequence[j] == mod.GetAaAt(i))
                    {
                        deltaMass += mod.DeltaMass;
                    }
                }
            }
            if (pos == ModificationPosition.anyNterm)
            {
                deltaMass += mod.DeltaMass;
            }
            if (pos == ModificationPosition.anyCterm)
            {
                deltaMass += mod.DeltaMass;
            }
            if (pos == ModificationPosition.proteinNterm && isNterm)
            {
                deltaMass += mod.DeltaMass;
            }
            if (pos == ModificationPosition.proteinCterm && isCterm)
            {
                deltaMass += mod.DeltaMass;
            }
            return(deltaMass);
        }
 public static AminoAcid GetAminoAcidFromLabel(Modification2 m)
 {
     return(m.AaCount == 0 ? null : AminoAcids.FromLetter(m.GetAaAt(0)));
 }
        /// <summary>
        /// Given string label, return corresponding AminoAcid object, or null for a terminal modiciation.
        /// </summary>
        /// <param name="label">string label, e.g. "DimethLys2"</param>
        /// <returns>AminoAcid object, or null for a terminal modiciation</returns>
        public static AminoAcid GetAminoAcidFromLabel(string label)
        {
            Modification2 m = new Modification2(label);

            return(m.AaCount == 0 ? null : AminoAcids.FromLetter(m.GetAaAt(0)));
        }
 private static double GetDeltaMass(Modification2 mod, string sequence, bool isNterm, bool isCterm)
 {
     ModificationPosition pos = mod.Position;
     double deltaMass = 0;
     for (int i = 0; i < mod.AaCount; i++){
         for (int j = 0; j < sequence.Length; j++){
             if ((pos == ModificationPosition.notNterm || pos == ModificationPosition.notTerm) && j == 0){
                 continue;
             }
             if ((pos == ModificationPosition.notCterm || pos == ModificationPosition.notTerm) && j == sequence.Length - 1){
                 continue;
             }
             if (sequence[j] == mod.GetAaAt(i)){
                 deltaMass += mod.DeltaMass;
             }
         }
     }
     if (pos == ModificationPosition.anyNterm){
         deltaMass += mod.DeltaMass;
     }
     if (pos == ModificationPosition.anyCterm){
         deltaMass += mod.DeltaMass;
     }
     if (pos == ModificationPosition.proteinNterm && isNterm){
         deltaMass += mod.DeltaMass;
     }
     if (pos == ModificationPosition.proteinCterm && isCterm){
         deltaMass += mod.DeltaMass;
     }
     return deltaMass;
 }
        public static double GetFixedModificationMass(string sequence, Modification2[] modifications, bool isProteinNterm,
			bool isProteinCterm)
        {
            double monoisotopicMass = 0;
            foreach (Modification2 mod in modifications){
                monoisotopicMass += GetDeltaMass(mod, sequence, isProteinNterm, isProteinCterm);
            }
            return monoisotopicMass;
        }
 public static Modification2[] FromStrings(IList<string> modNames)
 {
     if (modNames == null){
         return new Modification2[0];
     }
     Modification2[] result = new Modification2[modNames.Count];
     for (int i = 0; i < result.Length; i++){
         result[i] = new Modification2(modNames[i]);
     }
     return result;
 }
        public static double CalcMonoisotopicMass(string sequence, Modification2[] modifications, bool isProteinNterm,
			bool isProteinCterm)
        {
            double m = CalcMonoisotopicMass(sequence);
            m += GetFixedModificationMass(sequence, modifications, isProteinNterm, isProteinCterm);
            return m;
        }
 public static AminoAcid GetAminoAcidFromLabel(Modification2 m)
 {
     return m.AaCount == 0 ? null : AminoAcids.FromLetter(m.GetAaAt(0));
 }
 /// <summary>
 /// Given string label, return corresponding AminoAcid object, or null for a terminal modiciation.
 /// </summary>
 /// <param name="label">string label, e.g. "DimethLys2"</param>
 /// <returns>AminoAcid object, or null for a terminal modiciation</returns>
 public static AminoAcid GetAminoAcidFromLabel(string label)
 {
     Modification2 m = new Modification2(label);
     return m.AaCount == 0 ? null : AminoAcids.FromLetter(m.GetAaAt(0));
 }