public final class RingSearch extends Object
// construct the search for a given molecule, if an adjacency list // representation (int[][]) is available this can be passed to the // constructor for improved performance IAtomContainer container = ...; RingSearch ringSearch = new RingSearch(container); // indices of cyclic vertices int[] cyclic = ringSearch.cyclic(); // iterate over fused systems (atom indices) for(int[] fused : ringSearch.fused()){ ... } // iterate over isolated rings (atom indices) for(int[] isolated : ringSearch.isolated()){ ... } // convenience methods for getting the fragments IAtomContainer cyclic = ringSearch.ringFragments(); for(IAtomContainer fragment : ringSearch.fusedRingFragments()){ .... } for(IAtomContainer fragment : ringSearch.isolatedRingFragments()){ .... }
SpanningTree
,
SSSRFinder
,
AllRingsFinder
,
CyclicVertexSearch
Constructor and Description |
---|
RingSearch(IAtomContainer container)
Create a new RingSearch for the specified container.
|
RingSearch(IAtomContainer container,
CyclicVertexSearch searcher)
Create a new RingSearch for the specified container using the provided
search.
|
RingSearch(IAtomContainer container,
int[][] graph)
Create a new RingSearch for the specified container and graph.
|
Modifier and Type | Method and Description |
---|---|
int[] |
cyclic()
Construct a set of vertices which belong to any cycle (ring).
|
boolean |
cyclic(IAtom atom)
Determine whether the provided atom belongs to a ring (is cyclic).
|
boolean |
cyclic(IBond bond)
Determine whether the bond is cyclic.
|
boolean |
cyclic(int i)
Determine whether the vertex at index i is a cyclic vertex.
|
boolean |
cyclic(int u,
int v)
Determine whether the edge between the vertices u and v is
cyclic.
|
int[][] |
fused()
Construct the sets of vertices which belong to fused ring systems.
|
List<IAtomContainer> |
fusedRingFragments()
Construct a list of
IAtomContainer s which only contain fused
rings. |
int[][] |
isolated()
Construct the sets of vertices which belong to isolated rings.
|
List<IAtomContainer> |
isolatedRingFragments()
Construct a list of
IAtomContainer s each of which only contains a
single isolated ring. |
int |
numRings()
Access the number of rings found (aka.
|
IAtomContainer |
ringFragments()
Extract the cyclic atom and bond fragments of the container.
|
public RingSearch(IAtomContainer container)
container
- non-null input structureNullPointerException
- if the container was nullIllegalArgumentException
- if the container contains a bond which
references an atom which could not be
foundpublic RingSearch(IAtomContainer container, int[][] graph)
container
- non-null input structuregraph
- non-null adjacency list representation of the containerNullPointerException
- if the container or graph was nullpublic RingSearch(IAtomContainer container, CyclicVertexSearch searcher)
container
- non-null input structuresearcher
- non-null adjacency list representation of the containerNullPointerException
- if the container or searcher was nullpublic int numRings()
public boolean cyclic(int u, int v)
u
- an end point of the edgev
- another end point of the edgepublic boolean cyclic(IAtom atom)
IAtomContainer mol = ...; RingSearch ringSearch = new RingSearch(mol); for(IAtom atom : mol.atoms()){ if(ringSearch.cyclic(atom)){ ... } }
atom
- an atomNoSuchAtomException
- the atom was not foundpublic boolean cyclic(IBond bond)
bond
- a bond of the containerpublic boolean cyclic(int i)
IAtomContainer mol = ...; RingSearch tester = new RingSearch(mol); int n = mol.getAtomCount(); for(int i = 0; i < n; i++){ if(tester.cyclic(i)){ ... } }
i
- atom indexpublic int[] cyclic()
public int[][] isolated()
IAtomContainer biphenyl = ...; RingSearch ringSearch = new RingSearch(biphenyl); int[][] isolated = ringSearch.isolated(); isolated.length; // 2 isolated rings in biphenyl isolated[0].length; // 6 vertices in one benzene isolated[1].length; // 6 vertices in the other benzene
public int[][] fused()
IAtomContainer mol = ...; RingSearch ringSearch = new RingSearch(mol); int[][] fused = ringSearch.fused(); fused.length; // e.g. 3 separate fused ring systems fused[0].length; // e.g. 6 vertices in the first system fused[1].length; // e.g. 10 vertices in the second system fused[2].length; // e.g. 4 vertices in the third system
public IAtomContainer ringFragments()
SpanningTree.getCyclicFragmentsContainer()
public List<IAtomContainer> isolatedRingFragments()
IAtomContainer
s each of which only contains a
single isolated ring. A ring is consider isolated if it does not share
any bonds with another ring. By this definition each ring of a spiro ring
system is considered isolated. The atoms are not arranged
sequential.isolated()
public List<IAtomContainer> fusedRingFragments()
IAtomContainer
s which only contain fused
rings. A ring is consider fused if it shares any bonds with another ring.
By this definition bridged ring systems are also included. The atoms are
not arranged sequential.fused()
Copyright © 2021. All rights reserved.