Yes, reactions are aligned left to right automatically when atom-maps are present.
For example: [image: image.png] (CDK Depict <http://simolecule.com/cdkdepict/depict/bow/png?smi=%5BCH3%3A9%5D%5BCH%3A8%5D(%5BCH3%3A10%5D)%5Bc%3A7%5D1%5BcH%3A11%5D%5BcH%3A12%5D%5BcH%3A13%5D%5BcH%3A14%5D%5BcH%3A15%5D1.%5BCH2%3A3%5D(%5BCH2%3A4%5D%5BC%3A5%5D(%3D%5BO%3A6%5D)Cl)%5BCH2%3A2%5D%5BCl%3A1%5D%3E%5BAl%2B3%5D.%5BCl-%5D.%5BCl-%5D.%5BCl-%5D.C(Cl)Cl%3E%5BCH3%3A9%5D%5BCH%3A8%5D(%5BCH3%3A10%5D)%5Bc%3A7%5D1%5BcH%3A11%5D%5BcH%3A12%5D%5Bc%3A13%5D(%5BcH%3A14%5D%5BcH%3A15%5D1)%5BC%3A5%5D(%3D%5BO%3A6%5D)%5BCH2%3A4%5D%5BCH2%3A3%5D%5BCH2%3A2%5D%5BCl%3A1%5D%20%7Cf%3A2.3.4.5%7C%20Friedel-Crafts%20acylation%20%5B3.10.1%5D&abbr=on&hdisp=bridgehead&showtitle=false&zoom=1.6&annotate=none> ) [image: image.png] (CDK Depict <http://simolecule.com/cdkdepict/depict/bow/png?smi=%5BCH3%3A9%5D%5BCH%3A8%5D(%5BCH3%3A10%5D)%5Bc%3A7%5D1%5BcH%3A11%5D%5BcH%3A12%5D%5BcH%3A13%5D%5BcH%3A14%5D%5BcH%3A15%5D1.%5BCH2%3A3%5D(%5BCH2%3A4%5D%5BC%3A5%5D(%3D%5BO%3A6%5D)Cl)%5BCH2%3A2%5D%5BCl%3A1%5D%3E%5BAl%2B3%5D.%5BCl-%5D.%5BCl-%5D.%5BCl-%5D.C(Cl)Cl%3E%5BCH3%3A9%5D%5BCH%3A8%5D(%5BCH3%3A10%5D)%5Bc%3A7%5D1%5BcH%3A11%5D%5BcH%3A12%5D%5Bc%3A13%5D(%5BcH%3A14%5D%5BcH%3A15%5D1)%5BC%3A5%5D(%3D%5BO%3A6%5D)%5BCH2%3A4%5D%5BCH2%3A3%5D%5BCH2%3A2%5D%5BCl%3A1%5D%20%7Cf%3A2.3.4.5%7C%20Friedel-Crafts%20acylation%20%5B3.10.1%5D&abbr=on&hdisp=bridgehead&showtitle=false&zoom=1.6&annotate=none&alignrxnmap=false> ) // StructureDiagramGenerater sdg; sdg.setAlignMappedReaction(false); If you want to *also* align to a substructure you can lay out the product first, then the whole reaction. The API is deliberately low-level to be flexible but basically you can generate a layout keeping certain atoms/bonds in place (atoms are more important, the bond set stops them being stretched/flipped). With this you can transfer across the coordinates first then "fix" these in place. For example, something like this: IAtomContainer query; // already laid out > IAtomContainer mol; // to be laid out > StructureDiagramGenerator sdg = new StructureDiagramGenerator(); > for (Map<IAtom,IAtom> map : Pattern.findSubstructure(query) > .matchAll(mol) > .toAtomMap()) { > for (Map.Entry<IAtom,IAtom> e = map.entrySet()) > e.getValue().setPoint2d(new Point2d(e.getKey().getPoint2d())); > sdg.setMolecule(mol, false, map.values(), Collections.emptySet()); > sdg.generateCoordinates(); > break; // first mapping only > } StructureDiagramGenerator <http://cdk.github.io/cdk/latest/docs/api/index.html?org/openscience/cdk/layout/StructureDiagramGenerator.html> API > public void setMolecule(IAtomContainer mol, > boolean clone, > Set<IAtom> afix, > Set<IBond> bfix) > Assigns a molecule to be laid out. After, setting the molecule call > generateCoordinates() to assign 2D coordinates. An optional set of > atoms/bonds can be parsed in to allow partial layout, these will be 'fixed' > in place. This only applies to non-cloned molecules, and only atoms with > coordinates can be fixed. > Parameters: > mol - the molecule for which coordinates are to be generated. > clone - Should the whole process be performed with a cloned copy? > afix - Atoms that should be fixed in place, coordinates are not changed. > bfix - Bonds that should be fixed in place, they will not be flipped, > bent, or streched. On Fri, 7 Sep 2018 at 10:32, Ross West <ross.w...@dotmatics.com> wrote: > Hi, > > > > I'm wondering if it's possible to align a Reaction using a fixed > substructure similar to the methods covered here: > http://ctr.wikia.com/wiki/Align_the_depiction_using_a_fixed_substructure > > > > Is this possible using CDK? > > > > Thanks in advance, > > Ross > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Cdk-user mailing list > Cdk-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/cdk-user >
_______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user