Class ScaffoldNetwork
java.lang.Object
org.openscience.cdk.tools.scaffold.ScaffoldNodeCollectionBase
org.openscience.cdk.tools.scaffold.ScaffoldNetwork
Top-level class to organise the NetworkNodes
A network can have several roots and leaves.
- Version:
- 1.0.2.1
- Author:
- Julian Zander, Jonas Schaub (zanderjulian@gmx.de, jonas.schaub@uni-jena.de)
-
Field Summary
Fields inherited from class org.openscience.cdk.tools.scaffold.ScaffoldNodeCollectionBase
levelMap, NODE_MAPS_INIT_CAPACITY, NODE_MAPS_LOAD_FACTOR, nodeCounter, nodeMap, reverseNodeMap, smilesGenerator, smilesMap
-
Constructor Summary
ConstructorsConstructorDescriptionDefault ConstructorScaffoldNetwork
(org.openscience.cdk.smiles.SmilesGenerator aSmilesGenerator) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNode
(ScaffoldNodeBase aNode) Add a node to the graph structure.Integer[][]
Outputs an adjacency matrix in which the parent node of each node is marked with 1.getRoots()
Outputs root nodes of the network.void
mergeNetwork
(ScaffoldNetwork aScaffoldNetwork) Adds another ScaffoldNetwork to the existing one.void
removeNode
(ScaffoldNodeBase aNode) Removes a node.void
Updates the assignment of nodes to levels in the level map by iterating over all nodes and enquiring their levels.Methods inherited from class org.openscience.cdk.tools.scaffold.ScaffoldNodeCollectionBase
addNodeToCollections, containsMolecule, containsNode, getAllNodes, getAllNodesOnLevel, getMatrixNode, getMatrixNodes, getMatrixNodesNumbers, getMaxLevel, getNode
-
Constructor Details
-
ScaffoldNetwork
public ScaffoldNetwork(org.openscience.cdk.smiles.SmilesGenerator aSmilesGenerator) Constructor- Parameters:
aSmilesGenerator
- Used SMILES Generator
-
ScaffoldNetwork
public ScaffoldNetwork()Default Constructor
-
-
Method Details
-
addNode
public void addNode(ScaffoldNodeBase aNode) throws org.openscience.cdk.exception.CDKException, IllegalArgumentException, NullPointerException Add a node to the graph structure. The same node can also be added several times. It may therefore be necessary to check whether the node already exists. See containsMolecule(); Description copied fromScaffoldNodeCollectionBase
.- Specified by:
addNode
in classScaffoldNodeCollectionBase
- Parameters:
aNode
- Node to be added. Must match the scaffold node collection type. For example, a ScaffoldTree requires a TreeNode.- Throws:
org.openscience.cdk.exception.CDKException
- In case of a problem with the SmilesGeneratorIllegalArgumentException
- if the node does not match the scaffold node collection typeNullPointerException
- if parameter is null
-
updateLevelMap
public void updateLevelMap()Updates the assignment of nodes to levels in the level map by iterating over all nodes and enquiring their levels. To be used after the merging of another network and internally after the addition of another node. -
removeNode
public void removeNode(ScaffoldNodeBase aNode) throws org.openscience.cdk.exception.CDKException, IllegalArgumentException, NullPointerException Removes a node. This does not change the order. The numbering does not change. Description copied fromScaffoldNodeCollectionBase
.- Specified by:
removeNode
in classScaffoldNodeCollectionBase
- Parameters:
aNode
- Node to remove. Must match the scaffold node collection type. For example, a ScaffoldTree requires a TreeNode.- Throws:
org.openscience.cdk.exception.CDKException
- In case of a problem with the SmilesGeneratorIllegalArgumentException
- if the node is not in the scaffold node collectionNullPointerException
- if parameter is null
-
mergeNetwork
public void mergeNetwork(ScaffoldNetwork aScaffoldNetwork) throws org.openscience.cdk.exception.CDKException Adds another ScaffoldNetwork to the existing one. The new network is inserted at the node that both networks have in common. All children of the new network at this node and there linkages are taken over if they do not already exist. The new network is simply taken over if the existing network is empty. If there is no match between the two networks the new network is inserted without linkages. If a molecule generates an empty scaffold, it is stored as a node with empty SMILES and is treated normally. All other empty nodes are then added to this network accordingly. By querying the origins of this node, all molecules that do not produce a scaffold can be returned.- Parameters:
aScaffoldNetwork
- network to be inserted into the existing ScaffoldNetwork.- Throws:
org.openscience.cdk.exception.CDKException
- In case of a problem with the SmilesGenerator
-
getMatrix
Outputs an adjacency matrix in which the parent node of each node is marked with 1. All others are marked with 0. Each row and column number in the matrix is assigned to a node. The assignment can be requested with getMatrixNodes/getMatrixNode. Description copied fromScaffoldNodeCollectionBase
.- Specified by:
getMatrix
in classScaffoldNodeCollectionBase
- Returns:
- the adjacency matrix
- Throws:
IllegalStateException
- if the tree is not connected
-
getRoots
Outputs root nodes of the network.- Returns:
- root nodes of the network
-