Package org.biojava.bio.proteomics
Class MassCalc
java.lang.Object
org.biojava.bio.proteomics.MassCalc
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 www.micromass.co.uk
Note: This class does not handle selenocysteine and pyrrolysine.- Author:
- M. Jones sdfsd, Keith James (minor changes), Mark Schreiber, George Waldon - getMolecularWeight
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleConstant value of Carbon average massstatic final doubleConstant value of Carbon monoisotopic massstatic final doubleConstant value of Hydrogen average massstatic final doubleConstant value of Hydrogen monoisotopic massstatic final doubleConstant value of Nitrogen average massstatic final doubleConstant value of Nitrogen monoisotopic massstatic final doubleConstant value of Oxygen average massstatic final doubleConstant value of Oxygen monoisotopic mass -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVariableModification(char residue, double[] masses) Add Variable modifications.voidaddVariableModification(Symbol residue, double[] masses) Add Variable modifications.doublegetMass(SymbolList proteinSeq) Get the Mass of this peptide.static final doublegetMass(SymbolList proteinSeq, String isotopicType, boolean MH_PLUS) getMasscalculates the mass of this peptide.static final doublegetMolecularWeight(SymbolList proteinSeq) 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.doublegetTermMassreturns the terminal mass being used by the instance methods.double[]getVariableMasses(SymbolList peptide) Get all masses including the variable mass.booleanremoveVariableModifications(char residue) Remove all variable modifications assocaited with this residue.booleanremoveVariableModifications(Symbol residue) Remove all variable modifications assocaited with this residue.voidsetSymbolModification(char symbolToken, double mass) Use this to set a post translational modification for theSymbolrepresented by this character.
-
Field Details
-
Cmono
Constant value of Carbon monoisotopic mass- See Also:
-
Hmono
Constant value of Hydrogen monoisotopic mass- See Also:
-
Nmono
Constant value of Nitrogen monoisotopic mass- See Also:
-
Omono
Constant value of Oxygen monoisotopic mass- See Also:
-
Cavg
Constant value of Carbon average mass- See Also:
-
Havg
Constant value of Hydrogen average mass- See Also:
-
Oavg
Constant value of Oxygen average mass- See Also:
-
-
Constructor Details
-
MassCalc
Creates a newMassCalc.- Parameters:
isotopicType- aString. The type of isotopes to calculate. Either mono isotopic or average isotopic. Acceptable values areSymbolPropertyTable.AVG_MASSorSymbolPropertyTable.MONO_MASS.MH_PLUS- aboolean.
-
-
Method Details
-
setSymbolModification
Use this to set a post translational modification for theSymbolrepresented by this character. It will only affect the currentMassCalcinstance and will not affect the static method.- Parameters:
symbolToken- acharrepresenting aSymbol.mass- adoubleto be the new mass of the residue.- Throws:
IllegalSymbolException- if theSymbolis not recognised.
-
addVariableModification
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.- Parameters:
residue- The one char id for this residuemasses-- Throws:
IllegalSymbolException- See Also:
-
addVariableModification
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.- Throws:
IllegalSymbolException
-
removeVariableModifications
Remove all variable modifications assocaited with this residue.- Throws:
IllegalSymbolException
-
removeVariableModifications
Remove all variable modifications assocaited with this residue. -
getMolecularWeight
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.- Throws:
IllegalSymbolException- Since:
- 1.5
-
getMass
public static final double getMass(SymbolList proteinSeq, String isotopicType, boolean MH_PLUS) throws IllegalSymbolException getMasscalculates 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.- Parameters:
proteinSeq- aSymbolListwhose mass is to be calculated. This should use the protein alphabet.isotopicType- aStringThe type of isotopes to calculate. Either mono isotopic or average isotopic. Acceptable values areSymbolPropertyTable.AVG_MASSorSymbolPropertyTable.MONO_MASS.MH_PLUS- abooleantrue if the value needed is the MH+ mass.- Returns:
- a
doublemass of the peptide. - Throws:
IllegalSymbolException- if theSymbolListcontains illegalSymbols.
-
getMass
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.- Parameters:
proteinSeq- The sequence for mass calculation- Returns:
- The mass of the sequence
- Throws:
IllegalSymbolException
-
getVariableMasses
Get all masses including the variable mass. Allgorythm 1 Get the first residue of the sequence create a list of all the standard and non-standard massses for this reidue for each residue mass goto 1 with the sequence of all residues after the current residue add the residue mass to each mass from 1 to the list- Throws:
IllegalSymbolException- See Also:
-
getTermMass
getTermMassreturns the terminal mass being used by the instance methods.- Returns:
- a
doublemass.
-