Toolkit Tutorial: Programming


  1. Introduction
  2. Dataypes, Objects, & Relationships
  3. SMILES - Molecules
  4. SMILES - Reactions
  5. SMARTS - Patterns
  6. SMIRKS - Transforms
  7. Exercises

  1. Introduction
  2. The Daylight Toolkits...

    ... are a set of shared object libraries and header files.
    ... give programmers the power to handle complex chemistry with ease.
    ... use a robust, consistent and well-defined API.
    ... are written to allow cross-platform portability and language-independence.

  3. Datatypes, Objects, & Relationships
  4. Datatypes

    Several fundamental datatypes are used by the toolkit in order to generalize platform-specific handling of data. The following table lists the datatypes that facilitate cross-platform portability:

    Datatype Concept & Example
    dt_Boolean Concept: Logical
    Example: The dt_Boolean datatype represents one bit of information. Valid values are 1 (for TRUE) and 0 (for FALSE).
    dt_Integer Concept: Integral
    Example: The dt_Integer datatype represents whole numbers within the range of 2^31 to -2^31.
    dt_Real Concept: Floating-point
    Example: The dt_Real datatype represents floating-point values (2-2^23)^127 to -(2-2^23)^127 and is not able to represent zero.
    dt_String Concept: Character Array
    Example: The dt_String datatype represents an array of characters. For platform independence, the length of the character array is specified with an associated dt_Integer datatype, not with a character (i.e., NULL) within the array. Functions that return a string typically accept the address of the dt_Integer as the first parameter, which is used to pass the length of the string back to the caller.

    Objects

    A generic datatype, called a handle, is used to represent all objects in the toolkit. An object handle is an integer. The value of the handle is a number, and that number has meaning within the toolkit. It's clean and simple. The opaqueness of objects and standardization of the toolkit interface makes the toolkit stable and enables predictable and reproducible behavior.

    Datatype Concept & Example
    dt_Handle Concept: Object Handling
    Example: A handle is an integer representing an object. The integer is an index into the internal toolkit table. A handle is used to represent objects, including: Atom, Bond, Cycle, Molecule, Reaction, Pattern, Pathset, Path, Transform, Stream, Sequence.
    Typically, the first object created with the toolkit is represented by the number one, the second object is number two, and so on. The integer is an index into an internal table and the toolkit efficiently sorts out everything from there. Further, representing objects in this way makes them opaque - you can't access data about the objects directly, only operate on them with a variety of methods.

    The following shapes are used in the following figures:

    Shape Concept & Example
    Concept: Basic Object
    Example: Molecule, Reaction, Pattern, Transform
    Concept: Child Object
    Example: Atom, Bond, Cycle, Molecule in a Reaction
    Concept: Container Object
    Example: Stream, Sequence

    Relationships

    Object Concept & Example
    Concept: A child is an integral part of a parent.
    Example: Code
    Concept: A child affects its parent.
    Example: Code
    Concept: A parent owns its child.
    Example: Code
    Concept: A parent is directly accessible from the child.
    Example: Code

  5. SMILES - Molecules
  6. Object Concept & Example
    Concept: A molecule is input and output using the SMILES Toolkit.
    Example: Code
    Concept: A stream is a container object.
    Example: Code
    Concept: A stream is like a linked list.
    Example: Code
    Concept: A stream is derived from a base object.
    Example: Code
    Concept: A stream is invalid when its base object changes.
    Example: Code

  7. SMILES - Reactions
  8. Object Concept & Example
    Concept: A reaction is input and output using the SMILES Toolkit with reaction capabilities.
    Example: Code
    Concept: A stream is a container object.
    Example: Code
    Concept: A stream is like a linked list.
    Example: Code
    Concept: A stream is derived from a base object.
    Example: Code
    Concept: A stream may become invalid when its base object changes.
    Example: Code

  9. SMARTS - Patterns
  10. Object Concept & Example
    Concept: A pattern object is input using the SMARTS Toolkit.
    Example: Code
    Concept: A pattern object and either a molecule or reaction are used to find matching paths.
    Example: Code
    Concept: A pathset object is a set of paths.
    Example: Code
    Concept: A path object is a set of atoms and bonds.
    Example: Code
    Concept: A pathset and its paths are derived from a base object.
    Example: Code
    Concept: A pathset and path may become invalid when its base object changes.
    Example: Code
    Concept: A stream is a container object
    Example: Code
    Concept: A stream is like a linked list.
    Example: Code
    Concept: A stream is derived from a base object.
    Example: Code
    Concept: A stream may become invalid when its base object changes.
    Example: Code

  11. SMIRKS - Transforms
  12. Object Concept & Example
    Concept: A transform object is input using the SMILES Toolkit with reaction capabilities.
    Example: Code
    Concept: A sequence is a container object.
    Example: Code
    Concept: A sequence is like a linked list
    Example: Code
    Concept: A sequence is completely separate and not derived from another object.
    Example: Code
    Concept: A sequence does not become invalid when other objects change.
    Example: Code
    Concept: A transform object and a sequence of molecules are used to transform the molecules into a sequence of reactions.
    Example: Code

Next Section: Programming Exercises


Michael A. Kappler
Last modified: Wed Jun 9 15:20:03 MDT 2004