Skip to content

Commit 27da1e8

Browse files
committed
Add CHARGE_TRANSFER/RADICAL_CHANGE flags, remove last DEBUG guards
- Add CHARGE_TRANSFER (14) and RADICAL_CHANGE (15) to ECBLAST_BOND_CHANGE_FLAGS enum for extended R-matrix support - Remove unused DEBUG boolean from Reactor.java (5 guards → direct LOGGER) - Remove unused DEBUG boolean from TestUtility.java - Remove unused generic() import from Reactor.java - Remove stale SMILES generation in Reactor debug path 135/135 tests pass.
1 parent ddb4dd6 commit 27da1e8

3 files changed

Lines changed: 25 additions & 38 deletions

File tree

src/main/java/com/bioinceptionlabs/reactionblast/mapping/Reactor.java

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import static org.openscience.cdk.interfaces.IReaction.Direction.BIDIRECTIONAL;
4242
import org.openscience.cdk.layout.StructureDiagramGenerator;
4343
import org.openscience.cdk.smiles.SmilesGenerator;
44-
import static org.openscience.cdk.smiles.SmilesGenerator.generic;
4544
import static org.openscience.cdk.tools.manipulator.AtomContainerSetManipulator.getTotalFormalCharge;
4645
import com.bioinceptionlabs.reactionblast.mapping.algorithm.CalculationProcess;
4746
import com.bioinceptionlabs.reactionblast.mapping.container.MoleculeMoleculeMapping;
@@ -74,7 +73,6 @@
7473
*/
7574
public class Reactor extends AbstractReactor implements Serializable {
7675

77-
private static final boolean DEBUG = false;
7876
private static final long serialVersionUID = 197816786981017L;
7977
private final static ILoggingTool LOGGER
8078
= createLoggingTool(Reactor.class);
@@ -146,22 +144,16 @@ public class Reactor extends AbstractReactor implements Serializable {
146144
LOGGER.debug("|++++++++++++++++++++++++++++|");
147145
LOGGER.debug("|i. Reactor Initialized");
148146
cleanMapping(reaction);
149-
if (DEBUG) {
150-
LOGGER.debug("|++++++++++++++++++++++++++++|");
151-
printReaction(reaction);
152-
LOGGER.debug("|ii. Create Mapping Objects");
153-
}
147+
LOGGER.debug("|++++++++++++++++++++++++++++|");
148+
printReaction(reaction);
149+
LOGGER.debug("|ii. Create Mapping Objects");
154150
copyReferenceReaction(reaction);
155151
expandReaction();
156152
checkReactionBalance();
157153
LOGGER.debug("|iii. Compute atom-atom Mappings");
158154
calculateAtomAtomMapping();
159-
if (DEBUG) {
160-
printReaction(reactionWithUniqueSTOICHIOMETRY);
161-
LOGGER.debug("|++++++++++++++++++++++++++++|");
162-
LOGGER.debug("|iv. Done|");
163-
LOGGER.debug("|++++++++++++++++++++++++++++|" + NEW_LINE + NEW_LINE);
164-
}
155+
printReaction(reactionWithUniqueSTOICHIOMETRY);
156+
LOGGER.debug("|iv. Done|");
165157
}
166158

167159
@Override
@@ -1099,14 +1091,11 @@ public IMappingAlgorithm getAlgorithm() {
10991091
private IAtomContainer prepareMol(IAtomContainer cloneMolecule)
11001092
throws CloneNotSupportedException, CDKException {
11011093

1102-
if (DEBUG) {
1103-
LOGGER.debug("Orignal");
1104-
printAtoms(cloneMolecule);
1105-
}
1094+
LOGGER.debug("Original");
1095+
printAtoms(cloneMolecule);
11061096
/*
11071097
Use the Canonical labelling from the SMILES
11081098
IMP: Suggested by John May
1109-
It throws java.util.concurrent.ExecutionException
11101099
*/
11111100
int[] p = new int[cloneMolecule.getAtomCount()];
11121101

@@ -1119,10 +1108,8 @@ private IAtomContainer prepareMol(IAtomContainer cloneMolecule)
11191108
}
11201109
permuteWithoutClone(p, cloneMolecule);
11211110

1122-
if (DEBUG) {
1123-
LOGGER.debug("mol after: ");
1124-
printAtoms(cloneMolecule);
1125-
}
1111+
LOGGER.debug("mol after: ");
1112+
printAtoms(cloneMolecule);
11261113

11271114
/*
11281115
Generate 2D Diagram without cloning
@@ -1147,13 +1134,8 @@ private IAtomContainer prepareMol(IAtomContainer cloneMolecule)
11471134
atom.setID("-1");
11481135
}
11491136

1150-
if (DEBUG) {
1151-
LOGGER.debug("Processed");
1152-
printAtoms(cloneMolecule);
1153-
LOGGER.debug("canonicalMolecule: "
1154-
+ generic().create(cloneMolecule)
1155-
+ NEW_LINE + NEW_LINE);
1156-
}
1137+
LOGGER.debug("Processed");
1138+
printAtoms(cloneMolecule);
11571139

11581140
return cloneMolecule;
11591141
}

src/main/java/com/bioinceptionlabs/reactionblast/mechanism/interfaces/ECBLAST_BOND_CHANGE_FLAGS.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public enum ECBLAST_BOND_CHANGE_FLAGS {
5555
* BONDCHANGEORDERREDUCED
5656
*/
5757
BOND_ORDER_REDUCED(13, "BOND_CHANGE_ORDER_REDUCED"),
58+
/**
59+
* Formal charge transfer between atoms (e.g., protonation/deprotonation)
60+
*/
61+
CHARGE_TRANSFER(14, "CHARGE_TRANSFER"),
62+
/**
63+
* Radical (unpaired electron) change
64+
*/
65+
RADICAL_CHANGE(15, "RADICAL_CHANGE"),
5866
/**
5967
* BONDCHANGEPSEUDOBOND
6068
*/

src/main/java/com/bioinceptionlabs/reactionblast/tools/TestUtility.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public class TestUtility {
5555
public static final String MACIE_RXN = "rxn/macie/";
5656
private final static ILoggingTool LOGGER
5757
= createLoggingTool(TestUtility.class);
58-
private static final boolean DEBUG = false;
5958

6059
/**
6160
*
@@ -95,14 +94,12 @@ protected IReaction readReactionFile(String name, String dir, boolean reMap, boo
9594
try (MDLRXNV2000Reader reader = new MDLRXNV2000Reader(getFileWithUtil(filepath))) {
9695
reaction = reader.read(new Reaction());
9796
reaction.setID(name);
98-
if (DEBUG) {
99-
LOGGER.debug("Read Reaction ");
100-
for (IAtomContainer ac : reaction.getReactants().atomContainers()) {
101-
LOGGER.debug("r " + ac.getTitle() + ":" + reaction.getReactantCoefficient(ac));
102-
}
103-
for (IAtomContainer ac : reaction.getProducts().atomContainers()) {
104-
LOGGER.debug("p " + ac.getTitle() + ":" + reaction.getProductCoefficient(ac));
105-
}
97+
LOGGER.debug("Read Reaction ");
98+
for (IAtomContainer ac : reaction.getReactants().atomContainers()) {
99+
LOGGER.debug("r " + ac.getTitle() + ":" + reaction.getReactantCoefficient(ac));
100+
}
101+
for (IAtomContainer ac : reaction.getProducts().atomContainers()) {
102+
LOGGER.debug("p " + ac.getTitle() + ":" + reaction.getProductCoefficient(ac));
106103
}
107104
} catch (Exception ex) {
108105
LOGGER.error(SEVERE, "Unable to parse the RXN file", ex.getMessage());

0 commit comments

Comments
 (0)