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:

   MoleculeSet fragments = ConnectivityChecker.partitionIntoMolecules(disconnectedContainer);
   int fragmentCount = fragments.getAtomContainerCount();
 
Source code:
main
Belongs to CDK module:
standard
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.
      Parameters:
      container - The AtomContainer to be partitioned into connected components, i.e. molecules
      Returns:
      A MoleculeSet.
      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