Class SmilesParser


  • public class SmilesParser
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      SmilesParser()
      Creates a new SmilesParser that doesn't allow SMARTS features to be present in parsed strings.
      SmilesParser​(int smartsMode, boolean createSmartsWarnings)
      Creates a new SmilesParser that may or may not allow SMARTS features to be present in parsed strings.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getSmartsWarning()
      If createSmartsWarning in the constructor was passed as true, then this method returns a list of all SMARTS features, which could not be interpreted in the most recently parsed SMILES/SMARTS pattern.
      static void main​(java.lang.String[] args)  
      void parse​(StereoMolecule mol, byte[] smiles)  
      void parse​(StereoMolecule mol, byte[] smiles, boolean createCoordinates, boolean readStereoFeatures)  
      void parse​(StereoMolecule mol, byte[] smiles, int position, int endIndex)  
      void parse​(StereoMolecule mol, byte[] smiles, int position, int endIndex, boolean createCoordinates, boolean readStereoFeatures)  
      void parse​(StereoMolecule mol, java.lang.String smiles)
      Parses the given smiles into the molecule, creates proper atom coordinates to reflect correct double bond geometries and translates tetrahedral and allene parities into up/down-bonds.
      Reaction parseReaction​(byte[] smiles)  
      Reaction parseReaction​(java.lang.String smiles)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SmilesParser

        public SmilesParser()
        Creates a new SmilesParser that doesn't allow SMARTS features to be present in parsed strings. SMARTS features cause an exception. The fragment flag of created molecules is never set.
      • SmilesParser

        public SmilesParser​(int smartsMode,
                            boolean createSmartsWarnings)
        Creates a new SmilesParser that may or may not allow SMARTS features to be present in parsed strings. If smartsMode is SMARTS_MODE_IS_SMILES, then any SMARTS features cause an exception. If smartsMode is SMARTS_MODE_IS_SMARTS, then the input string is considered a SMARTS, e.g. 'CC' is taken as fragment of two non-aromatic carbon atoms connected by a single bond and without any implicit hydrogen atoms. If smartsMode is SMARTS_MODE_IS_GUESS, then molecules is never set.
        Parameters:
        smartsMode - one of SMARTS_MODE...
        createSmartsWarnings - if true, then getSmartsWarning() may be used after parsing a SMILES or SMARTS
    • Method Detail

      • parseReaction

        public Reaction parseReaction​(java.lang.String smiles)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parseReaction

        public Reaction parseReaction​(byte[] smiles)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getSmartsWarning

        public java.lang.String getSmartsWarning()
        If createSmartsWarning in the constructor was passed as true, then this method returns a list of all SMARTS features, which could not be interpreted in the most recently parsed SMILES/SMARTS pattern.
        Returns:
      • parse

        public void parse​(StereoMolecule mol,
                          java.lang.String smiles)
                   throws java.lang.Exception
        Parses the given smiles into the molecule, creates proper atom coordinates to reflect correct double bond geometries and translates tetrahedral and allene parities into up/down-bonds. SMARTS features are neglected unless setAllowSmartsFeatures(true) was called before parsing.
        Parameters:
        mol -
        smiles -
        Throws:
        java.lang.Exception
      • parse

        public void parse​(StereoMolecule mol,
                          byte[] smiles)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parse

        public void parse​(StereoMolecule mol,
                          byte[] smiles,
                          int position,
                          int endIndex)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parse

        public void parse​(StereoMolecule mol,
                          byte[] smiles,
                          boolean createCoordinates,
                          boolean readStereoFeatures)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parse

        public void parse​(StereoMolecule mol,
                          byte[] smiles,
                          int position,
                          int endIndex,
                          boolean createCoordinates,
                          boolean readStereoFeatures)
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • main

        public static void main​(java.lang.String[] args)