|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectchemaxon.reaction.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:
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 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();
| 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,
int style)
Deprecated. As of JChem 3.2 Standardizer automatically handles the mapping style of the reaction scheme. Use Standardizer(Element). |
|
Standardizer(org.dom4j.Element configElement,
java.lang.String dir)
Constructor. |
|
Standardizer(org.dom4j.Element configElement,
java.lang.String dir,
int style)
Deprecated. As of JChem 3.2 Standardizer automatically handles the mapping style of the reaction scheme. Use Standardizer(Element, String). |
|
Standardizer(java.io.File file)
Constructor. |
|
Standardizer(java.io.File file,
int style)
Deprecated. As of JChem 3.2 Standardizer automatically handles the mapping style of the reaction scheme. Use Standardizer(File). |
|
Standardizer(java.io.InputStream is)
Constructor. |
|
Standardizer(java.io.InputStream is,
int style)
Deprecated. As of JChem 3.2 Standardizer automatically handles the mapping style of the reaction scheme. Use Standardizer(InputStream). |
|
Standardizer(java.lang.String str)
Constructor. |
|
Standardizer(java.lang.String str,
int style)
Deprecated. As of JChem 3.2 Standardizer automatically handles the mapping style of the reaction scheme. Use Standardizer(String). |
|
| 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 |
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
public Standardizer(java.lang.String str,
int style)
throws StandardizerException
Standardizer(String).
IMPORTANT: this item should precede all reaction SMARTS items in the
simple config string, should be set in the MappingStyle
attribute of the Actions XML tag in case of XML config
setCleanTemplates(chemaxon.struc.Molecule[]))
0 for mapping changing atoms (chemaxon style),
1 for mapping matching atoms (daylight style),
2 for partial mapping (to be completed by automap)
str - is the XML configuration string
or else the simple config string, items separated by ".."style - is the reaction mapping style
StandardizerException - if invalid config data is givenStandardizer(String)
public Standardizer(java.io.File file,
int style)
throws StandardizerException
Standardizer(File).
0 for mapping changing atoms (chemaxon style),
1 for mapping matching atoms (daylight style),
2 for partial mapping (to be completed by automap)
file - is the configuration XML input filestyle - is the reaction mapping style
StandardizerException - if invalid config data is givenStandardizer(File)
public Standardizer(java.io.InputStream is,
int style)
throws StandardizerException
Standardizer(InputStream).
0 for mapping changing atoms (chemaxon style),
1 for mapping matching atoms (daylight style),
2 for partial mapping (to be completed by automap)
is - is the configuration XML input streamstyle - is the reaction mapping style
StandardizerException - if invalid config data is givenStandardizer(InputStream)
public Standardizer(org.dom4j.Element configElement,
java.lang.String dir,
int style)
throws StandardizerException
Standardizer(Element, String).
0 for mapping changing atoms (chemaxon style),
1 for mapping matching atoms (daylight style),
2 for partial mapping (to be completed by automap)
configElement - is the config root DOM elementdir - is the root directorystyle - is the reaction mapping style
StandardizerException - if invalid config data is givenStandardizer(Element, String)
public Standardizer(org.dom4j.Element configElement,
int style)
throws StandardizerException
Standardizer(Element).
0 for mapping changing atoms (chemaxon style),
1 for mapping matching atoms (daylight style),
2 for partial mapping (to be completed by automap)
configElement - is the config root DOM elementstyle - is the reaction mapping style
StandardizerException - if invalid config data is givenStandardizer(Element)| Method Detail |
public boolean isLicensed()
public void setLicenseEnvironment(java.lang.String env)
public 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 setOptionalTasksEnabled(boolean optionals)
setActiveGroups(java.lang.String[])
and setActiveGroup(java.lang.String) which in turn were replaced
by setInactiveTasks(String) as of 5.0
true.
optionals - is true if optional actions should be processedpublic boolean getOptionalTasksEnabled()
getActiveGroups()
true if optional actions should be processed,
false if skipped.
public 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
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()public void clearInactiveTasks()
setInactiveTasks(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,
LicenseException
mol - 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
LicenseException - if there is no license and max call count has been reached
public void standardize(Molecule[] mols)
throws chemaxon.sss.search.SearchException,
LicenseException
mols - is the input molecule array to be standardized
chemaxon.sss.search.SearchException - if a search exception is raised in the process
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
args - is the command line argument array
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||