Package org.openscience.cdk.graph
Class ConnectivityChecker
java.lang.Object
org.openscience.cdk.graph.ConnectivityChecker
Tool class for checking whether the (sub)structure in an
AtomContainer is connected.
To check whether an AtomContainer is connected this code
can be used:
boolean isConnected = ConnectivityChecker.isConnected(atomContainer);
A disconnected AtomContainer can be fragmented into connected fragments by using code like:
IAtomContainerSet fragments = ConnectivityChecker.partitionIntoMolecules(disconnectedContainer); int fragmentCount = fragments.getAtomContainerCount();
- Keywords:
- connectivity
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisConnected(IAtomContainer atomContainer) Check whether a set of atoms in anIAtomContaineris connected.static IAtomContainerSetpartitionIntoMolecules(IAtomContainer container) Partitions the atoms in an AtomContainer into covalently connected components.static IAtomContainerSetpartitionIntoMolecules(IAtomContainer container, boolean ignoreMulticenterBonds, boolean ignoreComponentGrouping) Partitions the atoms in an AtomContainer into covalently connected components.static IAtomContainerSetpartitionIntoMolecules(IAtomContainer container, int[] components) Split a molecule based on the provided component array.
-
Constructor Details
-
ConnectivityChecker
public ConnectivityChecker()
-
-
Method Details
-
isConnected
Check whether a set of atoms in anIAtomContaineris connected.- Parameters:
atomContainer- TheIAtomContainerto be check for connectedness- Returns:
- true if the
IAtomContaineris connected
-
partitionIntoMolecules
Partitions the atoms in an AtomContainer into covalently connected components. This function ignores and variable/multi attachment bonds and any explicit component grouping giving you strictly connected components in a graph-theoretic sense.- Parameters:
container- The AtomContainer to be partitioned into connected components, i.e. molecules- Returns:
- The set of molecules
- Dictionary pointer(s):
- graphPartitioning in the Blue Obelisk Chemoinformatics Dictionary [blue-obelisk:graphPartitioning]
-
partitionIntoMolecules
public static IAtomContainerSet partitionIntoMolecules(IAtomContainer container, boolean ignoreMulticenterBonds, boolean ignoreComponentGrouping) Partitions the atoms in an AtomContainer into covalently connected components. This function lets you specify if you should ignore variable/multi attachment bonds and any explicit component grouping. When both of these properties are ignored the splitting is considered strict. The table below summarises what the outputs are when using CXSMILES to specify variable attachment and component grouping.No. Strict Components No. Loose Components SMILES 2 2 c1ccccc1.Cl
2 1 c1ccccc1.*Cl |m:6:0.1.2.3.4.5|
4 2 c1ccccc1.*Cl.n1ccccc1.*Br |m:6:0.1.2.3.4.5,14:8.9.10.11.12.13|
2 1 c1ccccc1[O-].[Na+]>> |f:0.1|
5 2 c1ccccc1[O-].[Na+]>[K+].[K+].[O-]C(=O)[O-]> |f:0.1,2.3.4|
- Parameters:
container- The AtomContainer to be partitioned into connected components, i.e. moleculesignoreMulticenterBonds- ignore any positional/multi-attach bonds specified as SgroupsignoreComponentGrouping- ignore any explicit grouping specified by the group id stored inCDKConstants.REACTION_GROUPon atoms- Returns:
- The set of molecules
- Dictionary pointer(s):
- graphPartitioning in the Blue Obelisk Chemoinformatics Dictionary [blue-obelisk:graphPartitioning]
-
partitionIntoMolecules
Split a molecule based on the provided component array. Note this function can also be used to split a single molecule, breaking bonds and distributing stereochemistry as needed.- Parameters:
container- the containercomponents- the components- Returns:
- the partitioned set
-