public class MolecularFormulaManipulator extends Object
IMolecularFormula's. For example:| Constructor and Description |
|---|
MolecularFormulaManipulator() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
adjustProtonation(IMolecularFormula mf,
int hcnt)
Adjust the protonation of a molecular formula.
|
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 IAtomContainer |
getAtomContainer(String formulaString,
IChemObjectBuilder builder)
Converts a formula string (like "C2H4") into an atom container with atoms
but no bonds.
|
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 int |
getElementCount(IMolecularFormula formula,
IIsotope isotope)
Occurrences of a given element from an isotope in a molecular formula.
|
static int |
getElementCount(IMolecularFormula formula,
String symbol)
Occurrences of a given element in a molecular formula.
|
static List<IElement> |
getHeavyElements(IMolecularFormula formula)
Returns a set of nodes excluding all the hydrogens.
|
static String |
getHillString(IMolecularFormula formula)
Deprecated.
|
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 String |
getHTML(IMolecularFormula formula,
String[] orderElements,
boolean showCharge,
boolean showIsotopes)
Returns the string representation of the molecule formula with numbers
wrapped in <sub></sub> tags and the isotope of each Element
in <sup></sup> tags and the total showCharge 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,
boolean setOne,
boolean setMassNumber)
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 String |
getString(IMolecularFormula formula,
String[] orderElements,
boolean setOne,
boolean setMassNumber)
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.
|
public static int getAtomCount(IMolecularFormula formula)
formula - The MolecularFormula to checkpublic static int getElementCount(IMolecularFormula formula, IElement element)
formula - The MolecularFormula to checkelement - The IElement objectpublic static int getElementCount(IMolecularFormula formula, IIsotope isotope)
formula - the formulaisotope - isotope of an elementgetElementCount(IMolecularFormula, IElement)public static int getElementCount(IMolecularFormula formula, String symbol)
formula - the formulasymbol - element symbol (e.g. C for carbon)getElementCount(IMolecularFormula, IElement)public static List<IIsotope> getIsotopes(IMolecularFormula formula, IElement element)
formula - The MolecularFormula to checkelement - The IElement objectpublic static List<IElement> elements(IMolecularFormula formula)
formula - The MolecularFormula to checkpublic static boolean containsElement(IMolecularFormula formula, IElement element)
formula - IMolecularFormula molecularFormulaelement - The element this MolecularFormula is searched forpublic static IMolecularFormula removeElement(IMolecularFormula formula, IElement element)
formula - IMolecularFormula molecularFormulaelement - The IElement of the IIsotopes to be removedpublic 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()public static String getString(IMolecularFormula formula, String[] orderElements, boolean setOne, boolean setMassNumber)
formula - The IMolecularFormula ObjectorderElements - The order of ElementssetOne - True, when must be set the value 1 for elements with
one atomsetMassNumber - If the formula contains an isotope of an element that is the
non-major isotope, the element is represented as [XE] where
X is the mass number and E is the element symbolgetHTML(IMolecularFormula),
generateOrderEle(),
generateOrderEle_Hill_NoCarbons(),
generateOrderEle_Hill_WithCarbons()public static String getString(IMolecularFormula formula)
formula - The IMolecularFormula ObjectgetHTML(IMolecularFormula)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 String getString(IMolecularFormula formula, boolean setOne, boolean setMassNumber)
formula - The IMolecularFormula ObjectsetOne - True, when must be set the value 1 for elements with
one atomsetMassNumber - If the formula contains an isotope of an element that is the
non-major isotope, the element is represented as [XE] where
X is the mass number and E is the element symbolgetHTML(IMolecularFormula)public static List<IIsotope> putInOrder(String[] orderElements, IMolecularFormula formula)
@Deprecated public static String getHillString(IMolecularFormula formula)
getString(org.openscience.cdk.interfaces.IMolecularFormula)public static String getHTML(IMolecularFormula formula)
formula - The IMolecularFormula objectgetHTML(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)public static String getHTML(IMolecularFormula formula, String[] orderElements, boolean showCharge, boolean showIsotopes)
formula - The IMolecularFormula objectorderElements - The order of ElementsshowCharge - True, If it has to show the showChargeshowIsotopes - True, If it has to show the Isotope massgetHTML(IMolecularFormula)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)public static IMolecularFormula getMajorIsotopeMolecularFormula(String stringMF, IChemObjectBuilder builder)
stringMF - The molecularFormula stringbuilder - a IChemObjectBuilder which is used to construct atomsgetMolecularFormula(String,IMolecularFormula)public static IMolecularFormula getMolecularFormula(String stringMF, IMolecularFormula formula)
The hydrogens must be implicit.
stringMF - The molecularFormula stringgetMolecularFormula(String, IChemObjectBuilder)public static double getTotalExactMass(IMolecularFormula formula)
formula - The IMolecularFormula to calculatepublic static double getTotalMassNumber(IMolecularFormula formula)
formula - The IMolecularFormula to calculatepublic static double getNaturalExactMass(IMolecularFormula formula)
formula - The IMolecularFormula to calculatepublic static double getMajorIsotopeMass(IMolecularFormula formula)
formula - The IMolecularFormula to calculatepublic static double getTotalNaturalAbundance(IMolecularFormula formula)
formula - The IMolecularFormula to calculatepublic static double getDBE(IMolecularFormula formula) throws CDKException
formula - The IMolecularFormula to calculateCDKException - if DBE cannot be be evaluatedpublic static IMolecularFormula getMolecularFormula(IAtomContainer atomContainer)
The hydrogens must be implicit.
atomContainer - IAtomContainer objectgetMolecularFormula(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)public static IAtomContainer getAtomContainer(IMolecularFormula formula)
The hydrogens must be implicit.
formula - IMolecularFormula objectgetAtomContainer(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 IAtomContainer getAtomContainer(String formulaString, IChemObjectBuilder builder)
formulaString - the formula to convertbuilder - a chem object builderpublic 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.
public static boolean compare(IMolecularFormula formula1, IMolecularFormula formula2)
formula1 - The first IMolecularFormulaformula2 - The second IMolecularFormulapublic static List<IElement> getHeavyElements(IMolecularFormula formula)
formula - The IMolecularFormulapublic static String simplifyMolecularFormula(String formula)
formula - The molecular formulapublic static boolean adjustProtonation(IMolecularFormula mf, int hcnt)
IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("[C6H5O]-", bldr);
MolecularFormulaManipulator.adjustProtonation(mf, +1); // now "C6H6O"
MolecularFormulaManipulator.adjustProtonation(mf, -1); // now "C6H5O-"
The return value indicates whether the protonation could be adjusted:
IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("[Cl]-", bldr);
MolecularFormulaManipulator.adjustProtonation(mf, +0); // false still "[Cl]-"
MolecularFormulaManipulator.adjustProtonation(mf, +1); // true now "HCl"
MolecularFormulaManipulator.adjustProtonation(mf, -1); // true now "[Cl]-" (again)
MolecularFormulaManipulator.adjustProtonation(mf, -1); // false still "[Cl]-" (no H to remove!)
The method tries to select an existing hydrogen isotope to augment. If no hydrogen isotopes are found
a new major isotope (1H) is created.mf - molecular formulahcnt - the number of hydrogens to add/remove, (>0 protonate:, <0: deprotonate)Copyright © 2018. All Rights Reserved.