public class MassCalc extends Object
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
MassCalc()
Default constructor.
|
MassCalc(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,
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(String aFilename)
This constructor allows the caller to use an elementlist of
its own making.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateMass(String aFormula)
This method attempts to calculate the mass of a chemical formula.
|
static void |
main(String[] args)
The main method can be used for command-line usage of this class.
|
public static final int MONOELEMENTS
public static final int MONOAA
public static final int MONONUCLEOTIDES
public static final int SELFDEFINED
public MassCalc()
public MassCalc(int aMassListIdentifier)
aMassListIdentifier
- int with the identifier for the
elementlist to use.public MassCalc(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(HashMap aElementList)
aElementList
- HashMap with the elementlist to use.public MassCalc(int aMassListIdentifier, HashMap aSupplElementList)
aMassListIdentifier
- int with the identifier for the
built-in elementlist to use.aSupplElementList
- HashMap with the supplementary
elementlist to use.public double calculateMass(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(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.Copyright © 2016. All rights reserved.