Package org.openscience.cdk.ringsearch
Class AllRingsFinder
java.lang.Object
org.openscience.cdk.ringsearch.AllRingsFinder
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 } }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The threshold values provide a limit at which the computation stops. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using a threshold ofAllRingsFinder.Threshold.PubChem_99
.AllRingsFinder
(boolean logging) Deprecated.turn logging off by setting the level in the logger implementation -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.timeout not usedfindAllRings
(IAtomContainer container) Compute all rings in the givenIAtomContainer
.findAllRings
(IAtomContainer container, int maxRingSize) Compute all rings up to and including the maxRingSize.findAllRingsInIsolatedRingSystem
(IAtomContainer container) Compute all rings in the givenIAtomContainer
.findAllRingsInIsolatedRingSystem
(IAtomContainer atomContainer, int maxRingSize) Compute all rings up to an including the maxRingSize.long
Deprecated.timeout not usedsetTimeout
(long timeout) Deprecated.use the new threshold (during construction)static AllRingsFinder
usingThreshold
(AllRingsFinder.Threshold threshold) Create anAllRingsFinder
instance using the given threshold.
-
Constructor Details
-
AllRingsFinder
Deprecated.turn logging off by setting the level in the logger implementationConstructor for the AllRingsFinder.- Parameters:
logging
- true=logging will be done (slower), false = no logging.
-
AllRingsFinder
public AllRingsFinder()Default constructor using a threshold ofAllRingsFinder.Threshold.PubChem_99
.
-
-
Method Details
-
findAllRings
Compute all rings in the givenIAtomContainer
. The container is first partitioned into ring systems which are then processed separately. If the molecule has already be partitioned, consider usingfindAllRingsInIsolatedRingSystem(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
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 usingfindAllRingsInIsolatedRingSystem(IAtomContainer, int)
.- Parameters:
container
- The AtomContainer to be searched for ringsmaxRingSize
- 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
Compute all rings in the givenIAtomContainer
. 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 ringsmaxRingSize
- 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.timeout not usedChecks 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.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.timeout not usedGets the timeout values in milliseconds of the AllRingsFinder object- Returns:
- The timeout value
-
usingThreshold
Create anAllRingsFinder
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
-