chemaxon.reaction
Class Standardizer

java.lang.Object
  extended by chemaxon.reaction.Standardizer
All Implemented Interfaces:
Standardizer, java.io.Serializable

public class Standardizer
extends java.lang.Object
implements java.io.Serializable, Standardizer

Performs the standardization actions determined by the xml config file. This class can be used from command-line or from the API.
See the documentation for details:

API usage examples:

  1. A simple example:
     Standardizer st = new Standardizer(new File("standardize.xml"));
     st.standardize(mol);
     
  2. A more complex example with importing molecules, standardization with a final clean action to arrange changed atoms, storing standardization information in molecule properties and finally exporting the molecules in SDF format:
     // create Standardizer with XML configuration file
     Standardizer standardizer = new Standardizer(new File("config.xml"));
    
     // set final clean action to arranged changed atoms
     standardizer.setFinalClean();
    
     MolExporter exporter = new MolExporter(System.out, "sdf");
     MolImporter importer = new MolImporter("mols.sdf");
     Molecule mol = null;
     while ((mol = importer.read()) != null) {
    
         // standardize molecule
         standardizer.standardize(mol);
    
         // get applied task indexes
         int[] inds = standardizer.getAppliedTaskIndexes();
    
         // get applied task IDs
         String[] ids = standardizer.getAppliedTaskIDs();
    
         // store applied task indexes and IDs in molecule properties
         String indsprop = "";
         for (int i=0; i < inds.length; ++i) {
               indsprop += inds[i] + " ";
         }
         String idsprop = "";
         for (int i=0; i < ids.length; ++i) {
               idsprop += ids[i] + " ";
         }
         mol.setProperty("TASK_INDEXES", indsprop);
         mol.setProperty("TASK_IDS", idsprop);
    
         // write output
         exporter.write(mol);
     }
     importer.close();
     exporter.close();
     

Since:
JChem 2.0
Version:
JChem 5.1.2, 09/11/2008
Author:
Nora Mate, Zsolt Mohacsi
See Also:
Serialized Form

Field Summary
static java.lang.String FINAL_CLEAN_ID
          Final clean task ID.
static java.lang.String GROUP_QUERY
          Query group: "query".
static java.lang.String GROUP_TARGET
          Target group: "target".
static java.util.HashSet SET_TARGET
          Target group set: contains only "target".
 
Constructor Summary
Standardizer(org.dom4j.Element configElement)
          Constructor.
Standardizer(org.dom4j.Element configElement, java.lang.String dir)
          Constructor.
Standardizer(java.io.File file)
          Constructor.
Standardizer(java.io.InputStream is)
          Constructor.
Standardizer(java.lang.String str)
          Constructor.
 
Method Summary
 void clearInactiveTasks()
          Clears the inactive tasks list.
 java.lang.String[] getActiveGroups()
          Deprecated. Not used anymore.
 java.lang.String[] getAppliedTaskIDs()
          Returns the IDs of tasks applied to the last input molecule.
 int[] getAppliedTaskIndexes()
          Returns the indexes of tasks applied to the last input molecule.
 int[] getNewToOld()
          Returns the new -> old atom index mapping.
 int[] getOldToNew()
          Returns the old -> new atom index mapping.
 boolean getOptionalTasksEnabled()
          Deprecated. as of JChem 3.2, replaced by getActiveGroups()
 boolean isLastTaskClean()
          Returns true if last task is clean or there are no tasks (final clean not needed before output to file).
 boolean isLicensed()
           
static void main(java.lang.String[] args)
          Command line entry point.
 void setActiveGroup(java.lang.String group)
          Deprecated. Not used anymore. Practical examples may use setInactiveTasks(String)
 void setActiveGroups(java.lang.String[] groups)
          Deprecated. Not used anymore.
 void setAtomIndexQuery(boolean atomIndexQuery)
          Sets whether atom index query is possible.
 void setCleanTemplates(Molecule[] templates)
          Sets the default clean templates.
 void setFinalClean()
          Sets final clean task: original molecule dimension, partial, optional.
 void setFinalClean(int dim)
          Sets final clean task: partial, target-only.
 void setFinalClean(int dim, boolean partial)
          Sets final clean task: target-only.
 void setFinalClean(int dim, boolean partial, java.util.HashSet groups)
          Sets final clean task.
 void setInactiveTasks(java.lang.String str)
          Adds the Standardizer tasks specified in the str parameter to the inactive tasks list.
 void setLicenseEnvironment(java.lang.String env)
           
 void setOptionalTasksEnabled(boolean optionals)
          Deprecated. as of JChem 3.2, replaced by setActiveGroups(java.lang.String[]) and setActiveGroup(java.lang.String) which in turn were replaced by setInactiveTasks(String) as of 5.0
 Molecule standardize(Molecule mol)
          Standardization for one input molecule: performs the standardization actions according to the XML configuration.
 void standardize(Molecule[] mols)
          Standardization for more input molecules: performs the standardization reactions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_QUERY

public static final java.lang.String GROUP_QUERY
Query group: "query".

See Also:
Constant Field Values

GROUP_TARGET

public static final java.lang.String GROUP_TARGET
Target group: "target".

See Also:
Constant Field Values

SET_TARGET

public static java.util.HashSet SET_TARGET
Target group set: contains only "target".


FINAL_CLEAN_ID

public static final java.lang.String FINAL_CLEAN_ID
Final clean task ID.

See Also:
Constant Field Values
Constructor Detail

Standardizer

public Standardizer(java.lang.String str)
             throws StandardizerException
Constructor. Configuration is given as XML string or simple config string. A simple config string is a sequence of item strings, separated by "..". The order of the item strings determines the order of the corresponding actions. An item string is either a reaction SMARTS string or an action keyword. An action keyword is one of the following: