$darkmode
DENOPTIM
BridgeHeadFindingRule.java
Go to the documentation of this file.
1package denoptim.fragmenter;
2
3import java.util.HashMap;
4import java.util.List;
5import java.util.Map;
6import java.util.logging.Level;
7import java.util.logging.Logger;
8
9import org.openscience.cdk.interfaces.IAtom;
10import org.openscience.cdk.interfaces.IAtomContainer;
11import org.openscience.cdk.isomorphism.Mappings;
12
13import denoptim.constants.DENOPTIMConstants;
14import denoptim.exception.DENOPTIMException;
15import denoptim.graph.APClass;
16import denoptim.utils.ManySMARTSQuery;
17import denoptim.utils.MoleculeUtils;
18
26{
31 private String ruleName;
32
36 private String smarts;
37
42 private int[] bridgeHeadPositions;
43
49 private int[] allowedBridgeLength;
50
55 private int lengthInAtoms;
56
57
58//------------------------------------------------------------------------------
59
70 public BridgeHeadFindingRule(String name, String smarts,
72 int lengthInAtoms)
73 {
74 this.ruleName = name;
75 this.smarts = smarts;
76 this.bridgeHeadPositions = bridgeHeadPositions;
77 this.allowedBridgeLength = allowedBridgeLength;
78 this.lengthInAtoms = lengthInAtoms;
79 }
80
81//------------------------------------------------------------------------------
82
86 public String getName()
87 {
88 return ruleName;
89 }
90
91//------------------------------------------------------------------------------
92
96 public String getSMARTS()
97 {
98 return smarts;
99 }
100
101//------------------------------------------------------------------------------
102
108 {
109 return bridgeHeadPositions;
110 }
111
112//------------------------------------------------------------------------------
113
120 {
121 return allowedBridgeLength;
122 }
123
124 //------------------------------------------------------------------------------
125
134 public int[] getAllowedBridgeLength(int maxRingSize)
135 {
136 if (allowedBridgeLength!=null)
137 return allowedBridgeLength;
138
139 // Any bridge length is allowed
140 int[] anyLength = new int[maxRingSize - lengthInAtoms];
141 for (int i=1; i<anyLength.length; i++) {
142 anyLength[i-1] = i;
143 }
144 return anyLength;
145 }
146
147//------------------------------------------------------------------------------
148
155 {
156 return lengthInAtoms;
157 }
158
159//------------------------------------------------------------------------------
160
161}
SMARTS-based rules to identify potential bridge head atoms for ring fusion operations.
int lengthInAtoms
Number of atoms in the existing bridge connecting the bridge-head atoms, including the bridge-head at...
BridgeHeadFindingRule(String name, String smarts, int[] bridgeHeadPositions, int[] allowedBridgeLength, int lengthInAtoms)
Constructs a new rule defined by the given arguments.
String smarts
SMARTS query matching the substructure of interest.
int[] bridgeHeadPositions
The indexes of the atoms that can be bridge head in the matches substructure.
int[] allowedBridgeLength
Allowed bridge length in number of atoms.
String getName()
Returns the name of this rule.