Skip to content

Commit

Permalink
chore: improve code of MoleculeQueryFeatures (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny authored May 27, 2024
1 parent da337c2 commit 768259c
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions src/com/actelion/research/gwt/minimal/MoleculeQueryFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,77 @@
class MoleculeQueryFeatures {
public static JavaScriptObject getAtomQueryFeatures(StereoMolecule oclMolecule, int atom) {
PlainJSObject moleculeQueryFeatures = PlainJSObject.create();
long atomQueryFeatures = oclMolecule.getAtomQueryFeatures(atom);

moleculeQueryFeatures.setPropertyBoolean("aromatic",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFAromatic) > 0);
(atomQueryFeatures & Molecule.cAtomQFAromatic) > 0);
moleculeQueryFeatures.setPropertyBoolean("notAromatic",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNotAromatic) > 0);
(atomQueryFeatures & Molecule.cAtomQFNotAromatic) > 0);

moleculeQueryFeatures.setPropertyBoolean("notChain",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNotChain) > 0);
(atomQueryFeatures & Molecule.cAtomQFNotChain) > 0);
moleculeQueryFeatures.setPropertyBoolean("not2RingBonds",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot2RingBonds) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot2RingBonds) > 0);
moleculeQueryFeatures.setPropertyBoolean("not3RingBonds",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot3RingBonds) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot3RingBonds) > 0);
moleculeQueryFeatures.setPropertyBoolean("not4RingBonds",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot4RingBonds) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot4RingBonds) > 0);

moleculeQueryFeatures.setPropertyBoolean("noMoreNeighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNoMoreNeighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNoMoreNeighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("moreNeighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFMoreNeighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFMoreNeighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("matchStereo",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFMatchStereo) > 0);
(atomQueryFeatures & Molecule.cAtomQFMatchStereo) > 0);

moleculeQueryFeatures.setPropertyBoolean("not0PiElectrons",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot0PiElectrons) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot0PiElectrons) > 0);
moleculeQueryFeatures.setPropertyBoolean("not1PiElectrons",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot1PiElectron) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot1PiElectron) > 0);
moleculeQueryFeatures.setPropertyBoolean("not2PiElectrons",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot2PiElectrons) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot2PiElectrons) > 0);

moleculeQueryFeatures.setPropertyBoolean("not0Hydrogen",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot0Hydrogen) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot0Hydrogen) > 0);
moleculeQueryFeatures.setPropertyBoolean("not1Hydrogen",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot1Hydrogen) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot1Hydrogen) > 0);
moleculeQueryFeatures.setPropertyBoolean("not2Hydrogen",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot2Hydrogen) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot2Hydrogen) > 0);
moleculeQueryFeatures.setPropertyBoolean("not3Hydrogen",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot3Hydrogen) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot3Hydrogen) > 0);

moleculeQueryFeatures.setPropertyBoolean("not0Neighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot0Neighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot0Neighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("not1Neighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot0Neighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot0Neighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("not2Neighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot2Neighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot2Neighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("not3Neighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot3Neighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot3Neighbours) > 0);
moleculeQueryFeatures.setPropertyBoolean("not4Neighbours",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNot4Neighbours) > 0);
(atomQueryFeatures & Molecule.cAtomQFNot4Neighbours) > 0);

moleculeQueryFeatures.setPropertyBoolean("notChargeNeg",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNotChargeNeg) > 0);
(atomQueryFeatures & Molecule.cAtomQFNotChargeNeg) > 0);
moleculeQueryFeatures.setPropertyBoolean("notCharge0",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNotCharge0) > 0);
(atomQueryFeatures & Molecule.cAtomQFNotCharge0) > 0);
moleculeQueryFeatures.setPropertyBoolean("noChargePos",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFNotChargePos) > 0);
(atomQueryFeatures & Molecule.cAtomQFNotChargePos) > 0);

moleculeQueryFeatures.setPropertyBoolean("ringSize0",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize0) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize0) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSize3",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize3) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize3) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSize4",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize4) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize4) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSize5",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize5) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize5) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSize6",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize6) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize6) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSize7",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSize7) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSize7) > 0);
moleculeQueryFeatures.setPropertyBoolean("ringSizeLarge",
(oclMolecule.getAtomQueryFeatures(atom) & Molecule.cAtomQFRingSizeLarge) > 0);
(atomQueryFeatures & Molecule.cAtomQFRingSizeLarge) > 0);

return moleculeQueryFeatures;
}
Expand Down

0 comments on commit 768259c

Please sign in to comment.