public class Evaluator extends Object implements Serializable
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();
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_DIR
Default directory for storing configuration files.
|
static String |
DEFAULT_TAG_NAME
Default SDFile tag to store the evaluation result.
|
static String |
EVALUATOR_DEFAULTS_FILE
Default Function/Plugin settings filename.
|
static String |
EVALUATOR_NAMED_MOLS_FILE
Default named molecule set filename.
|
static String |
EVALUATOR_SCRIPT_FILE
Initial script filename.
|
Constructor and Description |
---|
Evaluator()
Default constructor.
|
Evaluator(File file)
Constructor.
|
Evaluator(File file,
Standardizer standardizer)
Constructor.
|
Evaluator(File file,
Standardizer standardizer,
MolImporter importer,
String script)
Deprecated.
|
Evaluator(Standardizer standardizer)
Constructor.
|
Evaluator(String configString)
Constructor.
|
Evaluator(String configString,
Standardizer standardizer)
Constructor.
|
Evaluator(String configString,
Standardizer standardizer,
MolImporter importer,
String script)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ChemJEP |
compile(String expression)
Compiles the expression, creates
ChemJEP object. |
ChemJEP |
compile(String expression,
Class contextClass)
Compiles the expression, creates
ChemJEP object. |
ChemJEP |
compile(String expression,
Class contextClass,
chemaxon.nfunk.jep.SymbolTable stab)
Compiles the expression, creates
ChemJEP object. |
Hashtable<String,String> |
getFunctionalGroupDisplayMolTable()
Returns a hashtable containing |functional group name| -> |displayable molecule representation|.
|
Hashtable<String,chemaxon.jep.CTFunctionData> |
getFunctionData()
Returns information about Chemical Terms functions wrapped in chemaxon.jep.CTFunctionData objects.
|
Hashtable<String,chemaxon.jep.CTFunctionData> |
getFunctionData(boolean addServices)
Returns information about Chemical Terms functions wrapped in chemaxon.jep.CTFunctionData objects.
|
Hashtable |
getFunctionParameterData()
Deprecated.
|
String[] |
getPluginIDs()
Deprecated.
|
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(String[] args)
The command line version entry point.
|
void |
runScript(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(String env)
For internal usage only.
|
void |
setServicesConfigurationPath(String servicesConfigurationPath)
Sets the custom services configuration path.
|
void |
setVerbose(boolean verbose)
Sets verbose mode.
|
static String |
toString(Object o)
Deprecated.
For internal use only.
|
static String |
toString(Object o,
DecimalFormat df)
Deprecated.
For internal use only.
|
static String |
toString(Object o,
int precision)
Deprecated.
For internal use only.
|
public static final String EVALUATOR_DEFAULTS_FILE
public static final String EVALUATOR_NAMED_MOLS_FILE
public static final String CONFIG_DIR
public static final String EVALUATOR_SCRIPT_FILE
public static final String DEFAULT_TAG_NAME
public Evaluator() throws chemaxon.nfunk.jep.ParseException
chemaxon.nfunk.jep.ParseException
public Evaluator(Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
standardizer
- is the standardizer objectchemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(File file) throws chemaxon.nfunk.jep.ParseException
file
- is the XML configuration filechemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(String configString) throws chemaxon.nfunk.jep.ParseException
configString
- is the XML configuration stringchemaxon.nfunk.jep.ParseException
- on errorpublic Evaluator(File file, Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
file
- is the XML configuration filestandardizer
- is the standardizer objectchemaxon.nfunk.jep.ParseException
- on error@Deprecated public Evaluator(File file, Standardizer standardizer, MolImporter importer, 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(String configString, Standardizer standardizer) throws chemaxon.nfunk.jep.ParseException
configString
- is the XML configuration stringstandardizer
- is the standardizer objectchemaxon.nfunk.jep.ParseException
- on error@Deprecated public Evaluator(String configString, Standardizer standardizer, MolImporter importer, 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 errorpublic void setLicenseEnvironment(String env)
env
- the license environmentpublic void runScript(String script) throws chemaxon.nfunk.jep.ParseException
script
- is the script (Chemical Terms expression)chemaxon.nfunk.jep.ParseException
- on error@Deprecated public 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 error@Deprecated public String[] getPluginIDs() throws chemaxon.nfunk.jep.ParseException
getFunctionData()
Plugins
section
of the configuration XML.chemaxon.nfunk.jep.ParseException
- on configuration errorpublic Hashtable<String,chemaxon.jep.CTFunctionData> getFunctionData() throws chemaxon.nfunk.jep.ParseException
<function ID> -> CTFunctionDataFor internal use only.
chemaxon.nfunk.jep.ParseException
- on configuration errorpublic Hashtable<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 datachemaxon.nfunk.jep.ParseException
- on configuration errorpublic String getServicesConfigurationPath()
null
if using marvin's default lookuppublic void setServicesConfigurationPath(String servicesConfigurationPath)
servicesConfigurationPath
- the new file path or URL. Set null
to use marvin's default lookuppublic chemaxon.nfunk.jep.SymbolTable getSymbolTable()
public Hashtable<String,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(String expression) throws chemaxon.nfunk.jep.ParseException
ChemJEP
object.
Call ChemJEP.evaluate(ChemContext)
to evaluate the expression.expression
- is the expression stringChemJEP
objectchemaxon.nfunk.jep.ParseException
- on compile errorpublic ChemJEP compile(String expression, 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 objectChemJEP
objectchemaxon.nfunk.jep.ParseException
- on compile errorpublic ChemJEP compile(String expression, 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 usedChemJEP
objectchemaxon.nfunk.jep.ParseException
- on compile error@Deprecated public static String toString(Object o)
2
fractional digits.o
- is the object@Deprecated public static String toString(Object o, int precision)
o
- is the objectprecision
- is the number of fractional digits@Deprecated public static String toString(Object o, DecimalFormat df)
o
- is the objectdf
- is the real-number formatter