- ChemAxon

advertisement
Scientific & technical presentation
Calculator Plugins
József Szegezdi, Nóra Máté
Sept 2005
Calculator Plugin Features
Key features:
• Plugin modules are packed in dynamically loadable JARs.
• Extendible plugin set.
• API support:
 plugin class loading and instantiation
 plugin handling (parameter and input setting, running, getting results)
 GUI access (parameter and result display panels)
• Built-in access from multiple platforms:
 Marvin GUI (msketch, mview applications and applets)
 cxcalc command line tool
 Chemical Terms:
 evaluate command line tool
 search filtering
 JChem cartridge
 reaction processing
Calculator Plugins
Available Calculations
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Elemental analysis
Charge distribution
Polarizability
pKa
logP
logD
Polar surface area
Huckel Analysis
H-bond donor-acceptor
Major microspecies
Refractivity
Tautomer
Resonance
Isoeletric point
Calculation Interface
•
•
•
•
Marvin GUI
Command line
Chemical Terms
API
Marvin GUI – menu
Plugins are listed in
the Tools menu.
Plugin configuration
is read from the
xjars/plugins.properties
property file.
Marvin GUI – parameter panels
Parameter panels are usually
created from XML configuration.
In this way it is possible to set
plugin parameters before the
plugin JAR is loaded, which can
be important in case of applets.
These XMLs are stored under the
xjars directory with file names:
<plugin class name>Parameters.xml
Marvin GUI – result display
Calculation results are displayed based on the decorated result
molecule provided by the plugin:
• molecular results are stored in molecule
properties
• atomic results are stored in atom labels
Custom result display (e.g. a
chart) can also be provided.
Command line access: cxcalc
Plugin calculations can be run by the command line tool cxcalc.
The plugin configuration is read from xjars/calc.properties.
All calculations are listed in the help text:
Calculation specific help is also available:
pKa (strongest acidic and basic pKa values)
and major microspecies (pH=7.4) calculation:
Chemical Terms
Chemical expressions can refer to plugins by calculation IDs specified in
the XML configuration. The built-in configuration is described in
http://www.jchem.com/doc/user/EvaluatorTables.html
Examples:
basic pKa value on atom 5 (0-based):
evaluate –e “bpka(5)” test.mrv
true if partial charge on atom 5 is greater than on atom 0:
evaluate –e “charge(5) > charge(0)” test.mrv
bromination - select aromatic carbon with minimal energy:
react –r “[c:1][H:2]>>[c:1][Br:3]..s:-energyE(ratom(1))” “Nc1ccccc1”
perform search on targets with mol mass greater than 150:
jcsearch –e “mass() > 150” –q query.mrv targets.mrv
accept only search hits with acidic pKa less than 5 on target atom
matching query atom with map 1:
jcsearch –e “apka(hm(1)) < 5” –q query.mrv targets.mrv
Plugin Handling – API without GUI
1.
2.
3.
4.
5.
Create the plugin object:
•
for built-in plugins in applications the plugin class is
available in the application JAR (MarvinBeans.jar, jchem.jar),
therefore you can simply use the plugin constructor
•
for custom plugins or in case of applets the plugin
classes should be loaded from the plugin JAR; use
CalculatorPlugin.create(String clname, String jar)
Set plugin parameters by plugin specific API
Set the input molecule by
CalculatorPlugin.setMolecule(Molecule)
Run the calculation by
CalculatorPlugin.run()
Get calculation results by plugin specific API
API usage examples are written in the apidoc class headers.
Links: http://www.chemaxon.com/marvin/doc/dev/plugins.html#examples
Plugin Handling – GUI access from API
xjars/plugins.properties
XML
parameter panel as
ParameterPanelHandler
or
java.util.Properties object
PluginFactory
JAR or default
JAR
CalculatorPluginDisplay
object or subclass instance
CalculatorPlugin
subclass instance
Custom Plugin Application
This custom plugin
application shows:
• custom plugin
implementation and
configuration
• test application with
customized
GUI access
Custom Plugin Implementation – the plugin
class I.
The plugin class extends CalculatorPlugin:
The setParameters() method will be called with parameters
set in the graphical parameter panel by the user:
Custom Plugin Implementation – the plugin
class II.
The setInputMolecule() method will be called to set the molecule
drawn in the sketcher:
The run() method performs the main calculation:
Custom Plugin Implementation – the plugin
class III.
The getResultMolecule() method will be called by the default
CalculatorPluginDisplay to display the molecule in a viewer,
with molecular results in text labels and atomic results in atom labels:
• molecular results should be stored in molecule properties set by Molecule.setProperty()
• atomic results should be stored in atom labels set by MolAtom.setExtraLabel()
Custom Plugin Implementation – the plugin
class IV.
Standardization: most calculations require input molecules being
in standardized form. The default standardization aromatizes the
molecule and converts nitro and sulphynil groups:
To customize standardization, overwrite the standardize() method.
In our SelectionPlugin we do not need standardization at all,
therefore we implement standardize() with an empty body:
Custom Plugin Implementation – the display
class I.
The display class is responsible for showing plugin results in a
graphical component. The default display is CalculatorPluginDisplay,
it calls CalculatorPlugin.getResultMolecule() to show the calculation
results in a decorated Molecule.
This result molecule stores the computed chemical features in
molecule properties (Molecule.setProperty()) and atom labels
(MolAtom.setExtraLabel()).
To customize the display, extend the CalculatorPluginDisplay class:
Custom Plugin Implementation – the display class
II.
The graphical component displaying the calculation results is
returned in getResultComponent():
You can insert the default decorated molecule viewer into
the custom display by calling CalculatorPluginDisplay.createViewPanel().
You can fetch display parameters set in the graphical parameter
panel by implementing setParameters():
Custom Plugin Implementation – the display class
III.
Error handling: CalculatorPluginDisplay shows error and warning
messages returned by CalculatorPlugin.getErrorMessage() and
CalculatorPlugin.getWarningMessage() in case when
CalculatorPlugin.run() returns false. To customize error display,
implement getErrorComponent():
Parameter panel: PluginFactory can create generic parameter
panels from XML configuration. However, if you need a
parameter panel that is not supported by this framework,
return your parameter panel in getParameterPanel():
Custom Plugin Implementation – parameter
panel
Parameter panel: PluginFactory can create generic parameter panels
from XML configuration: xjars/<plugin class name>Parameters.xml
Our parameter panel configuration file is SelectionPluginParameters.xml:
Custom Plugin Implementation –
administration I.
To access our plugin from the Marvin Tools menu, we have to
accomplish the following steps:
1.
Create the plugin JAR with manifest SelectionPlugin.txt:
The manifest can also refer to additional JARs in its Class-Path attribute.
The manifest file can be omitted if the plugin name is specified in the
configuration (e.g. xjars/plugins.properties, xjars/calc.properties) and
no other resources are needed to load the plugin.
2.
Copy the plugin JAR and the parameter XML into the xjars directory.
Custom Plugin Implementation –
administration II.
3.
Insert a line into xjars/plugins.properties:
SelectionPlugin access is
added to your Tools menu in
the viewer and the sketcher
applets / applications.
Custom Plugin Implementation – custom
application I.
The following test application shows a customized
way to access our plugin. Two buttons are placed
to show the OptionsPane (plugin specific parameter
panel with “OK”, “Cancel” and “Display” buttons)
and to run the plugin.
Configuration is given to PluginFactory in a
java.util.Properties object.
Custom Plugin Implementation – custom
application II.
Create PluginFactory, set our class as “Display” button ActionListener and parent
component of OptionsPane, set plugin configuration in factory.
Custom Plugin Implementation – custom
application III.
Event handling:
• Show OptionsPane if the “Set parameters” button is pressed.
• Run plugin if the “Run plugin” button is pressed.
• Run plugin if the “Display” button is pressed on the OptionsPane.
Note, that the action command is set to “plugin_<plugin key>”.
Custom Plugin Implementation – custom
application IV.
Show the OptionsPane:
1. Get the plugin index from the factory.
2. Get and show the plugin OptionsPane.
Custom Plugin Implementation – custom
application V.
Run the plugin:
1.
Get the plugin index.
2.
Get the plugin.
3.
Get the display.
4.
Get plugin parameters
from the OptionsPane.
5.
Handle license key.
6.
Set parameters in
plugin and display.
Custom Plugin Implementation – custom
application VI.
7.
Check input molecule.
8.
Set molecule.
9.
Run the plugin.
10. Store results in display.
11. Get result component.
12. Show result component.
Custom Plugin Implementation – references
The SelectionPlugin example code will be
available in the next Marvin release: Marvin 4.0.
You will find it under the directory
examples/plugin
See its index.html for installation instructions.
Elemental Analysis
Polar Surface Area
Partial Charge Distribution
Partial Charge Distribution Calculation
Partial Equalization of Orbital Electronegativities (PEOE)
Orbital electronegativity defined by Mulliken
Orbital electronegativity of atom i:
ci=at+btqi+ctqi2
qi: partial charge
Partial charge of atom i is iteratively calculated based on
Gasteiger’s method:
ci(0) = at, qi(0) = 0
qi(n+1) = qi (n) + S(0.5)n(ci- ck)/ max(ci, ck)
k: index of a neighbor of atom i
Polarizability
logP
logP Example
logP =
Sf
i
fI: atomic logP increment
Validation of the logP prediction
logD
logD Example
k1
1+(1)
k4
1+2+(4
k5
123(0)
k2
2+(2)
k6
k3
p0  p1
log D  log
3-(3)
k7
)
1+3-(5)
1+ 2+ 3(7)
2+3-(6)
1
k
k
k
k
[H  ]
[H  ]
[H  ]2
 p2
 p3 3  p4
 p5 5  p6 6  p7 7 [H  ]
k1
k2
[H ]
k1k 4
k1
k2
k1k 4
k
[H  ] [H  ] k 3
[H  ]2 k 5 k 6
1

  
 
 7 [H  ]
k1
k2
[H ] k1k 4
k1 k 2 k1k 4
logD is computed
using micro
ionization constants
(ki), micro partition
coefficients (pi), and
pH
2
3
pKa
The large model of the pKa calculation
• The large model is invoked when the
number of the ionizable atoms in the
molecule is larger than 8
• The macro distribution of the molecule
as the function of pH also calculated
beside the pKa values
pKa Plugin - Microconstants
Micro ionization constants (logk) are calculated from
regression equations that have three types of calculated
parameters:
Intramolecular
interactions
Partial charges
logk
Polarizabilities
pKa Plugin - Macroconstants
Macro ionization constants
(pKa) are calculated from the
microconstants (logk)
Ionization scheme
123
1-
1 -2 +
2+
1 -3 -
3-
2+3-
1 -2 + 3 -
Hydrogen Bonds in pKaCalculation
hydrogen bond
Validation of the pKa prediction
Tautomerisation Plugin
• Tautomer structures are
generated for any molecule
Resonance Plugin
Isoelectric Point Plugin
Visit other technical presentations
MarvinSketch/View
http://www.chemaxon.com/MarvinSketch_View.ppt
MarvinSpace
http://www.chemaxon.com/MarvinSpace.ppt
Calculator Plugins
http://www.chemaxon.com/Calculator_Plugins.ppt
JChem Base
http://www.chemaxon.com/JChem_Base.ppt
JChem Cartridge
http://www.chemaxon.com/JChem_Cartridge.ppt
Standardizer
http://www.chemaxon.com/Standardizer.ppt
Screen
http://www.chemaxon.com/Screen.ppt
JKlustor
http://www.chemaxon.com/JKlustor.ppt
Fragmenter
http://www.chemaxon.com/Fragmenter.ppt
Reactor
http://www.chemaxon.com/Reactor.ppt
References
Built-in plugin descriptions:
http://www.chemaxon.com/marvin/chemaxon/marvin/help/calculator-plugins.html
Developer’s guide with API usage examples:
http://www.chemaxon.com/marvin/doc/dev/plugins.html
Plugin framework API (chemaxon.marvin.plugin)
(subject to major changes in Marvin 4.0):
http://www.chemaxon.com/marvin/doc/api/chemaxon/marvin/plugin/package-summary.html
Built-in plugins’ API (chemaxon.marvin.calculations):
http://www.chemaxon.com/marvin/doc/api/chemaxon/marvin/calculations/package-summary.html
Download