Chemical Calculations with Calculator Plugins using cxcalc

Version 4.1.12

Contents

Introduction

ChemAxon's Calculator (cxcalc) is a command line program in Marvin Beans and JChem that performs chemical calculations using calculator plugins.

There are some built-in calculations such as charge, pKa, logP and logD computations that can be evaluated in demo mode or purchased from ChemAxon. User access is controlled with the help of license keys. See the Calculator Plugins guide for the details of these calculations.

Other calculations can be added by writing custom plugins as described in the Plugin Developer's Guide.

Installation

Usage

Calculator performs plugin calculations in a uniform way: it processes general parameters referring to input, output, and SDF file tag names for storing calculation result as well as plugin specific parameters that are different for each plugin. The available calculations are defined in the configuration file and listed below the general help message if you type cxcalc -h or simply cxcalc .
cxcalc [general options] [input files/strings] <plugin> [plugin options] [input files/strings]
cxcalc [general options] [input files/strings] <plugin1> [plugin1 options] [input files/strings] <plugin2> [plugin2 options] [input files/strings] ...

General Options

  cxcalc -h, --help              this help message, 
                                 list of available calculations
  cxcalc <plugin> -h, --help     plugin specific help message
  -o, --output <filepath>        output file path (default: stdout)
  -t, --tag                      name of the SDFile tag to store the
                                 calculation results     
                                 default tag name: see plugin help  
  -i, --id <tag name|format>     SDFile tag that stores the molecule ID
                                 if no such tag exists in the input molecule
                                 then molecule ID is the molecule itself
                                 converted to the specified format
                                 (default: ID = molecule index)
  -N, --do-not-display <i|h|ih>  do not display molecule ID and/or
                                 table header (in table output form):
                                 i  - no molecule ID
                                 h  - no table header
                                 ih - neither molecule ID nor table header
  -S, --sdf-output               SDF output with results in SDF tags
  -M, --mrv-output               result molecule output in MRV format
                                 (if neither -S nor -M is specified then
                                 plugin results are written in table form)
  -g, --ignore-error             continue with next molecule on error
  -v, --verbose                  print calculation warnings to the console

You can also pass some JVM options to the Java Virtual Machine as cxcalc command line arguments.

Input files can be given both on the general option side and on the plugin specific option side, in either case these input files/strings give the input molecules for the calculations. If more plugins are given then all plugin calculations are performed for all input molecules.

Note, that plugin IDs are case-insensitive, you can alter upper- and lower case letters if you like. For example,

cxcalc logp in.mol
is the same as
cxcalc logP in.mol
and
cxcalc totalchargedensity in.mol
is the same as
cxcalc totalChargeDensity in.mol

The available plugins are configured in the xjars/calc.properties configuration file. The xjars directory is inside the MarvinBeans.jar (in Marvin Beans package) or jchem.jar (in JChem package). In Marvin Applets package, xjars directory is in the "marvin" directory. User-defined plugins may also be configured in this file. The built-in plugins that can be purchased from ChemAxon. A detailed description of the configuration file is given below.

The command line parameter --tag specifies the SDF file tag name to be used when storing the calculation results in an SDF file.

If the --do-not-display parameter is specified then no molecule ID and/or table header is displayed. This option has no effect in --sdf-output and --mrv-output output modes.

If the --sdf-output parameter is given, then the input molecules are written in SDF format and the calculation results are added in SDF file tags.

If the --mrv-output parameter is given, then the decorated result molecules are written in MRV format. Atomic results are written into atom labels, while molecular results are displayed as molecule properties. Not every calculation has this decorated molecule output.

If neither --sdf-output nor --mrv-output are specified then the calculation results are shown in text table form. The display of table header and molecule ID column can be altered in the --do-not-display option.

The parameter --id parameter specifies the input SDF file tag that stores the molecule ID to be written in the output table. This parameter is only used if the output is in text table form (neither --sdf-output nor --mrv-output is specified). By default the input file index of the molecule is used as molecule ID. Molecule formats can be specified with output options, for the available formats and options see the File Formats in Marvin manual. Probably the most frequently used format replacing a molecule ID is SMILES, possibly with the a-H (aromatize, remove explicit hydrogens) option (smiles:a-H) to generate canonical strings.

Plugin Specific Options

The plugin specific help message is printed if the user types:

    cxcalc <plugin> -h
Here plugin is the plugin key from the configuration file.

Example

Typing

    cxcalc logp -h
produces the help string
Calculator plugin: logp.

logP calculation:
for type logPTrue: logP of uncharged species, or,
in the case of zwitterions, logD at pI;
for type logPMicro: logP of the input species.

Usage:
  cxcalc [general options] [input files/strings] logp
[logp options] [input files/strings]

logp options: 
  -h, --help       this help message
  -p, --precision  <floating point precision as number of
                   fractional digits: 0-8 or inf> (default: 2)
  -a, --anion      <Cl- concentration> (default: 0.1, range: [0.0, 0.25])
  -k, --kation     <Na+ K+ concentration> (default: 0.1, range: [0.0, 0.25])
  -t, --type       [increments|inch|logPMicro|logPTrue] (default: logPTrue)
  -i, --inch       [true|false] incremental logP on H atoms shown in brackets
                   (for incremental logP only) (default: false)

Multiple values for the same parameter
should be separated by commas (',' without space).

Example:
  cxcalc -S -t myLOGP logp -a 0.15 -k 0.05 test.mol

The command line parameter --precision specifies the required floating point precision, that is, the number of required decimal digits in the output.

The command line parameter --type specifies the result type: increments gives the atomic logp increment values for each atom in the molecule while logPTrue gives the overall logp value for the molecule. Both results can be queried by specifying both types separated by a comma: -t increments,implh,logPTrue.

Calculations

See the listing of calculations or the output of cxcalc -h command for the list of available calculations.

Input

The software may take molecules from text files or a SMILES strings. Most molecular file formats are accepted (for instance MDL molfile, Compressed molfile, SDfile, Compressed SDfile, SMILES).

If no input file name or SMILES string is given in the command line, then input molecules are read from the standard input.

 

Output

Calculator writes calculation results in a format based on the specified tags. If the result refers to the entire molecule, it is written as a single number. If the calculation gives a separate number for each atom in the molecule, it is written as a list of numbers separated by semicolons. The order of the results corresponds to the order of the atoms determined by their atom indices. Other output formats may be available for certain plugins, see the plugin specific options for the specific plugin. By default, results are written without the input molecule in a table form, but Calculation results can be written in an SDF file as an SDF tag if the --sdf-output parameter is specified.

Configuration File

The available plugins are configured in the xjars/calc.properties taken relative to the Marvin root directory. The plugins provided by ChemAxon can be purchased from ChemAxon.

Configuration File Format

The configuration file is a java property file. The format of the configuration file is best shown by an example:

charge=$chemaxon.marvin.calculations.ChargePlugin\
	$ChargePlugin.jar\
	$Charge\
	$p=precision:2;t=type:total;i=implh:false;r=resonance:false;H=pH\
	$CHARGE\
	$Partial charge calculation.\nTypes aromaticsystem / aromaticring calculate the sum of charges\nin the aromatic system / aromatic ring containing the atom.\
	$-p, --precision=<floating point precision as number of\nfractional digits: 0-8 or inf> (default: 2);-t, --type=[sigma|pi|total|implh|\naromaticsystem|aromaticsystemsigma|aromaticsystempi|\naromaticring|aromaticringsigma|aromaticringpi]\n(default: total);-i, --implh=[true|false] implicit H charge sum shown in brackets\n(for sigma and total charge only) (default: false);-r, --resonance=[true|false]\ntrue: take resonant structures (default: false);-H, --pH= takes major microspecies at this pH\n(default: no pH, takes the input molecule)\
	$cxcalc -S -o result.sdf -t myCHARGE charge -t pi,total -p 3 test.mol

The key charge is the plugin name that the plugin is referenced by in the cxcalc command line tool.

Configuration items are separated by '$' characters. The '\' characters allow property values to be expanded to multiple lines: the '\' character itself as well as leading white spaces in the next line are ignored.

The configuration items:

  1. the plugin class with full package name
  2. the plugin JAR name (with path relative to the xjars directory)
  3. the plugin group name (used for grouping the available plugins in the help message)
  4. the plugin specific parameters:
    <short name>=<long name>:<default value>
    separated by semicolons
  5. the default SDF file tag name storing the results in case of SDF file output
  6. a short description used in the plugin specific help message
  7. the plugin specific help text (parameter description text) with newline characters replaced by semicolons
  8. an example usage text (optional)

The plugin loading mechanism is the following: first the program tries to load the plugin class by the default class loader from the CLASSPATH; if this the plugin class is not found then the JAR is loaded and the system tries to load the plugin class from there.

If the plugin name is omitted then the plugin is loaded directly from the JAR where the Plugin-Class manifest attribute specifies the plugin class.

If the JAR name is omitted then the plugin is loaded from the CLASSPATH.

Missing configuration items should be denoted by '-' characters. For example, here is the above plugin configuration with omitted JAR name:

charge=$chemaxon.marvin.calculations.ChargePlugin\
	$-\
	$Charge\
	$p=precision:2;t=type:total;i=implh:false;H=pH\
	$CHARGE\
	$Partial charge calculation.\nTypes aromaticsystem / aromaticring calculate the sum of charges\nin the aromatic system / aromatic ring containing the atom.\
	$-p, --precision= (default: 2);-t, --type=[sigma|pi|total|implh|aromaticsystem|aromaticring]\n(default: total);-i, --implh=[true|false] implicit H charge sum shown in brackets\n(for sigma and total charge only) (default: false);-H, --pH= takes physiological microspecies at this pH\n(default: no pH, takes the input molecule)\
	$cxcalc -S -o result.sdf -t myCHARGE charge -t pi,total -p 3 test.mol

Important: the long parameter names in the "plugin specific parameters" section should correspond to the parameter property keys used in the plugin class in the setParameters(Properties params) method!

Examples

  1. pKa calculation with table form output, showing the two most significant acidic and the two most significant basic pKa values (this is the default table output mode):
    cxcalc mols.sdf pka
    
  2. The same with molecule ID-s taken from the ID tag of the input SDF file, writing three significant values from each pKa type:
    cxcalc mols.sdf -i ID pka -a 3 -b 3
    
  3. The same with setting minimum basic pKa to -5, maximum acidic pKa to 15:
    cxcalc mols.sdf -i ID pka -a 3 -b 3 -i -5 -x 15
    
  4. Charge calculation for molecules in the mols.sdf file, writes results to the standard output in MRV format, charge values displayed in atom labels:
    cxcalc -M charge mols.sdf
    
  5. The same with output to the molcharges.mrv file to be created in the same directory, displaying the results in MarvinView:
    cxcalc -M -o molcharges.mrv charge mols.sdf
    mview molcharges.mrv
    
  6. LogP calculation with both result types (atomic increments and overal molecule) and user defined SDF tag name, piping the result to MarvinView:
    cxcalc -S mols.sdf -t LOGP_BOTH logp -t increments,logP | mview -
    

    Note, that such piping does not work in Windows.

    By setting the Table / Show Fields option in MarvinView the SDF file tags will be shown in the table cells and in this way the charge values can be seen.

  7. Elemental analysis (all result types), output in table form, molecule ID-s taken from the ID tag of the input SDF file, output written to text file elemanal.txt:
    cxcalc -o elemanal.txt -i ID elemanal mols.sdf
    
  8. A similar example with input taken from mols.smiles and output written as SDF to elemanal.sdf with ELEMANAL tag name:
    cxcalc -S -t ELEMANAL -o elemanal.sdf elemanal mols.smiles
    
  9. Writting molecular mass, logP and logD at pH 6.4 in the same table:
    cxcalc mass logP logD -H 6.4 mols.smiles
    
  10. Calculating some topological data:
    cxcalc ringCount ringAtomCount ringBondCount mols.smiles