public class AtomContainerManipulator extends Object
AtomContainerManipulator.replaceAtomByAtom(container, atom1, atom2);will replace the Atom in the AtomContainer, but in all the ElectronContainer's it participates too.
Constructor and Description |
---|
AtomContainerManipulator() |
Modifier and Type | Method and Description |
---|---|
static IAtomContainer |
anonymise(IAtomContainer src)
Anonymise the provided container to single-bonded carbon atoms.
|
static void |
clearAtomConfigurations(IAtomContainer container)
This method will reset all atom configuration to UNSET.
|
static void |
convertImplicitToExplicitHydrogens(IAtomContainer atomContainer)
Adds explicit hydrogens (without coordinates) to the IAtomContainer,
equaling the number of set implicit hydrogens.
|
static IAtomContainer |
copyAndSuppressedHydrogens(IAtomContainer org)
Copy the input container and suppress any explicit hydrogens.
|
static int |
countExplicitHydrogens(IAtomContainer atomContainer,
IAtom atom)
Count explicit hydrogens.
|
static int |
countHydrogens(IAtomContainer atomContainer,
IAtom atom) |
static IAtomContainer |
createAllCarbonAllSingleNonAromaticBondAtomContainer(IAtomContainer atomContainer)
Deprecated.
not all attributes are removed producing unexpected results, use
anonymise(org.openscience.cdk.interfaces.IAtomContainer) |
static IAtomContainer |
extractSubstructure(IAtomContainer atomContainer,
int... atomIndices)
Extract a substructure from an atom container, in the form of a new
cloned atom container with only the atoms with indices in atomIndices and
bonds that connect these atoms.
|
static List<String> |
getAllIDs(IAtomContainer mol) |
static IAtom[] |
getAtomArray(IAtomContainer container)
Constructs an array of Atom objects from an AtomContainer.
|
static IAtom[] |
getAtomArray(List<IAtom> list)
Constructs an array of Atom objects from a List of Atom objects.
|
static IAtom |
getAtomById(IAtomContainer ac,
String id)
Returns an atom in an atomcontainer identified by id
|
static IBond[] |
getBondArray(IAtomContainer container)
Constructs an array of Bond objects from an AtomContainer.
|
static IBond[] |
getBondArray(List<IBond> list)
Constructs an array of Atom objects from a List of Atom objects.
|
static double |
getBondOrderSum(IAtomContainer container,
IAtom atom)
Returns the sum of the bond order equivalents for a given IAtom.
|
static IElectronContainer[] |
getElectronContainerArray(IAtomContainer container)
Constructs an array of Bond objects from an AtomContainer.
|
static IElectronContainer[] |
getElectronContainerArray(List<IElectronContainer> list)
Constructs an array of Atom objects from a List of Atom objects.
|
static List<IAtom> |
getHeavyAtoms(IAtomContainer container)
Returns a set of nodes excluding all the hydrogens.
|
static int |
getImplicitHydrogenCount(IAtomContainer container)
Counts the number of implicit hydrogens on the provided IAtomContainer.
|
static IAtomContainer |
getIntersection(IAtomContainer container1,
IAtomContainer container2)
Compares this AtomContainer with another given AtomContainer and returns
the Intersection between them.
|
static IBond.Order |
getMaximumBondOrder(IAtomContainer container) |
static double |
getMolecularWeight(IAtomContainer mol)
Calculate the molecular weight of a molecule.
|
static double |
getNaturalExactMass(IAtomContainer atomContainer)
Returns the molecular mass of the IAtomContainer.
|
static int |
getSingleBondEquivalentSum(IAtomContainer container)
Returns the sum of bond orders, where a single bond counts as one
single bond equivalent, a double as two, etc.
|
static double |
getTotalCharge(IAtomContainer atomContainer)
Get the summed charge of all atoms in an AtomContainer
|
static double |
getTotalExactMass(IAtomContainer atomContainer)
Get the summed exact mass of all atoms in an AtomContainer.
|
static int |
getTotalFormalCharge(IAtomContainer atomContainer)
Get the total formal charge on a molecule.
|
static int |
getTotalHydrogenCount(IAtomContainer container)
Counts the number of hydrogens on the provided IAtomContainer.
|
static double |
getTotalNaturalAbundance(IAtomContainer atomContainer)
Get the summed natural abundance of all atoms in an AtomContainer
|
static int |
getTotalNegativeFormalCharge(IAtomContainer atomContainer)
Get the total formal negative charge on a molecule.
|
static int |
getTotalPositiveFormalCharge(IAtomContainer atomContainer)
Get the total positive formal charge on a molecule.
|
static void |
percieveAtomTypesAndConfigureAtoms(IAtomContainer container)
Convenience method to perceive atom types for all
IAtom s in the
IAtomContainer , using the CDKAtomTypeMatcher . |
static void |
percieveAtomTypesAndConfigureUnsetProperties(IAtomContainer container)
Convenience method to perceive atom types for all
IAtom s in the
IAtomContainer , using the CDKAtomTypeMatcher . |
static IAtomContainer |
removeHydrogens(IAtomContainer org)
Create an copy of the
org structure with explicit hydrogens
removed. |
static IAtomContainer |
removeHydrogensPreserveMultiplyBonded(IAtomContainer ac)
Deprecated.
suppressHydrogens(org.openscience.cdk.interfaces.IAtomContainer) will now not removed bridging hydrogens by default |
static IAtomContainer |
removeNonChiralHydrogens(IAtomContainer org)
Produces an AtomContainer without explicit non stereo-relevant Hs but with H count from one with Hs.
|
static boolean |
replaceAtomByAtom(IAtomContainer container,
IAtom oldAtom,
IAtom newAtom)
Substitute one atom in a container for another adjusting bonds, single electrons, lone pairs, and stereochemistry
as required.
|
static void |
setAtomProperties(IAtomContainer container,
Object propKey,
Object propVal)
Sets a property on all
Atom s in the given container. |
static IAtomContainer |
setSingleOrDoubleFlags(IAtomContainer ac)
Assigns
CDKConstants.SINGLE_OR_DOUBLE flags to the bonds of
a container. |
static IAtomContainer |
skeleton(IAtomContainer src)
Create a skeleton copy of the provided structure.
|
static IAtomContainer |
suppressHydrogens(IAtomContainer org)
Suppress any explicit hydrogens in the provided container.
|
static void |
unregisterAtomListeners(IAtomContainer container)
A method to remove AtomListeners.
|
static void |
unregisterElectronContainerListeners(IAtomContainer container)
A method to remove ElectronContainerListeners.
|
public static IAtomContainer extractSubstructure(IAtomContainer atomContainer, int... atomIndices) throws CloneNotSupportedException
atomContainer
- the source container to extract fromatomIndices
- the indices of the substructureCloneNotSupportedException
- if the source container cannot be clonedpublic static IAtom getAtomById(IAtomContainer ac, String id) throws CDKException
ac
- The AtomContainer to search inid
- The id to search forCDKException
- There is no such atompublic static boolean replaceAtomByAtom(IAtomContainer container, IAtom oldAtom, IAtom newAtom)
container
- the container to replace the atom ofoldAtom
- the atom to replacenewAtom
- the atom to insertpublic static double getTotalCharge(IAtomContainer atomContainer)
atomContainer
- The IAtomContainer to manipulatepublic static double getTotalExactMass(IAtomContainer atomContainer)
IsotopeFactory
, or use the
MolecularFormulaManipulator.getMajorIsotopeMass(org.openscience.cdk.interfaces.IMolecularFormula)
method, after converting the IAtomContainer
to a
IMolecularFormula
with the MolecularFormulaManipulator
.atomContainer
- The IAtomContainer to manipulategetMolecularWeight(IAtomContainer)
public static double getNaturalExactMass(IAtomContainer atomContainer)
atomContainer
- getMolecularWeight(IAtomContainer)
public static double getMolecularWeight(IAtomContainer mol)
mol
- the moleculepublic static double getTotalNaturalAbundance(IAtomContainer atomContainer)
atomContainer
- The IAtomContainer to manipulatepublic static int getTotalFormalCharge(IAtomContainer atomContainer)
atomContainer
- the atom container to considerpublic static int getTotalNegativeFormalCharge(IAtomContainer atomContainer)
atomContainer
- the atom container to considerpublic static int getTotalPositiveFormalCharge(IAtomContainer atomContainer)
atomContainer
- the atom container to considerpublic static int getTotalHydrogenCount(IAtomContainer container)
percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
).container
- the container to count the hydrogens onIllegalArgumentException
- if the provided container was nullIAtom.getImplicitHydrogenCount()
,
percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
public static int getImplicitHydrogenCount(IAtomContainer container)
percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
).container
- the container to count the implicit hydrogens onIllegalArgumentException
- if the provided container was nullIAtom.getImplicitHydrogenCount()
,
percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
public static int countExplicitHydrogens(IAtomContainer atomContainer, IAtom atom)
atomContainer
- the atom container to considerIllegalArgumentException
- if either the container or atom were nullpublic static void convertImplicitToExplicitHydrogens(IAtomContainer atomContainer)
atomContainer
- the atom container to considerpublic static int countHydrogens(IAtomContainer atomContainer, IAtom atom)
public static List<String> getAllIDs(IAtomContainer mol)
public static IAtomContainer removeNonChiralHydrogens(IAtomContainer org)
org
- The AtomContainer from which to remove the hydrogenspublic static IAtomContainer copyAndSuppressedHydrogens(IAtomContainer org)
suppressHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
.org
- the container from which to remove hydrogenssuppressHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
public static IAtomContainer suppressHydrogens(IAtomContainer org)
copyAndSuppressedHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
if you would to preserve
the old instance.org
- the container from which to remove hydrogenscopyAndSuppressedHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
public static IAtomContainer removeHydrogens(IAtomContainer org)
org
structure with explicit hydrogens
removed. Stereochemistry is updated but up and down bonds in a depiction
may need to be recalculated (see. StructureDiagramGenerator).org
- The AtomContainer from which to remove the hydrogenscopyAndSuppressedHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
@Deprecated public static IAtomContainer removeHydrogensPreserveMultiplyBonded(IAtomContainer ac)
suppressHydrogens(org.openscience.cdk.interfaces.IAtomContainer)
will now not removed bridging hydrogens by defaultpublic static void setAtomProperties(IAtomContainer container, Object propKey, Object propVal)
Atom
s in the given container.public static void unregisterElectronContainerListeners(IAtomContainer container)
public static void unregisterAtomListeners(IAtomContainer container)
public static IAtomContainer getIntersection(IAtomContainer container1, IAtomContainer container2)
Important Note : This is not the maximum common substructure.
container1
- an AtomContainer objectcontainer2
- an AtomContainer objectpublic static IAtom[] getAtomArray(IAtomContainer container)
container
- The original AtomContainer.public static IAtom[] getAtomArray(List<IAtom> list)
list
- The original List.public static IBond[] getBondArray(IAtomContainer container)
container
- The original AtomContainer.public static IBond[] getBondArray(List<IBond> list)
list
- The original List.public static IElectronContainer[] getElectronContainerArray(IAtomContainer container)
container
- The original AtomContainer.public static IElectronContainer[] getElectronContainerArray(List<IElectronContainer> list)
list
- The original List.public static void percieveAtomTypesAndConfigureAtoms(IAtomContainer container) throws CDKException
IAtom
s in the
IAtomContainer
, using the CDKAtomTypeMatcher
. If the
matcher finds a matching atom type, the IAtom
will be configured
to have the same properties as the IAtomType
. If no matching atom
type is found, no configuration is performed.
This method overwrites existing values.container
- CDKException
public static void percieveAtomTypesAndConfigureUnsetProperties(IAtomContainer container) throws CDKException
IAtom
s in the
IAtomContainer
, using the CDKAtomTypeMatcher
. If the
matcher finds a matching atom type, the IAtom
will be configured
to have the same properties as the IAtomType
. If no matching atom
type is found, no configuration is performed.
This method overwrites existing values.container
- CDKException
public static void clearAtomConfigurations(IAtomContainer container)
percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
and after a call to this method all atoms will be "unconfigured".
Note that it is not a complete reversal of percieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
since the atomic symbol of the atoms remains unchanged. Also, all the flags that were set
by the configuration method (such as IS_HYDROGENBOND_ACCEPTOR or ISAROMATIC) will be set to False.container
- The molecule, whose atoms are to be unconfiguredpercieveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IAtomContainer)
public static int getSingleBondEquivalentSum(IAtomContainer container)
public static IBond.Order getMaximumBondOrder(IAtomContainer container)
public static List<IAtom> getHeavyAtoms(IAtomContainer container)
public static IAtomContainer createAllCarbonAllSingleNonAromaticBondAtomContainer(IAtomContainer atomContainer) throws CloneNotSupportedException
anonymise(org.openscience.cdk.interfaces.IAtomContainer)
atomContainer
- The input atomcontainerCloneNotSupportedException
- The atomcontainer cannot be clonedpublic static IAtomContainer anonymise(IAtomContainer src)
src
- an atom containerpublic static IAtomContainer skeleton(IAtomContainer src)
anonymise(org.openscience.cdk.interfaces.IAtomContainer)
) except that atom
elements are preserved. All bonds are converted to single bonds and a
'clean' atom is created for the input elements. The 'clean' atom has
unset charge, mass, and hydrogen count.src
- input structurepublic static double getBondOrderSum(IAtomContainer container, IAtom atom)
atom
- The atom for which to calculate the bond order sumpublic static IAtomContainer setSingleOrDoubleFlags(IAtomContainer ac)
CDKConstants.SINGLE_OR_DOUBLE
flags to the bonds of
a container. The single or double flag indicates uncertainty of bond
order and in this case is assigned to all aromatic bonds (and atoms)
which occur in rings. If any such bonds are found the flag is also set
on the container.
SmilesParser parser = new SmilesParser(...); parser.setPreservingAromaticity(true); IAtomContainer biphenyl = parser.parseSmiles("c1cccc(c1)c1ccccc1"); AtomContainerManipulator.setSingleOrDoubleFlags(biphenyl);
ac
- container to which the flags are assignedCopyright © 2018. All Rights Reserved.