|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.PredictorPlugin
public class PredictorPlugin
Plugin class for running previously trained predictions on molecules.
API usage example:
// create plugin
PredictorPlugin plugin = new PredictorPlugin();
// set the prediction
try {
plugin.setPrediction("pampa");
} catch (PluginException e) {
System.err.println("Invalid prediction id, or parameter file for prediction cannot be loaded.");
// ...
}
// for each input molecule run the calculation and display the results
MolImporter importer = new MolImporter("mols.sdf");
Molecule mol = null;
int count = 0;
while ((mol = importer.read()) != null) {
// set the input molecule
plugin.setMolecule(mol);
// run the calculation
plugin.run();
// get the result
double predictedValue = plugin.getPredictedValue();
// print '[mol number]: predicted value'
System.out.println("["+(++count)+"]: "+predictedValue);
}
importer.close();
/*
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
| Field Summary |
|---|
| Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
|---|
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED |
| Constructor Summary | |
|---|---|
PredictorPlugin()
|
|
| Method Summary | |
|---|---|
java.lang.String |
getErrorMessage()
Returns the calculation error information message if CalculatorPlugin.run()
returned false (calculation error). |
double |
getPredictedValue()
Returns the predicted value. |
java.lang.String |
getProductName()
Returns the product identifier of the plugin as given by LicenseManager. |
java.lang.Object |
getResult(java.lang.Object type,
int index)
Returns the result item for the specified type and index. |
java.lang.Object |
getResult(java.lang.Object type,
java.lang.String arg)
Returns the result item for the specified argument string. |
java.lang.String |
getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result in String format. |
Molecule |
getResultMolecule()
Returns the result molecule for display. |
java.lang.Object[] |
getResultTypes()
Returns the result types. |
double |
getStandardError()
|
static java.lang.String[] |
getTrainingIds()
Returns the id's of available predictions. |
boolean |
needError()
|
boolean |
run()
Runs the tool. |
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule. |
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin. |
void |
setTraining(java.lang.String trainingId)
Sets the prediction. |
void |
standardize(Molecule mol)
Standardizes the molecule by performing the transformations necessary to run the plugin (aromatize, dehydrogenize, bring nitro groups to common form, ...). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PredictorPlugin()
| Method Detail |
|---|
public java.lang.String getProductName()
CalculatorPluginLicenseManager.
The name is used by the CalculatorPlugin.isLicensed() method.
getProductName in class CalculatorPlugin
protected void setInputMolecule(Molecule mol)
throws PluginException
CalculatorPlugin
setInputMolecule in class CalculatorPluginmol - is the input molecule
PluginException - on error
public void setParameters(java.util.Properties params)
throws PluginException
CalculatorPlugin
setParameters in class CalculatorPluginparams - is the parameter table
PluginException - on errorpublic static java.lang.String[] getTrainingIds()
public void setTraining(java.lang.String trainingId)
throws PluginException
trainingId - the training id
PluginException - if training id is invalid, or parameter file for training cannot be loaded
public boolean run()
throws PluginException
CalculatorPlugin
run in class CalculatorPluginPluginException - on errorCalculatorPlugin.getErrorMessage()public double getPredictedValue()
public double getStandardError()
public java.lang.Object[] getResultTypes()
CalculatorPluginnull.
getResultTypes in class CalculatorPlugin
public java.lang.Object getResult(java.lang.Object type,
int index)
throws PluginException
CalculatorPluginnull.
getResult in class CalculatorPlugintype - is the result typeindex - is the result index
PluginException - if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.Object getResult(java.lang.Object type,
java.lang.String arg)
throws PluginException
CalculatorPluginCalculatorPlugin.getResult(Object, int)
with the argument string converted to an integer (result index).
getResult in class CalculatorPlugintype - is the result typearg - is the argument string
PluginException - if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.String getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
CalculatorPluginnull.
getResultAsString in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is givenpublic Molecule getResultMolecule()
CalculatorPluginMolAtom.getExtraLabel()).
Molecular results are stored in molecule properties
with keys being the result types
(Molecule.getProperty(String)).
getResultMolecule in class CalculatorPluginpublic java.lang.String getErrorMessage()
CalculatorPluginCalculatorPlugin.run()
returned false (calculation error).
The default implementation returns the empty string.
getErrorMessage in class CalculatorPluginpublic void standardize(Molecule mol)
CalculatorPlugin[O-:1][N+:2] >> [O:1]=[N:2], [NH1+:1][O-:2] >> [H:3][O:2][N:1]
[#6][S+:1]([#6])[#8-:2] >> [#6][S:1]([#6])=[O:2]
standardize in class CalculatorPluginmol - is the molecule to be standardizedpublic boolean needError()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||