Class StereoElementFactory

java.lang.Object
org.openscience.cdk.stereo.StereoElementFactory

public abstract class StereoElementFactory extends Object
Create stereo elements for a structure with 2D and 3D coordinates. The factory does not verify whether atoms can or cannot support stereochemistry - for this functionality use Stereocenters. The factory will not create stereo elements if there is missing information (wedge/hatch bonds, undefined coordinates) or the layout indicates unspecified configuration. Stereocenters specified with inverse down (hatch) bond style are created if the configuration is unambiguous and the bond does not connect to another stereocenter.
 IAtomContainer       container = ...;
 StereoElementFactory stereo    = StereoElementFactory.using2DCoordinates()
                                                      .interpretProjections(Projection.Haworth);

 // set the elements replacing any existing elements
 container.setStereoElements(stereo.createAll());

 // adding elements individually is also possible but existing elements are
 // are not removed
 for (IStereoElement element : stereo.createAll())
     container.addStereoElement(element); // bad, there may already be elements

 
Author:
John May
See Also:
Source code:
main
Belongs to CDK module:
standard
  • Field Details

    • container

      protected final IAtomContainer container
      Native CDK structure representation.
    • graph

      protected final int[][] graph
      Adjacency list graph representation.
    • bondMap

      protected final GraphUtil.EdgeToBondMap bondMap
      A bond map for fast access to bond labels between two atom indices.
    • projections

      protected final Set<Projection> projections
    • strict

      protected boolean strict
    • logger

      protected final ILoggingTool logger
    • check

      protected boolean check
      Verify if created stereochemistry are actually stereo-centres.
  • Constructor Details

    • StereoElementFactory

      protected StereoElementFactory(IAtomContainer container, int[][] graph, GraphUtil.EdgeToBondMap bondMap)
      Internal constructor.
      Parameters:
      container - an atom container
      graph - adjacency list representation
      bondMap - lookup bonds by atom index
  • Method Details

    • createAll

      public List<IStereoElement> createAll()
      Creates all stereo elements found by Stereocenters using the or 2D/3D coordinates to specify the configuration (clockwise/anticlockwise). Currently only ITetrahedralChirality and IDoubleBondStereochemistry elements are created..
      Returns:
      a list of stereo elements
    • interpretProjections

      public StereoElementFactory interpretProjections(Projection... projections)
      Indicate that stereochemistry drawn as a certain projection should be interpreted.
      
       StereoElementFactory factory =
         StereoElementFactory.using2DCoordinates(container)
                             .interpretProjections(Projection.Fischer, Projection.Haworth);
       
      Parameters:
      projections - types of projection
      Returns:
      self
      See Also:
    • checkSymmetry

      public StereoElementFactory checkSymmetry(boolean check)
    • withStrictMode

      public StereoElementFactory withStrictMode()
      Enables stricter stereochemistry checking, specifically tetrahedral centres may not be created from inverse down wedges (i.e. Daylight style depictions). This also sets that all stereocentres are tested for asymmetry.
      Returns:
      stereo element factory.
    • using2DCoordinates

      public static StereoElementFactory using2DCoordinates(IAtomContainer container)
      Create a stereo element factory for creating stereo elements using 2D coordinates and depiction labels (up/down, wedge/hatch).
      Parameters:
      container - the structure to create the factory for
      Returns:
      the factory instance
    • using3DCoordinates

      public static StereoElementFactory using3DCoordinates(IAtomContainer container)
      Create a stereo element factory for creating stereo elements using 3D coordinates and depiction labels (up/down, wedge/hatch).
      Parameters:
      container - the structure to create the factory for
      Returns:
      the factory instance