|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchemaxon.jep.Evaluator
public class Evaluator
Evaluates Chemical Terms expressions.
Provides command line interface or creates ChemJEP
objects according to configuration.
See the documentation for details:
API usage examples:
// create Evaluator Evaluator evaluator = new Evaluator(); // create ChemJEP, compile the Chemical Terms expression ChemJEP chemJEP = evaluator.compile("logP()", MolContext.class); // create context MolContext context = new MolContext(); MolImporter importer = new MolImporter("mols.smiles"); Molecule mol = null; while ((mol = importer.read()) != null) { // set the input molecule context.setMolecule(mol); // get the result by evaluating the expression // note: "logP()" expression returns a double, so // evaluate_double(ChemContext) method is used double result = chemJEP.evaluate_double(context); // write output System.out.println(result); } importer.close();
// create Evaluator Evaluator evaluator = new Evaluator(); // create ChemJEP, compile the Chemical Terms expression ChemJEP chemJEP = evaluator.compile( "mass()<=500 && logP()<=5 && donorCount()<=5 && acceptorCount()<=10", MolContext.class); // create context MolContext context = new MolContext(); MolExporter exporter = new MolExporter(System.out, "smiles"); MolImporter importer = new MolImporter("mols.smiles"); Molecule mol = null; while ((mol = importer.read()) != null) { // set the input molecule context.setMolecule(mol); // filter molecules that fulfill the previously set // Chemical Terms expression (only molecules that // fulfill the expression are written to output) if(chemJEP.evaluate_boolean(context)) { exporter.write(mol); } } importer.close(); exporter.close();
Field Summary | |
---|---|
static java.lang.String |
CONFIG_DIR
Default directory for storing configuration files. |
static java.lang.String |
DEFAULT_TAG_NAME
Default SDFile tag to store the evaluation result. |
static java.lang.String |
EVALUATOR_DEFAULTS_FILE
Default Function/Plugin settings filename. |
static java.lang.String |
EVALUATOR_NAMED_MOLS_FILE
Default named molecule set filename. |
static java.lang.String |
EVALUATOR_SCRIPT_FILE
Initial script filename. |
Constructor Summary | |
---|---|
Evaluator()
Default constructor. |
|
Evaluator(java.io.File file)
Constructor. |
|
Evaluator(java.io.File file,
Standardizer standardizer)
Constructor. |
|
Evaluator(java.io.File file,
Standardizer standardizer,
MolImporter importer,
java.lang.String script)
Deprecated. |
|
Evaluator(Standardizer standardizer)
Constructor. |
|
Evaluator(java.lang.String configString)
Constructor. |
|
Evaluator(java.lang.String configString,
Standardizer standardizer)
Constructor. |
|
Evaluator(java.lang.String configString,
Standardizer standardizer,
MolImporter importer,
java.lang.String script)
Deprecated. |
Method Summary | |
---|---|
ChemJEP |
compile(java.lang.String expression)
Compiles the expression, creates ChemJEP object. |
ChemJEP |
compile(java.lang.String expression,
java.lang.Class contextClass)
Compiles the expression, creates ChemJEP object. |
ChemJEP |
compile(java.lang.String expression,
java.lang.Class contextClass,
chemaxon.nfunk.jep.SymbolTable stab)
Compiles the expression, creates ChemJEP object. |
java.util.Hashtable<java.lang.String,java.lang.String> |
getFunctionalGroupDisplayMolTable()
Returns a hashtable containing |functional group name| -> |displayable molecule representation|. |
java.util.Hashtable<java.lang.String,chemaxon.jep.CTFunctionData> |
getFunctionData()
Returns information about Chemical Terms functions wrapped in chemaxon.jep.CTFunctionData objects. |
java.util.Hashtable<java.lang.String,chemaxon.jep.CTFunctionData> |
getFunctionData(boolean addServices)
Returns information about Chemical Terms functions wrapped in chemaxon.jep.CTFunctionData objects. |
java.util.Hashtable |
getFunctionParameterData()
Deprecated. use getFunctionData() |
java.lang.String[] |
getPluginIDs()
Deprecated. use getFunctionData() |
java.lang.String |
getServicesConfigurationPath()
Returns the custom services configuration path. |
chemaxon.nfunk.jep.SymbolTable |
getSymbolTable()
Returns the symbol table of predefined constants (molecules, molecule sets and other constants defined in the built-in and the user-defined jep.script). |
static void |
main(java.lang.String[] args)
The command line version entry point. |
void |
runScript(java.lang.String script)
Runs a script, variables will be added to the base variable table and can be referenced by chemical expressions. |
void |
setFingerprintGenerator(FingerprintGenerator fg)
Sets the fingerprint generator object (needed for query strings). |
void |
setLicenseEnvironment(java.lang.String env)
For internal usage only. |
void |
setServicesConfigurationPath(java.lang.String servicesConfigurationPath)
Sets the custom services configuration path. |
void |
setVerbose(boolean verbose)
Sets verbose mode. |
static java.lang.String |
toString(java.lang.Object o)
Deprecated. For internal use only. |
static java.lang.String |
toString(java.lang.Object o,
java.text.DecimalFormat df)
Deprecated. For internal use only. |
static java.lang.String |
toString(java.lang.Object o,
int precision)
Deprecated. For internal use only. |
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 EVALUATOR_DEFAULTS_FILE
public static final java.lang.String EVALUATOR_NAMED_MOLS_FILE
public static final java.lang.String CONFIG_DIR
public static final java.lang.String EVALUATOR_SCRIPT_FILE
public static final java.lang.String DEFAULT_TAG_NAME
Constructor Detail |
---|
public Evaluator() throws chemaxon.nfunk.jep.ParseException
chemaxon.nfunk.jep.ParseException
public Evaluator(Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
standardizer
- is the standardizer object
chemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(java.io.File file) throws chemaxon.nfunk.jep.ParseException
file
- is the XML configuration file
chemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(java.lang.String configString) throws chemaxon.nfunk.jep.ParseException
configString
- is the XML configuration string
chemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(java.io.File file, Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
file
- is the XML configuration filestandardizer
- is the standardizer object
chemaxon.nfunk.jep.ParseException
- on error@Deprecated public Evaluator(java.io.File file, Standardizer standardizer, MolImporter importer, java.lang.String script) throws chemaxon.nfunk.jep.ParseException
file
- is the XML configuration filestandardizer
- is the standardizer objectimporter
- is the MolImporter
object used for loading named molecule sets
(if null
, then default molecule sets are loaded)script
- is the initial script (Chemical Terms expression; if null
, then default initial
scripts are run)
chemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(java.lang.String configString, Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
configString
- is the XML configuration stringstandardizer
- is the standardizer object
chemaxon.nfunk.jep.ParseException
- on error@Deprecated public Evaluator(java.lang.String configString, Standardizer standardizer, MolImporter importer, java.lang.String script) throws chemaxon.nfunk.jep.ParseException
configString
- is the XML configuration stringstandardizer
- is the standardizer objectimporter
- is the MolImporter
object used for loading named molecule sets
(if null
, then default molecule sets are loaded)script
- is the initial script (Chemical Terms expression; if null
, then default initial
scripts are run)
chemaxon.nfunk.jep.ParseException
- on errorMethod Detail |
---|
public void setLicenseEnvironment(java.lang.String env)
env
- the license environmentpublic void runScript(java.lang.String script) throws chemaxon.nfunk.jep.ParseException
script
- is the script (Chemical Terms expression)
chemaxon.nfunk.jep.ParseException
- on errorpublic java.util.Hashtable getFunctionParameterData() throws chemaxon.nfunk.jep.ParseException
getFunctionData()
UserParam
sections
of the configuration XML. The keys are the function IDs, the values
are the corresponding parameter record arrays:
<function ID> -> UserParam[]
chemaxon.nfunk.jep.ParseException
- on configuration errorpublic java.lang.String[] getPluginIDs() throws chemaxon.nfunk.jep.ParseException
getFunctionData()
Plugins
section
of the configuration XML.
chemaxon.nfunk.jep.ParseException
- on configuration errorpublic java.util.Hashtable<java.lang.String,chemaxon.jep.CTFunctionData> getFunctionData() throws chemaxon.nfunk.jep.ParseException
<function ID> -> CTFunctionDataFor internal use only.
chemaxon.nfunk.jep.ParseException
- on configuration errorpublic java.util.Hashtable<java.lang.String,chemaxon.jep.CTFunctionData> getFunctionData(boolean addServices) throws chemaxon.nfunk.jep.ParseException
<function ID> -> CTFunctionDataFor internal use only.
addServices
- if true
then services data will be added as function data
chemaxon.nfunk.jep.ParseException
- on configuration errorpublic java.lang.String getServicesConfigurationPath()
null
if using marvin's default lookuppublic void setServicesConfigurationPath(java.lang.String servicesConfigurationPath)
servicesConfigurationPath
- the new file path or URL. Set null
to use marvin's default lookuppublic chemaxon.nfunk.jep.SymbolTable getSymbolTable()
public java.util.Hashtable<java.lang.String,java.lang.String> getFunctionalGroupDisplayMolTable()
public void setFingerprintGenerator(FingerprintGenerator fg)
fg
- is the fingerprint generator objectpublic void setVerbose(boolean verbose)
verbose
- is true if verbose modepublic ChemJEP compile(java.lang.String expression) throws chemaxon.nfunk.jep.ParseException
ChemJEP
object.
Call ChemJEP.evaluate(ChemContext)
to evaluate the expression.
expression
- is the expression string
ChemJEP
object
chemaxon.nfunk.jep.ParseException
- on compile errorpublic ChemJEP compile(java.lang.String expression, java.lang.Class contextClass) throws chemaxon.nfunk.jep.ParseException
ChemJEP
object.
Call ChemJEP.evaluate(ChemContext)
to evaluate the expression.
expression
- is the expression stringcontextClass
- is the evaluation context class object
ChemJEP
object
chemaxon.nfunk.jep.ParseException
- on compile errorpublic ChemJEP compile(java.lang.String expression, java.lang.Class contextClass, chemaxon.nfunk.jep.SymbolTable stab) throws chemaxon.nfunk.jep.ParseException
ChemJEP
object.
Call ChemJEP.evaluate(ChemContext)
to evaluate the expression.
expression
- is the expression stringcontextClass
- is the evaluation context class objectstab
- is the vaiable table, null if the default varibale table
should be used
ChemJEP
object
chemaxon.nfunk.jep.ParseException
- on compile errorpublic static java.lang.String toString(java.lang.Object o)
2
fractional digits.
o
- is the object
public static java.lang.String toString(java.lang.Object o, int precision)
o
- is the objectprecision
- is the number of fractional digits
public static java.lang.String toString(java.lang.Object o, java.text.DecimalFormat df)
o
- is the objectdf
- is the real-number formatter
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- the command line parameters
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |