Skip to content

Commit daa09be

Browse files
committed
Remove 172 more lines: DEBUG flags, commented code, duplicate annotation
- RuleBasedMappingHandler: remove DEBUG1/DEBUG2 flags + 27 dead blocks (104 lines) - ReactionDecoder: remove DEBUG flag + 2 dead blocks - UnblancedReactionChecker: remove DEBUG flag + 4 dead blocks + unused imports - RXNMappingTest: remove 9 commented-out println lines - Annotator, SMARTS2AAMTest: remove commented debug output - MassNumberRule, AtomicNumberRule: remove commented printStackTrace - EBIArrayList: fix duplicate @SuppressWarnings("unchecked","unchecked") All 135 tests pass. Zero DEBUG flags remain in codebase. Co-Authored-By: Syed Asad Rahman <asad.rahman@bioinceptionlabs.com>
1 parent 96c1bd5 commit daa09be

9 files changed

Lines changed: 1 addition & 172 deletions

File tree

src/main/java/com/bioinceptionlabs/aamtool/Annotator.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ protected static ReactionMechanismTool getReactionMechanismTool(IReaction cdkRea
130130
}
131131
rmt = new ReactionMechanismTool(cdkReaction, reMap, true, false,
132132
complexMappingFlag, accept_no_change, new StandardizeReaction());
133-
// IPatternFingerprinter formedCleavedWFingerprint = rmt
134-
// .getSelectedSolution()
135-
// .getBondChangeCalculator()
136-
// .getFormedCleavedWFingerprint();
137-
// System.out.println("formedCleavedWFingerprint " + formedCleavedWFingerprint);
138133
return rmt;
139134
}
140135

src/main/java/com/bioinceptionlabs/aamtool/ReactionDecoder.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
*/
6464
public class ReactionDecoder extends Annotator {
6565

66-
private final static boolean DEBUG = false;
6766
private static final ILoggingTool LOGGER
6867
= LoggingToolFactory.createLoggingTool(ReactionDecoder.class);
6968

@@ -182,12 +181,6 @@ private void FormatXMLToFile(Document doc, String fileName) throws TransformerCo
182181
transformer.transform(source, result);
183182

184183
out.println("Output is presented in xml format: " + file.getAbsolutePath());
185-
186-
if (DEBUG) {
187-
// Show output on console during development
188-
result = new StreamResult(out);
189-
transformer.transform(source, result);
190-
}
191184
}
192185

193186
private void FormatTextToFile(StringBuilder doc, String fileName) throws UnsupportedEncodingException, FileNotFoundException, IOException {
@@ -197,11 +190,6 @@ private void FormatTextToFile(StringBuilder doc, String fileName) throws Unsuppo
197190
}
198191

199192
out.println("Output is presented in text format: " + file.getAbsolutePath());
200-
201-
if (DEBUG) {
202-
// Show output on console during development
203-
out.println(doc.toString());
204-
}
205193
}
206194

207195
private void AAMTask(CommandLine aamLine, Options createAAMOptions,

src/main/java/com/bioinceptionlabs/centres/priority/AtomicNumberRule.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public int compare(Ligand<A> o1, Ligand<A> o2) {
7575
IAtom b = (IAtom) o2.getAtom();
7676

7777
return getAtomicNumber(a) - getAtomicNumber(b);
78-
79-
// return accessor.getAtomicNumber(o1.getAtom()) - accessor.getAtomicNumber(o2.getAtom());
8078
}
8179

8280
public int getAtomicNumber(IAtom o) {
@@ -86,7 +84,6 @@ public int getAtomicNumber(IAtom o) {
8684
int massNumber = Isotopes.getInstance().getMajorIsotope(o.getAtomicNumber()).getAtomicNumber();
8785
return massNumber;
8886
} catch (Exception e) {
89-
//e.printStackTrace();
9087
return 6;
9188
}
9289
} else if (o instanceof IPseudoAtom) {

src/main/java/com/bioinceptionlabs/centres/priority/MassNumberRule.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,18 @@ public int compare(Ligand<A> o1, Ligand<A> o2) {
7474
IAtom b = (IAtom) o2.getAtom();
7575

7676
return getMassNumber(a) - getMassNumber(b);
77-
78-
// return accessor.getMassNumber(o1.getAtom()) - accessor.getMassNumber(o2.getAtom());
7977
}
8078

8179
public int getMassNumber(IAtom o) {
8280

8381
if (o != null && !(o instanceof IPseudoAtom) && o.getMassNumber() == null) {
8482
try {
85-
// Integer atomicNumber = ac.getAtom(i).getAtomicNumber();
86-
// LOGGER.debug("atomicNumber " + atomicNumber);
8783
int massNumber = Isotopes.getInstance().getMajorIsotope(o.getAtomicNumber()).getMassNumber();
8884
return massNumber;
8985
} catch (Exception e) {
90-
//e.printStackTrace();
9186
return 11;
9287
}
9388
} else if (o instanceof IPseudoAtom) {
94-
//PseudoAtoms
95-
// Integer atomicNumber = ac.getAtom(i).getAtomicNumber();
96-
// LOGGER.debug("atomicNumber " + atomicNumber);
9789
return 11;//less than carbon for 'R'
9890
}
9991
return 0;

src/main/java/com/bioinceptionlabs/reactionblast/mapping/algorithm/checks/RuleBasedMappingHandler.java

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import java.io.IOException;
2222
import java.io.Serializable;
23-
import static java.lang.System.getProperty;
24-
2523
import java.util.Collection;
2624
import java.util.HashMap;
2725
import java.util.List;
@@ -34,7 +32,6 @@
3432
import org.openscience.cdk.exception.CDKException;
3533
import org.openscience.cdk.interfaces.IAtomContainer;
3634
import org.openscience.cdk.silent.SilentChemObjectBuilder;
37-
import static org.openscience.cdk.smiles.SmilesGenerator.unique;
3835
import org.openscience.cdk.smiles.SmilesParser;
3936
import com.bioinceptionlabs.reactionblast.mapping.algorithm.Holder;
4037
import static org.openscience.smsd.tools.ExtAtomContainerManipulator.removeHydrogens;
@@ -50,9 +47,6 @@
5047
*/
5148
public final class RuleBasedMappingHandler implements Serializable {
5249

53-
static final String NEW_LINE = getProperty("line.separator");
54-
private final static boolean DEBUG1 = false;
55-
private final static boolean DEBUG2 = false;
5650
private static final long serialVersionUID = 88765671L;
5751
private final static ILoggingTool LOGGER
5852
= createLoggingTool(RuleBasedMappingHandler.class);
@@ -106,9 +100,6 @@ public RuleBasedMappingHandler(Holder matrixHolder,
106100
List<String> EdMapOrignal, List<String> PdMapOrignal)
107101
throws CDKException, IOException {
108102
setRulesSmiles();
109-
if (DEBUG1) {
110-
LOGGER.debug("Mapping Rules Checked");
111-
}
112103
this.matrixHolder = matrixHolder;
113104
this.matchedRowColoumn = new HashMap<>();
114105
setRuleMatched(false);
@@ -118,9 +109,6 @@ public RuleBasedMappingHandler(Holder matrixHolder,
118109
for (int i = 0; i < this.matrixHolder.getReactionContainer().getEductCount(); i++) {
119110
IAtomContainer ac1 = new AtomContainer(this.matrixHolder.getReactionContainer().getEduct(i));
120111
ac1 = removeHydrogens(ac1);
121-
if (DEBUG1) {
122-
LOGGER.debug("Educt " + unique().create(ac1));
123-
}
124112

125113
if (ac1.getAtomCount() >= getSmartsPhosphate().getAtomCount()
126114
|| ac1.getAtomCount() >= getSmartsSulphate().getAtomCount()) {
@@ -131,15 +119,9 @@ public RuleBasedMappingHandler(Holder matrixHolder,
131119
}
132120
}
133121
}
134-
if (DEBUG1) {
135-
LOGGER.debug("smallestMatchedReactant " + smallestMatchedReactant);
136-
}
137122
for (int j = 0; j < this.matrixHolder.getReactionContainer().getProductCount(); j++) {
138123
IAtomContainer ac2 = new AtomContainer(this.matrixHolder.getReactionContainer().getProduct(j));
139124
ac2 = removeHydrogens(ac2);
140-
if (DEBUG1) {
141-
LOGGER.debug("Product " + unique().create(ac2));
142-
}
143125
if (ac2.getAtomCount() >= getSmartsPhosphate().getAtomCount()
144126
|| ac2.getAtomCount() >= getSmartsSulphate().getAtomCount()) {
145127
if (isMatch(getSmartsPhosphate(), ac2, false) || isMatch(getSmartsSulphate(), ac2, false)) {
@@ -149,10 +131,6 @@ public RuleBasedMappingHandler(Holder matrixHolder,
149131
}
150132
}
151133
}
152-
if (DEBUG1) {
153-
LOGGER.debug("smallestMatchedProduct " + smallestMatchedProduct);
154-
LOGGER.debug(NEW_LINE + NEW_LINE + "----------------------" + NEW_LINE + NEW_LINE + NEW_LINE);
155-
}
156134

157135
boolean phosphate_changed = phosphate_cleaved(this.matrixHolder.getReactionContainer().getEducts(), this.matrixHolder.getReactionContainer().getProducts());
158136

@@ -161,29 +139,12 @@ public RuleBasedMappingHandler(Holder matrixHolder,
161139
IAtomContainer educt = this.matrixHolder.getReactionContainer().getEduct(i);
162140
IAtomContainer ac1 = new AtomContainer(educt);
163141
ac1 = removeHydrogens(ac1);
164-
if (DEBUG2) {
165-
LOGGER.debug(NEW_LINE + NEW_LINE + NEW_LINE + "Educt " + unique().create(ac1));
166-
LOGGER.debug("Educt found " + ac1.getAtomCount());
167-
}
168142

169143
for (int j = 0; j < this.matrixHolder.getReactionContainer().getProductCount(); j++) {
170144
IAtomContainer product = this.matrixHolder.getReactionContainer().getProduct(j);
171145
IAtomContainer ac2 = new AtomContainer(product);
172146
ac2 = removeHydrogens(ac2);
173147

174-
if (DEBUG2) {
175-
LOGGER.debug("Product " + unique().create(ac2));
176-
LOGGER.debug("Product found " + ac2.getAtomCount());
177-
}
178-
if (DEBUG2) {
179-
LOGGER.debug("Match 1 " + isMatch(getSmartsWater(), ac1, false));
180-
LOGGER.debug("Match 2 " + isMatch(getSmartsPhosphate(), ac2, false));
181-
LOGGER.debug("Query " + ac1.getAtomCount());
182-
LOGGER.debug("Target " + ac2.getAtomCount());
183-
LOGGER.debug("smallest R " + smallestMatchedReactant);
184-
LOGGER.debug("smallest P " + smallestMatchedProduct);
185-
}
186-
187148
if (this.matrixHolder.getCliqueMatrix().getValue(i, j) == 0) {
188149
continue;
189150
}
@@ -196,16 +157,8 @@ && isMatch(getSmartsWater(), ac1, false)
196157
&& isMatch(getSmartsPhosphate(), ac2, false)
197158
&& !isMatch(getSmartsDoublePhosphate(), ac2, false)
198159
&& ac2.getAtomCount() == smallestMatchedProduct) {
199-
if (DEBUG2) {
200-
LOGGER.debug("Match ");
201-
LOGGER.debug("smallest R phosphate " + smallestMatchedReactant);
202-
LOGGER.debug("smallest P phosphate " + smallestMatchedProduct);
203-
}
204160
setRuleMatched(true);
205161
matchedRowColoumn.put(i, j);
206-
if (DEBUG1) {
207-
LOGGER.debug(" Rule 1 water and Phosphate");
208-
}
209162

210163
}
211164
/*
@@ -217,16 +170,8 @@ && isMatch(getSmartsWater(), ac2, false)
217170
&& isMatch(getSmartsPhosphate(), ac1, false)
218171
&& !isMatch(getSmartsDoublePhosphate(), ac1, false)
219172
&& ac1.getAtomCount() == smallestMatchedReactant) {
220-
if (DEBUG2) {
221-
LOGGER.debug("Match ");
222-
LOGGER.debug("smallest R phosphate " + smallestMatchedReactant);
223-
LOGGER.debug("smallest P phosphate " + smallestMatchedProduct);
224-
}
225173
setRuleMatched(true);
226174
matchedRowColoumn.put(i, j);
227-
if (DEBUG1) {
228-
LOGGER.debug(" Rule 1 phosphate and water");
229-
}
230175

231176
}
232177

@@ -237,41 +182,22 @@ && isMatch(getSmartsPhosphate(), ac1, false)
237182
&& isMatch(getSmartsWater(), ac1, false)
238183
&& isMatch(getSmartsSulphate(), ac2, false)
239184
&& ac2.getAtomCount() == smallestMatchedProduct) {
240-
if (DEBUG2) {
241-
LOGGER.debug("Match ");
242-
LOGGER.debug("smallest R sulphate " + smallestMatchedReactant);
243-
LOGGER.debug("smallest P sulphate " + smallestMatchedProduct);
244-
}
245185
setRuleMatched(true);
246186
matchedRowColoumn.put(i, j);
247-
if (DEBUG1) {
248-
LOGGER.debug(" Rule 1 water and Sulphate");
249-
}
250187

251188
} else /*
252189
Rule 1_D Sulphate and water
253190
*/ if (ac2.getAtomCount() == 1
254191
&& isMatch(getSmartsWater(), ac2, false)
255192
&& isMatch(getSmartsSulphate(), ac1, false)
256193
&& ac1.getAtomCount() == smallestMatchedReactant) {
257-
if (DEBUG2) {
258-
LOGGER.debug("Match ");
259-
LOGGER.debug("smallest R sulphate " + smallestMatchedReactant);
260-
LOGGER.debug("smallest P sulphate " + smallestMatchedProduct);
261-
}
262194
setRuleMatched(true);
263195
matchedRowColoumn.put(i, j);
264-
if (DEBUG1) {
265-
LOGGER.debug(" Rule 1 Sulphate and water");
266-
}
267196

268197
}/*
269198
Rule 11 C04666_C04916
270199
*/ else if (isMatch(getSmartsC04666Rule(), ac1, false) && isMatch(getSmartsC04916Rule(), ac2, false)
271200
|| (isMatch(getSmartsC04916Rule(), ac1, false) && isMatch(getSmartsC04666Rule(), ac2, false))) {
272-
if (DEBUG1) {
273-
LOGGER.debug("Rule 11 C04666 with C04916 found");
274-
}
275201
setRuleMatched(true);
276202
matchedRowColoumn.put(i, j);
277203
} /*
@@ -282,9 +208,6 @@ && isMatch(getSmartsGlutamate(), ac1, false) && isMatch(getSmartsGlutamine(), ac
282208
&& isMatch(getSmartsGlutamine(), ac1, false) && isMatch(getSmartsGlutamate(), ac2, false))) {
283209
setRuleMatched(true);
284210
matchedRowColoumn.put(i, j);
285-
if (DEBUG1) {
286-
LOGGER.debug("Rule 2.1 L-Glutamate with L-Glutamine found");
287-
}
288211
} /*
289212
Rule 2 L_Glutamate and L_Glutamine_clipped
290213
*/ else if ((ac1.getAtomCount() == 10 && ac2.getAtomCount() == 10
@@ -293,9 +216,6 @@ && isMatch(getSmartsGlutamateClipped(), ac1, false) && isMatch(getSmartsGlutamin
293216
&& isMatch(getSmartsGlutamineClipped(), ac1, false) && isMatch(getSmartsGlutamateClipped(), ac2, false))) {
294217
setRuleMatched(true);
295218
matchedRowColoumn.put(i, j);
296-
if (DEBUG1) {
297-
LOGGER.debug("Rule 2.2 L-Glutamate with L-Glutamine found");
298-
}
299219
}/*
300220
Rule 3 D_Glutamate and TwoOxoglutarate
301221
*/ else if ((ac2.getAtomCount() == 10 && ac1.getAtomCount() == 10
@@ -305,19 +225,13 @@ && isMatch(getSmartsTwoOxoglutarate(), ac1, false) && isMatch(getSmartsD_Glutama
305225

306226
setRuleMatched(true);
307227
matchedRowColoumn.put(i, j);
308-
if (DEBUG1) {
309-
LOGGER.debug("Rule 3 D-Glutamate with 2-Oxoglutarate found");
310-
}
311228

312229
}/*
313230
Rule 4 water and Acetate (exact match)
314231
*/ else if ((ac1.getAtomCount() == 1 && isMatch(getSmartsWater(), ac1, false)
315232
&& ac2.getAtomCount() == getSmartsAcetate().getAtomCount() && isMatch(getSmartsAcetate(), ac2, false))
316233
|| (ac2.getAtomCount() == 1 && isMatch(getSmartsWater(), ac2, false)
317234
&& ac1.getAtomCount() == getSmartsAcetate().getAtomCount() && isMatch(getSmartsAcetate(), ac1, false))) {
318-
if (DEBUG1) {
319-
LOGGER.debug("Rule 4 Water and Acetate found");
320-
}
321235
setRuleMatched(true);
322236
matchedRowColoumn.put(i, j);
323237
}/*
@@ -326,9 +240,6 @@ && isMatch(getSmartsTwoOxoglutarate(), ac1, false) && isMatch(getSmartsD_Glutama
326240
&& isMatch(getSmartsADP(), ac2, false))
327241
|| (ac1.getAtomCount() == getSmartsADP().getAtomCount() && isMatch(getSmartsADP(), ac1, false)
328242
&& isMatch(getSmartsATP(), ac2, false))) {
329-
if (DEBUG1) {
330-
LOGGER.debug("Rule 5 ADP_ATP found");
331-
}
332243
setRuleMatched(true);
333244
matchedRowColoumn.put(i, j);
334245
}/*
@@ -337,9 +248,6 @@ && isMatch(getSmartsATP(), ac2, false))) {
337248
&& isMatch(getSmartsAcetyl_CoA(), ac2, false))
338249
|| (ac1.getAtomCount() == getSmartsAcetyl_CoA().getAtomCount() && isMatch(getSmartsAcetyl_CoA(), ac1, false)
339250
&& isMatch(getSmartsCoA(), ac2, false))) {
340-
if (DEBUG1) {
341-
LOGGER.debug("Rule 6 CoA_Acetyl_CoA found");
342-
}
343251
setRuleMatched(true);
344252
matchedRowColoumn.put(i, j);
345253
}/*
@@ -348,9 +256,6 @@ && isMatch(getSmartsCoA(), ac2, false))) {
348256
&& isMatch(getSmartsC00006(), ac2, false))
349257
|| (ac1.getAtomCount() == getSmartsC00006().getAtomCount() && isMatch(getSmartsC00006(), ac1, false)
350258
&& isMatch(getSmartsC00003(), ac2, false))) {
351-
if (DEBUG1) {
352-
LOGGER.debug("Rule 7 C00003_C00006 found");
353-
}
354259
setRuleMatched(true);
355260
matchedRowColoumn.put(i, j);
356261
}/*
@@ -359,9 +264,6 @@ && isMatch(getSmartsC00003(), ac2, false))) {
359264
&& isMatch(getSmartsC00005(), ac2, false))
360265
|| (ac1.getAtomCount() == getSmartsC00005().getAtomCount() && isMatch(getSmartsC00005(), ac1, false)
361266
&& isMatch(getSmartsC00004(), ac2, false))) {
362-
if (DEBUG1) {
363-
LOGGER.debug("Rule 8 C00004_C00005 found");
364-
}
365267
setRuleMatched(true);
366268
matchedRowColoumn.put(i, j);
367269
} /*
@@ -370,18 +272,12 @@ && isMatch(getSmartsC00004(), ac2, false))) {
370272
&& isMatch(getSmartsAlanine(), ac2, false))
371273
|| (ac1.getAtomCount() == getSmartsAlanine().getAtomCount() && isMatch(getSmartsAlanine(), ac1, false)
372274
&& isMatch(getSmartsPyruvate(), ac2, false))) {
373-
if (DEBUG1) {
374-
LOGGER.debug("Rule 9 C00022_C00041 found");
375-
}
376275
setRuleMatched(true);
377276
matchedRowColoumn.put(i, j);
378277
}/*
379278
Rule 10 N_C
380279
*/ else if (isMatch(getSmartsNRule(), ac1, false) && isMatch(getSmartsCRule(), ac2, false)
381280
|| (isMatch(getSmartsCRule(), ac1, false) && isMatch(getSmartsNRule(), ac2, false))) {
382-
if (DEBUG1) {
383-
LOGGER.debug("Rule 10 N with C found");
384-
}
385281
setRuleMatched(true);
386282
matchedRowColoumn.put(i, j);
387283
}

src/main/java/com/bioinceptionlabs/reactionblast/tools/utility/EBIArrayList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class EBIArrayList<E> extends ArrayList<E> {
4141
* @param L2
4242
* @return
4343
*/
44-
@SuppressWarnings({"unchecked", "unchecked"})
44+
@SuppressWarnings("unchecked")
4545
public static ArrayList append(ArrayList L1, ArrayList L2) {
4646

4747
ArrayList temp1 = new ArrayList(L1);

0 commit comments

Comments
 (0)