Class AllRingsFinder

java.lang.Object
org.openscience.cdk.ringsearch.AllRingsFinder

public final class AllRingsFinder extends Object
Compute the set of all rings in a molecule. This set includes every cyclic path of atoms. As the set is exponential it can be very large and is often impractical (e.g. fullerenes). To avoid combinatorial explosion there is a configurable threshold, at which the computation aborts. The AllRingsFinder.Threshold values have been precomputed on PubChem-Compound and can be used with the usingThreshold(Threshold). Alternatively, other ring sets which are a subset of this set offer a tractable alternative.
 AllRingsFinder arf = new AllRingsFinder();
 for (IAtomContainer m : ms) {
     try {
         IRingSet rs = arf.findAllRings(m);
     } catch (CDKException e) {
         // molecule was too complex, handle error
     }
 }
 
Author:
steinbeck, johnmay
See Also:
Source code:
main
Belongs to CDK module:
standard
Keywords:
rings, all rings
  • Constructor Details

    • AllRingsFinder

      @Deprecated public AllRingsFinder(boolean logging)
      Deprecated.
      turn logging off by setting the level in the logger implementation
      Constructor for the AllRingsFinder.
      Parameters:
      logging - true=logging will be done (slower), false = no logging.
    • AllRingsFinder

      public AllRingsFinder()
      Default constructor using a threshold of AllRingsFinder.Threshold.PubChem_99.
  • Method Details

    • findAllRings

      public IRingSet findAllRings(IAtomContainer container) throws CDKException
      Compute all rings in the given IAtomContainer. The container is first partitioned into ring systems which are then processed separately. If the molecule has already be partitioned, consider using findAllRingsInIsolatedRingSystem(IAtomContainer).
      Parameters:
      container - The AtomContainer to be searched for rings
      Returns:
      A RingSet with all rings in the AtomContainer
      Throws:
      CDKException - An exception thrown if the threshold was exceeded
      See Also:
    • findAllRings

      public IRingSet findAllRings(IAtomContainer container, int maxRingSize) throws CDKException
      Compute all rings up to and including the maxRingSize. The container is first partitioned into ring systems which are then processed separately. If the molecule has already be partitioned, consider using findAllRingsInIsolatedRingSystem(IAtomContainer, int).
      Parameters:
      container - The AtomContainer to be searched for rings
      maxRingSize - Maximum ring size to consider. Provides a possible breakout from recursion for complex compounds.
      Returns:
      A RingSet with all rings in the AtomContainer
      Throws:
      CDKException - An exception thrown if the threshold was exceeded
    • findAllRingsInIsolatedRingSystem

      public IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer container) throws CDKException
      Compute all rings in the given IAtomContainer. No pre-processing is done on the container.
      Parameters:
      container - The Atom Container to find the ring systems of
      Returns:
      RingSet for the container
      Throws:
      CDKException - An exception thrown if the threshold was exceeded
    • findAllRingsInIsolatedRingSystem

      public IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer, int maxRingSize) throws CDKException
      Compute all rings up to an including the maxRingSize. No pre-processing is done on the container.
      Parameters:
      atomContainer - the molecule to be searched for rings
      maxRingSize - Maximum ring size to consider. Provides a possible breakout from recursion for complex compounds.
      Returns:
      a RingSet containing the rings in molecule
      Throws:
      CDKException - An exception thrown if the threshold was exceeded
    • checkTimeout

      @Deprecated public void checkTimeout() throws CDKException
      Deprecated.
      timeout not used
      Checks if the timeout has been reached and throws an exception if so. This is used to prevent this AllRingsFinder to run for ages in certain rare cases with ring systems of large size or special topology.
      Throws:
      CDKException - The exception thrown in case of hitting the timeout
    • setTimeout

      @Deprecated public AllRingsFinder setTimeout(long timeout)
      Deprecated.
      use the new threshold (during construction)
      Sets the timeout value in milliseconds of the AllRingsFinder object This is used to prevent this AllRingsFinder to run for ages in certain rare cases with ring systems of large size or special topology
      Parameters:
      timeout - The new timeout value
      Returns:
      a reference to the instance this method was called for
    • getTimeout

      @Deprecated public long getTimeout()
      Deprecated.
      timeout not used
      Gets the timeout values in milliseconds of the AllRingsFinder object
      Returns:
      The timeout value
    • usingThreshold

      public static AllRingsFinder usingThreshold(AllRingsFinder.Threshold threshold)
      Create an AllRingsFinder instance using the given threshold.
       // import static AllRingsFinder.Threshold.PubChem_99;
       AllRingsFinder arf = AllRingsFinder.usingThreshold(PubChem_99);
       
      Parameters:
      threshold - the threshold value
      Returns:
      instance with the set threshold