Configuration

E3FP configurational parameters are stored in the widely used INI file format. These may be passed to Command Line Interface programs or parsed to Python dicts for Pipeline Methods or other lower-level functions.

Loading Default Parameters

The below example shows all default parameters, accessed via the e3fp.config module.

[preprocessing]
standardise = False
protonate = False

[conformer_generation]
num_conf = -1
first = -1
pool_multiplier = 1
rmsd_cutoff = 0.5
max_energy_diff = None
forcefield = uff
out_dir = conformers
compress = 2
seed = -1

; Optimized parameters used in
; Axen et al. 2017
[fingerprinting]
bits = 1024
level = 5
first = 3
radius_multiplier = 1.718
stereo = True
counts = False
include_disconnected = True
rdkit_invariants = False
remove_duplicate_substructs = True
exclude_floating = True

configparser is used internally to parse and store these config parameters.

>>> from e3fp.config.params import default_params
>>> default_params
<ConfigParser.ConfigParser instance at 0x...>
>>> print(default_params.sections())
['preprocessing', 'conformer_generation', 'fingerprinting']
>>> default_params.items('fingerprinting')
[('bits', '1024'), ('level', '5'), ('first', '3'), ('radius_multiplier', '1.718'), ('stereo', 'True'), ('counts', 'False'), ('include_disconnected', 'True'), ('rdkit_invariants', 'False'), ('merge_duplicate_substructs', 'True'), ('exclude_floating', 'True')]

Parsing User-Provided Parameters

A user may provide a custom config file.

new_params.cfg
[conformer_generation]
first = 10

[fingerprinting]
bits = 4096
first = 10
>>> from e3fp.config.params import read_params
>>> config = read_params("source/examples/data/new_params.cfg")
>>> config.items('fingerprinting')
[('bits', '4096'), ('first', '10')]

When passing these parameters to any downstream methods, default options will be used except where these options are specified.

Converting Parameters to Argument Dicts

To pass the parameters to Python methods for fingerprinting and conformer generation, we need to convert them to Python dicts.

>>> from e3fp.pipeline import params_to_dicts
>>> confgen_params, fprint_params = params_to_dicts(config)
>>> fprint_params
{'bits': 4096, 'first': 10}