|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.general.MassCalc
public class MassCalc
This class takes care of mass calculation, based on a sequence
in IUPAC format.
By default it can handle monoisotopic biochemical element masses
and monoisotopic single-letter amino acid masses.
The object can be customized with your own mass lists through the
use of a properties file, or by directly passing a HashMap.
Please note: if you decide on your own lists, be sure to
follow the following guidelines:
Field Summary | |
---|---|
static int |
MONOAA
Index for the monoisotopic aminoacid masses. |
static int |
MONOELEMENTS
Index for the monoisotopic masses of the biochemically relevant elements. |
static int |
MONONUCLEOTIDES
Index for the monoisotopic nucleotide masses. |
static int |
SELFDEFINED
Value for the self-defined masses. |
Constructor Summary | |
---|---|
MassCalc()
Default constructor. |
|
MassCalc(java.util.HashMap aElementList)
This constructor allows the caller to initialize the elementlist with a HashMap of its own design. |
|
MassCalc(int aMassListIdentifier)
This constructor allows you to specify an identifier to select a element list to use for calculating a mass. |
|
MassCalc(int aMassListIdentifier,
java.util.HashMap aSupplElementList)
This constructor allows the caller to supplement (or to replace elements in) a built-in elementlist with a HashMap of its own design. |
|
MassCalc(java.lang.String aFilename)
This constructor allows the caller to use an elementlist of its own making. |
Method Summary | |
---|---|
double |
calculateMass(java.lang.String aFormula)
This method attempts to calculate the mass of a chemical formula. |
static void |
main(java.lang.String[] args)
The main method can be used for command-line usage of this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MONOELEMENTS
public static final int MONOAA
public static final int MONONUCLEOTIDES
public static final int SELFDEFINED
Constructor Detail |
---|
public MassCalc()
public MassCalc(int aMassListIdentifier)
aMassListIdentifier
- int with the identifier for the
elementlist to use.public MassCalc(java.lang.String aFilename)
aFilename
- String with the name of the file to be loaded.
NOTE! this file must be located in the
classpath and mst be a simple properties file!public MassCalc(java.util.HashMap aElementList)
aElementList
- HashMap with the elementlist to use.public MassCalc(int aMassListIdentifier, java.util.HashMap aSupplElementList)
aMassListIdentifier
- int with the identifier for the
built-in elementlist to use.aSupplElementList
- HashMap with the supplementary
elementlist to use.Method Detail |
---|
public double calculateMass(java.lang.String aFormula) throws UnknownElementMassException
aFormula
- String with the chemical formula (or bruto
formula) of the compound in question.
UnknownElementMassException
- when one of the composing elements'
mass is unknown to the class.public static void main(java.lang.String[] args)
args
- String[] at least one chemical formula should be specified,
up to as much as you can cramp into a single
command-line.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |