private void AddModifications(IEnumerable<StaticMod> mods, ModMasses modMasses) { foreach (StaticMod mod in mods) { if (mod.AAs == null) { if (mod.Terminus != null) { double mass = GetModMass('\0', mod); // Not L10N double unexplainedMass; string formula = GetModFormula('\0', mod, out unexplainedMass); // Not L10N if (mod.Terminus == ModTerminus.C) { modMasses._massModCleaveC += mass; modMasses._massModCleaveCExtra += unexplainedMass; modMasses._massModCleaveCFormula = CombineFormulas(modMasses._massModCleaveCFormula, formula); } else { modMasses._massModCleaveN += mass; modMasses._massModCleaveNExtra += unexplainedMass; modMasses._massModCleaveNFormula = CombineFormulas(modMasses._massModCleaveNFormula, formula); } } else { // Label all amino acids with this label for (char aa = 'A'; aa <= 'Z'; aa++) // Not L10N { if (AMINO_FORMULAS[aa] != null) AddMod(aa, mod, modMasses._aminoModMasses, modMasses._aminoModMassesExtra, modMasses._aminoModFormulas); } } } else { foreach (var aa in mod.AminoAcids) { switch (mod.Terminus) { default: AddMod(aa, mod, modMasses._aminoModMasses, modMasses._aminoModMassesExtra, modMasses._aminoModFormulas); break; case ModTerminus.N: AddMod(aa, mod, modMasses._aminoNTermModMasses, modMasses._aminoNTermModMassesExtra, modMasses._aminoNTermModFormulas); break; case ModTerminus.C: AddMod(aa, mod, modMasses._aminoCTermModMasses, modMasses._aminoCTermModMassesExtra, modMasses._aminoCTermModFormulas); break; } } } } }
public void AddHeavyModifications(IEnumerable<StaticMod> mods) { var modsArray = mods.ToArray(); // Avoid multiple iteration AddModifications(modsArray, _modMasses); _modMassesHeavy = new ModMasses(); AddModifications(modsArray, _modMassesHeavy); }