|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.reaction.Standardizer
public class Standardizer
Performs the standardization actions determined by the XML config file, or simple config string.
See the documentation for details:
API usage examples:
Standardizer st = new Standardizer(new File("standardize.xml"));
st.standardize(mol);
// create Standardizer with XML configuration file
Standardizer standardizer = new Standardizer(new File("config.xml"));
// set final clean action to arrange changed atoms and reaction components
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();
| 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 | |
|---|---|
boolean |
addInactiveTasks(java.lang.String str)
Adds the Standardizer tasks specified in the str parameter to the inactive tasks list. |
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 |
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)
Deprecated. Use ConcurrentStandardizerProcessor.main(String[]) |
boolean |
removeInactiveTasks(java.lang.String str)
Removes the Standardizer tasks specified in the str parameter from the inactive tasks list. |
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)
Deprecated. Not used. |
void |
setInactiveTasks(java.lang.String str)
Deprecated. Use addInactiveTasks(String) instead |
void |
setLicenseEnvironment(java.lang.String env)
For internal usage only. |
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 |
|---|
public static final java.lang.String GROUP_QUERY
public static final java.lang.String GROUP_TARGET
public static java.util.HashSet SET_TARGET
public static final java.lang.String FINAL_CLEAN_ID
| Constructor Detail |
|---|
public Standardizer(java.lang.String str)
throws StandardizerException
setCleanTemplates(chemaxon.struc.Molecule[]))
str - is the XML configuration string
or else the simple config string, items separated by ".."
StandardizerException - if invalid config data is given
public Standardizer(java.io.File file)
throws StandardizerException
file - is the configuration XML input file
StandardizerException - if invalid config data is given
public Standardizer(java.io.InputStream is)
throws StandardizerException
is - is the configuration XML input stream
StandardizerException - if invalid config data is given
public Standardizer(org.dom4j.Element configElement,
java.lang.String dir)
throws StandardizerException
configElement - is the config root DOM elementdir - is the root directory
StandardizerException - if invalid config data is given
public Standardizer(org.dom4j.Element configElement)
throws StandardizerException
configElement - is the config root DOM element
StandardizerException - if invalid config data is given| Method Detail |
|---|
public boolean isLicensed()
isLicensed in interface chemaxon.license.Licensablepublic void setLicenseEnvironment(java.lang.String env)
setLicenseEnvironment in interface chemaxon.license.Licensableenv - the license environmentpublic void setAtomIndexQuery(boolean atomIndexQuery)
getOldToNew() and getNewToOld().
The atom index map storage has some overhead.
Should be set to true only if the above two methods are needed
to be called. Default: false.
atomIndexQuery - is true if atom index map query is requiredpublic int[] getOldToNew()
setAtomIndexQuery(boolean),
otherwise returns null.
public int[] getNewToOld()
setAtomIndexQuery(boolean),
otherwise returns null.
public void setCleanTemplates(Molecule[] templates)
<Clean Type="TemplateBased"/>
"clean:tb"
templates - is the template molecule arraypublic void setActiveGroup(java.lang.String group)
setInactiveTasks(String)
group - is the task grouppublic void setActiveGroups(java.lang.String[] groups)
groups - is the task group arraypublic java.lang.String[] getActiveGroups()
setActiveGroups(java.lang.String[])
public void setInactiveTasks(java.lang.String str)
throws StandardizerException
addInactiveTasks(String) instead
str parameter to the inactive tasks list.
Only the task type is checked. E.g. if "RemoveExplicitH" tasks are set, then these tasks are always
inactivated regardless to the parameters (e.g.: Mapped="true") they use.
Inactive tasks are not performed during standardization. To clear the inactive tasks list
use clearInactiveTasks() method.
For internal use only.
str - is the XML configuration string or else the simple config string, items separated by ".."
StandardizerException - if the configuration string is invalidclearInactiveTasks(),
removeInactiveTasks(String)
public boolean addInactiveTasks(java.lang.String str)
throws StandardizerException
str parameter to the inactive tasks list.
Only the task type is checked. E.g. if "RemoveExplicitH" tasks are added, then these tasks are always
inactivated regardless to the parameters (e.g.: Mapped="true") they use.
Inactive tasks are not performed during standardization. To remove a task from the inactive task list
use removeInactiveTasks(String), to clear the inactive tasks list use clearInactiveTasks()
method.
For internal use only.
str - is the XML configuration string or else the simple config string, items separated by ".."
true if the inactive task list has changed
StandardizerException - if the configuration string is invalidclearInactiveTasks(),
removeInactiveTasks(String)
public boolean removeInactiveTasks(java.lang.String str)
throws StandardizerException
str parameter from the inactive tasks list.
Only the task type is checked.
For internal use only.
str - is the XML configuration string or else the simple config string, items separated by ".."
true if the inactive task list has changed
StandardizerException - if the configuration string is invalidsetInactiveTasks(String),
clearInactiveTasks()public void clearInactiveTasks()
setInactiveTasks(String),
removeInactiveTasks(String)
public void setFinalClean()
throws StandardizerException
StandardizerException
public void setFinalClean(int dim)
throws StandardizerException
dim - is the clean dimension, set -1 for the original molecule dimension
StandardizerException
public void setFinalClean(int dim,
boolean partial)
throws StandardizerException
dim - is the clean dimension,
currently partial clean only works in 2D - if set to 3 then full
clean is performedpartial - is true if only the changing atoms should be cleaned,
false if full clean is needed - if the clean dimension is
different from the molecule dimension then always full clean is performed
StandardizerException
public void setFinalClean(int dim,
boolean partial,
java.util.HashSet groups)
throws StandardizerException
dim - is the clean dimension,
currently partial clean only works in 2D - if set to 3 then full
clean is performedpartial - is true if only the changing atoms should be cleaned,
false if full clean is needed - if the clean dimension is
different from the molecule dimension then always full clean is performedgroups - is the group set
StandardizerException
public Molecule standardize(Molecule mol)
throws chemaxon.sss.search.SearchException,
chemaxon.license.LicenseException
standardize in interface Standardizermol - is the input molecule to be standardized
chemaxon.sss.search.SearchException - if the product consists of more than 1 molecules
or a search exception is raised in the process
chemaxon.license.LicenseException - if there is no valid license
public void standardize(Molecule[] mols)
throws chemaxon.sss.search.SearchException,
chemaxon.license.LicenseException
mols - is the input molecule array to be standardized
chemaxon.sss.search.SearchException - if a search exception is raised in the process
chemaxon.license.LicenseException - if there is no license key and the number of
calls without a license key has been reachedpublic int[] getAppliedTaskIndexes()
public java.lang.String[] getAppliedTaskIDs()
FINAL_CLEAN_ID corresponds to the final clean action.
public boolean isLastTaskClean()
true if last task is clean or there are no tasks
(final clean not needed before output to file).
true if last task is clean or there are no tasks
public static void main(java.lang.String[] args)
throws java.lang.Exception
ConcurrentStandardizerProcessor.main(String[])
args - is the command line argument array
java.lang.Exception - on error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||