Package org.openscience.cdk.ringsearch
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. TheAllRingsFinder.Threshold
values have been precomputed on PubChem-Compound and can be used with theusingThreshold(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 Classes Modifier and Type Class Description static class
AllRingsFinder.Threshold
The threshold values provide a limit at which the computation stops.
-
Constructor Summary
Constructors Constructor Description AllRingsFinder()
Default 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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkTimeout()
Deprecated.timeout not usedIRingSet
findAllRings(IAtomContainer container)
Compute all rings in the givenIAtomContainer
.IRingSet
findAllRings(IAtomContainer container, int maxRingSize)
Compute all rings up to and including the maxRingSize.IRingSet
findAllRingsInIsolatedRingSystem(IAtomContainer container)
Compute all rings in the givenIAtomContainer
.IRingSet
findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer, int maxRingSize)
Compute all rings up to an including the maxRingSize.long
getTimeout()
Deprecated.timeout not usedAllRingsFinder
setTimeout(long timeout)
Deprecated.use the new threshold (during construction)static AllRingsFinder
usingThreshold(AllRingsFinder.Threshold threshold)
Create anAllRingsFinder
instance using the given threshold.
-
-
-
Constructor Detail
-
AllRingsFinder
@Deprecated public AllRingsFinder(boolean logging)
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 Detail
-
findAllRings
public IRingSet findAllRings(IAtomContainer container) throws CDKException
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(IAtomContainer, int)
,findAllRingsInIsolatedRingSystem(IAtomContainer)
-
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 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
public IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer container) throws CDKException
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 public void checkTimeout() throws CDKException
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 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 usedGets the timeout values in milliseconds of the AllRingsFinder object- Returns:
- The timeout value
-
usingThreshold
public static AllRingsFinder usingThreshold(AllRingsFinder.Threshold threshold)
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
-
-