@TestClass(value="org.openscience.cdk.formula.MolecularFormulaManipulatorTest") public class MolecularFormulaManipulator extends Object
IMolecularFormula
's. For example:Constructor and Description |
---|
MolecularFormulaManipulator() |
Modifier and Type | Method and Description |
---|---|
static boolean |
compare(IMolecularFormula formula1,
IMolecularFormula formula2)
Compare two IMolecularFormula looking at type and number of IIsotope and
charge of the formula.
|
static boolean |
containsElement(IMolecularFormula formula,
IElement element)
True, if the MolecularFormula contains the given element as IIsotope object.
|
static List<IElement> |
elements(IMolecularFormula formula)
Get a list of all Elements which are contained
molecular.
|
static String[] |
generateOrderEle()
Returns the Elements ordered according to (approximate) probability of occurrence.
|
static IAtomContainer |
getAtomContainer(IMolecularFormula formula)
Method that actually does the work of convert the IMolecularFormula
to IAtomContainer.
|
static IAtomContainer |
getAtomContainer(IMolecularFormula formula,
IAtomContainer atomContainer)
Method that actually does the work of convert the IMolecularFormula
to IAtomContainer given a IAtomContainer.
|
static int |
getAtomCount(IMolecularFormula formula)
Checks a set of Nodes for the occurrence of each isotopes
instance in the molecular formula.
|
static double |
getDBE(IMolecularFormula formula)
Returns the number of double bond equivalents in this molecule.
|
static int |
getElementCount(IMolecularFormula formula,
IElement element)
Checks a set of Nodes for the occurrence of the isotopes in the
molecular formula from a particular IElement.
|
static List<IElement> |
getHeavyElements(IMolecularFormula formula)
Returns a set of nodes excluding all the hydrogens
|
static String |
getHillString(IMolecularFormula formula) |
static String |
getHTML(IMolecularFormula formula)
Returns the string representation of the molecule formula based on Hill
System with numbers wrapped in <sub></sub> tags.
|
static String |
getHTML(IMolecularFormula formula,
boolean chargeB,
boolean isotopeB)
Returns the string representation of the molecule formula based on Hill
System with numbers wrapped in <sub></sub> tags and the
isotope of each Element in <sup></sup> tags and the total
charge of IMolecularFormula in <sup></sup> tags.
|
static List<IIsotope> |
getIsotopes(IMolecularFormula formula,
IElement element)
Get a list of IIsotope from a given IElement which is contained
molecular.
|
static double |
getMajorIsotopeMass(IMolecularFormula formula)
Get the summed major isotopic mass of all elements from an MolecularFormula.
|
static IMolecularFormula |
getMajorIsotopeMolecularFormula(String stringMF,
IChemObjectBuilder builder)
Construct an instance of IMolecularFormula, initialized with a molecular
formula string.
|
static IMolecularFormula |
getMolecularFormula(IAtomContainer atomContainer)
Method that actually does the work of convert the atomContainer
to IMolecularFormula.
|
static IMolecularFormula |
getMolecularFormula(IAtomContainer atomContainer,
IMolecularFormula formula)
Method that actually does the work of convert the atomContainer
to IMolecularFormula given a IMolecularFormula.
|
static IMolecularFormula |
getMolecularFormula(String stringMF,
IChemObjectBuilder builder)
Construct an instance of IMolecularFormula, initialized with a molecular
formula string.
|
static IMolecularFormula |
getMolecularFormula(String stringMF,
IMolecularFormula formula)
add in a instance of IMolecularFormula the elements extracts form
molecular formula string.
|
static double |
getNaturalExactMass(IMolecularFormula formula)
Get the summed natural mass of all elements from an MolecularFormula.
|
static String |
getString(IMolecularFormula formula)
Returns the string representation of the molecule formula.
|
static String |
getString(IMolecularFormula formula,
boolean setOne)
Returns the string representation of the molecule formula.
|
static String |
getString(IMolecularFormula formula,
String[] orderElements,
boolean setOne)
Returns the string representation of the molecule formula.
|
static double |
getTotalExactMass(IMolecularFormula formula)
Get the summed exact mass of all isotopes from an MolecularFormula.
|
static double |
getTotalMassNumber(IMolecularFormula formula)
Get the summed mass number of all isotopes from an MolecularFormula.
|
static double |
getTotalNaturalAbundance(IMolecularFormula formula)
Get the summed natural abundance of all isotopes from an MolecularFormula.
|
static List<IIsotope> |
putInOrder(String[] orderElements,
IMolecularFormula formula) |
static IMolecularFormula |
removeElement(IMolecularFormula formula,
IElement element)
Removes all isotopes from a given element in the MolecularFormula.
|
static String |
simplifyMolecularFormula(String formula)
Simplify the molecular formula.
|
@TestMethod(value="testGetAtomCount_IMolecularFormula") public static int getAtomCount(IMolecularFormula formula)
formula
- The MolecularFormula to check@TestMethod(value="testGetElementCount_IMolecularFormula_IElement") public static int getElementCount(IMolecularFormula formula, IElement element)
formula
- The MolecularFormula to checkelement
- The IElement object@TestMethod(value="testGetIsotopes_IMolecularFormula_IElement") public static List<IIsotope> getIsotopes(IMolecularFormula formula, IElement element)
formula
- The MolecularFormula to checkelement
- The IElement object@TestMethod(value="testElements_IMolecularFormula") public static List<IElement> elements(IMolecularFormula formula)
formula
- The MolecularFormula to check@TestMethod(value="testContainsElement_IMolecularFormula_IElement") public static boolean containsElement(IMolecularFormula formula, IElement element)
formula
- IMolecularFormula molecularFormulaelement
- The element this MolecularFormula is searched for@TestMethod(value="testRemoveElement_IMolecularFormula_IElement") public static IMolecularFormula removeElement(IMolecularFormula formula, IElement element)
formula
- IMolecularFormula molecularFormulaelement
- The IElement of the IIsotopes to be removed@TestMethod(value="testGetString_IMolecularFormula_arrayString_boolean") public static String getString(IMolecularFormula formula, String[] orderElements, boolean setOne)
formula
- The IMolecularFormula ObjectorderElements
- The order of ElementssetOne
- True, when must be set the value 1 for elements with
one atomgetHTML(IMolecularFormula)
,
generateOrderEle()
,
generateOrderEle_Hill_NoCarbons()
,
generateOrderEle_Hill_WithCarbons()
@TestMethod(value="testGetString_IMolecularFormula") public static String getString(IMolecularFormula formula)
formula
- The IMolecularFormula ObjectgetHTML(IMolecularFormula)
@TestMethod(value="testGetString_IMolecularFormula_boolean") public static String getString(IMolecularFormula formula, boolean setOne)
formula
- The IMolecularFormula ObjectsetOne
- True, when must be set the value 1 for elements with
one atomgetHTML(IMolecularFormula)
public static List<IIsotope> putInOrder(String[] orderElements, IMolecularFormula formula)
@TestMethod(value="testGetHillString_IMolecularFormula") public static String getHillString(IMolecularFormula formula)
@TestMethod(value="testGetHTML_IMolecularFormula") public static String getHTML(IMolecularFormula formula)
formula
- The IMolecularFormula objectgetHTML(IMolecularFormula, boolean, boolean)
@TestMethod(value="testGetHTML_IMolecularFormula_boolean_boolean") public static String getHTML(IMolecularFormula formula, boolean chargeB, boolean isotopeB)
formula
- The IMolecularFormula objectchargeB
- True, If it has to show the chargeisotopeB
- True, If it has to show the Isotope massgetHTML(IMolecularFormula)
@TestMethod(value="testGetMolecularFormula_String_IChemObjectBuilder") public static IMolecularFormula getMolecularFormula(String stringMF, IChemObjectBuilder builder)
The hydrogens must be implicit.
stringMF
- The molecularFormula stringbuilder
- a IChemObjectBuilder which is used to construct atomsgetMolecularFormula(String,IMolecularFormula)
@TestMethod(value="testGetMajorIsotopeMolecularFormula_String_IChemObjectBuilder") public static IMolecularFormula getMajorIsotopeMolecularFormula(String stringMF, IChemObjectBuilder builder)
stringMF
- The molecularFormula stringbuilder
- a IChemObjectBuilder which is used to construct atomsgetMolecularFormula(String,IMolecularFormula)
@TestMethod(value="testGetMolecularFormula_String_IMolecularFormula") public static IMolecularFormula getMolecularFormula(String stringMF, IMolecularFormula formula)
The hydrogens must be implicit.
stringMF
- The molecularFormula stringgetMolecularFormula(String, IChemObjectBuilder)
@TestMethod(value="testGetTotalExactMass_IMolecularFormula") public static double getTotalExactMass(IMolecularFormula formula)
formula
- The IMolecularFormula to calculate@TestMethod(value="testGetTotalMassNumber_IMolecularFormula") public static double getTotalMassNumber(IMolecularFormula formula)
formula
- The IMolecularFormula to calculate@TestMethod(value="testGetNaturalExactMass_IMolecularFormula") public static double getNaturalExactMass(IMolecularFormula formula)
formula
- The IMolecularFormula to calculate@TestMethod(value="testGetMajorIsotopeMass_IMolecularFormula") public static double getMajorIsotopeMass(IMolecularFormula formula)
formula
- The IMolecularFormula to calculate@TestMethod(value="testGetTotalNaturalAbundance_IMolecularFormula") public static double getTotalNaturalAbundance(IMolecularFormula formula)
formula
- The IMolecularFormula to calculate@TestMethod(value="testGetDBE_IMolecularFormula") public static double getDBE(IMolecularFormula formula) throws CDKException
formula
- The IMolecularFormula to calculateCDKException
- if DBE cannot be be evaluated@TestMethod(value="testGetMolecularFormula_IAtomContainer") public static IMolecularFormula getMolecularFormula(IAtomContainer atomContainer)
The hydrogens must be implicit.
atomContainer
- IAtomContainer objectgetMolecularFormula(IAtomContainer,IMolecularFormula)
@TestMethod(value="testGetMolecularFormula_IAtomContainer_IMolecularFormula") public static IMolecularFormula getMolecularFormula(IAtomContainer atomContainer, IMolecularFormula formula)
The hydrogens must be implicit.
atomContainer
- IAtomContainer objectformula
- IMolecularFormula molecularFormula to put the new IsotopesgetMolecularFormula(IAtomContainer)
@TestMethod(value="testGetAtomContainer_IMolecularFormula") public static IAtomContainer getAtomContainer(IMolecularFormula formula)
The hydrogens must be implicit.
formula
- IMolecularFormula objectgetAtomContainer(IMolecularFormula, IAtomContainer)
@TestMethod(value="testGetAtomContainer_IMolecularFormula_IAtomContainer") public static IAtomContainer getAtomContainer(IMolecularFormula formula, IAtomContainer atomContainer)
The hydrogens must be implicit.
formula
- IMolecularFormula objectatomContainer
- IAtomContainer to put the new ElementsgetAtomContainer(IMolecularFormula)
public static String[] generateOrderEle()
This begins with the "elements of life" C, H, O, N, (Si, P, S, F, Cl), then continues with the "common" chemical synthesis ingredients, closing off with the tail-end of the periodic table in atom-number order and finally the generic R-group.
@TestMethod(value="testCompare_IMolecularFormula_IMolecularFormula") public static boolean compare(IMolecularFormula formula1, IMolecularFormula formula2)
formula1
- The first IMolecularFormulaformula2
- The second IMolecularFormula@TestMethod(value="testGetHeavyElements_IMolecularFormula") public static List<IElement> getHeavyElements(IMolecularFormula formula)
formula
- The IMolecularFormula@TestMethod(value="testSimplifyMolecularFormula_String") public static String simplifyMolecularFormula(String formula)
formula
- The molecular formula