Class ConnectivityChecker

java.lang.Object
org.openscience.cdk.graph.ConnectivityChecker

public class ConnectivityChecker extends Object
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 Details

    • ConnectivityChecker

      public ConnectivityChecker()
  • Method Details

    • isConnected

      public static boolean isConnected(IAtomContainer atomContainer)
      Check whether a set of atoms in an IAtomContainer is connected.
      Parameters:
      atomContainer - The IAtomContainer to be check for connectedness
      Returns:
      true if the IAtomContainer is connected
    • partitionIntoMolecules

      public static IAtomContainerSet partitionIntoMolecules(IAtomContainer container)
      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 ComponentsNo. Loose ComponentsSMILES
      22
      c1ccccc1.Cl
      21
      c1ccccc1.*Cl |m:6:0.1.2.3.4.5|
      42
      c1ccccc1.*Cl.n1ccccc1.*Br |m:6:0.1.2.3.4.5,14:8.9.10.11.12.13|
      21
      c1ccccc1[O-].[Na+]>> |f:0.1|
      52
      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. molecules
      ignoreMulticenterBonds - ignore any positional/multi-attach bonds specified as Sgroups
      ignoreComponentGrouping - ignore any explicit grouping specified by the group id stored in CDKConstants.REACTION_GROUP on atoms
      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, int[] components)
      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 container
      components - the components
      Returns:
      the partitioned set