/** {@inheritDoc} */ @Override @TestMethod("testEmptyReaction") public IRenderingElement generate(IReaction reaction, RendererModel model) { if (!model.getParameter(ShowReactionBoxes.class).getValue()) return null; double separation = model.getParameter(BondLength.class).getValue() / model.getParameter(Scale.class).getValue(); Rectangle2D totalBounds = BoundsCalculator.calculateBounds(reaction); if (totalBounds == null) return null; ElementGroup diagram = new ElementGroup(); Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue(); diagram.add( new RectangleElement( totalBounds.getMinX() - separation, totalBounds.getMinY() - separation, totalBounds.getMaxX() + separation, totalBounds.getMaxY() + separation, foregroundColor)); if (reaction.getID() != null) { diagram.add( new TextElement( (totalBounds.getMinX() + totalBounds.getMaxX()) / 2, totalBounds.getMinY() - separation, reaction.getID(), foregroundColor)); } return diagram; }
// ~--- constructors ------------------------------------------------------- GameTheoryMin( IReaction reaction, boolean removeHydrogen, Map<Integer, IAtomContainer> _educts, Map<Integer, IAtomContainer> _products, GameTheoryMatrix rpsh) throws Exception { if (DEBUG) { out.println("I am MIN MIX"); } this.canonLabeler = new SmilesMoleculeLabeller(); this.removeHydrogen = removeHydrogen; this.reaction = reaction; this.educts = _educts; this.products = _products; this.reactionName = reaction.getID(); this.eductList = synchronizedList(rpsh.getEductCounter()); this.productList = synchronizedList(rpsh.getProductCounter()); this.mh = rpsh.getMatrixHolder(); setReactionMolMapping(rpsh.getReactionMolMapping()); winner = new ChooseWinner(eductList, productList); this._dirSuffix = super.getSuffix(); ReactionIsomorphismHandler RIH = new ReactionIsomorphismHandler(mh, eductList, productList); if (RIH.getIsomorphismFlag()) { // System.out.println("ISOMORPHISM"); mh = RIH.getMatrixHolder(); GenerateIsoMorphismMapping(); } else { GenerateMapping(false); } }
private static void setReactionIDs(final IChemModel chemModel) { // we give all reactions an ID, in case they have none // IDs are needed for handling in JCP final IReactionSet reactionSet = chemModel.getReactionSet(); if (reactionSet != null) { int i = 0; for (final IReaction reaction : reactionSet.reactions()) { if (reaction.getID() == null) { reaction.setID("Reaction " + ++i); } } } }
@Override public void store(IReaction reaction) { String id = reaction.getID(); File file = new File(reactionDir, id + ".rxn"); try { FileWriter writer = new FileWriter(file); rxnWriter = new MDLV2000RXNWriter(writer); // rxnWriter.setWriter(writer); rxnWriter.write(reaction); // writer.flush(); // writer.close(); rxnWriter.close(); } catch (CDKException | IOException e) { e.printStackTrace(); } }
/** * @param removeHydrogen * @param reaction * @param algorithm */ public CalculationProcess( boolean removeHydrogen, IReaction reaction, IMappingAlgorithm algorithm) { /* * This case handles rings cases where 6 membered ring reduces to 5 membered rings Example KEGG reaction R01432 * of Isomerase class */ super(reaction); // System.out.println("I am CalculationProcess"); this.removeHydrogen = removeHydrogen; logger.debug("\n|++++++++++++++++++++++++++++|"); logger.debug("Performing Atom-Atom Mapping ....... " + reaction.getID() + " ......."); logger.debug("\n|++++++++++++++++++++++++++++|"); this.algorithm = algorithm; run(); }