Class MassCalc

  • public class MassCalc
    extends Object
    MassCalc calculates the mass of peptides which for our purposes are SymbolLists which contain Symbolsfrom the protein Alphabet. It uses the mono-isotopic and average-isotopic masses identical to those specified at Note: This class does not handle selenocysteine and pyrrolysine.
    M. Jones sdfsd, Keith James (minor changes), Mark Schreiber, George Waldon - getMolecularWeight
    • Field Summary

      Modifier and Type Field Description
      static double Cavg
      Constant value of Carbon average mass
      static double Cmono
      Constant value of Carbon monoisotopic mass
      static double Havg
      Constant value of Hydrogen average mass
      static double Hmono
      Constant value of Hydrogen monoisotopic mass
      static double Navg
      Constant value of Nitrogen average mass
      static double Nmono
      Constant value of Nitrogen monoisotopic mass
      static double Oavg
      Constant value of Oxygen average mass
      static double Omono
      Constant value of Oxygen monoisotopic mass
    • Constructor Summary

      Constructor Description
      MassCalc​(String isotopicType, boolean MH_PLUS)
      Creates a new MassCalc.
    • Constructor Detail

      • MassCalc

        public MassCalc​(String isotopicType,
                        boolean MH_PLUS)
        Creates a new MassCalc.
        isotopicType - a String. The type of isotopes to calculate. Either mono isotopic or average isotopic. Acceptable values are SymbolPropertyTable.AVG_MASS or SymbolPropertyTable.MONO_MASS.
        MH_PLUS - a boolean.
    • Method Detail

      • setSymbolModification

        public void setSymbolModification​(char symbolToken,
                                          double mass)
                                   throws IllegalSymbolException
        Use this to set a post translational modification for the Symbol represented by this character. It will only affect the current MassCalc instance and will not affect the static method.
        symbolToken - a char representing a Symbol.
        mass - a double to be the new mass of the residue.
        IllegalSymbolException - if the Symbol is not recognised.
      • addVariableModification

        public void addVariableModification​(Symbol residue,
                                            double[] masses)
                                     throws IllegalSymbolException
        Add Variable modifications. If multiple masses are set by this method more then one mass will be returned for a mass calculation. For example if a peptide contains two Mets and the user sets the native and oxidized mass for the Met then the masses returned will be of the peptide with 0, 1 and 2 modified Mets.
      • getMolecularWeight

        public static final double getMolecularWeight​(SymbolList proteinSeq)
                                               throws IllegalSymbolException
        Calculate the molecular weight of a protein, making estimates whenever it is possible like averaging mass values for ambiguity symbols or counting zero when gaps are encountered. The method is tolerant for ambiguity symbols as long as they can be resolved to a series of atomic symbols whose mass is available in the ResidueProperties.xml configuration file or they are gaps. The method returns the same value as getMass(SymbolList proteinSeq, SymbolPropertyTable.AVG_MASS, false) when only atomic symbols are found in the polypeptide.
      • getMass

        public static final double getMass​(SymbolList proteinSeq,
                                           String isotopicType,
                                           boolean MH_PLUS)
                                    throws IllegalSymbolException
        getMass calculates the mass of this peptide. This only works for the values in the ResidueProperties.xml configuration file. It is probably slightly faster than the instance method, but it does not handle post-translational modifications.
        proteinSeq - a SymbolList whose mass is to be calculated. This should use the protein alphabet.
        isotopicType - a String The type of isotopes to calculate. Either mono isotopic or average isotopic. Acceptable values are SymbolPropertyTable.AVG_MASS or SymbolPropertyTable.MONO_MASS.
        MH_PLUS - a boolean true if the value needed is the MH+ mass.
        a double mass of the peptide.
        IllegalSymbolException - if the SymbolList contains illegal Symbols.
      • getMass

        public double getMass​(SymbolList proteinSeq)
                       throws IllegalSymbolException
        Get the Mass of this peptide. Use this if you want to set fixed modifications and have created an instance of MassCalc. The value is calculated using the value of MH_PLUS defined in the constructor. The static method may be faster.
        proteinSeq - The sequence for mass calculation
        The mass of the sequence
      • getTermMass

        public double getTermMass()
        getTermMass returns the terminal mass being used by the instance methods.
        a double mass.