OCDocker.Config module

Note

For GninaConfig.cnn (gnina_cnn in config files), when the value is default OCDocker intentionally omits --cnn from the gnina command so gnina uses its own internal default CNN model. Set a specific model name (for example dense) to force --cnn <model>.

Configuration management for OCDocker using dataclasses and singleton pattern.

This module provides a structured way to manage OCDocker configuration, replacing the global variables in Initialise.py with type-safe dataclasses.

Usage:

from OCDocker.Config import get_config, OCDockerConfig

class OCDocker.Config.VinaConfig(executable='vina', split_executable='vina_split', energy_range='10', exhaustiveness=5, num_modes='3', scoring='vina', scoring_functions=<factory>)[source]

Bases: object

Configuration for Vina docking engine.

Parameters:
  • executable (str) –

  • split_executable (str) –

  • energy_range (str) –

  • exhaustiveness (Any) –

  • num_modes (str) –

  • scoring (str) –

  • scoring_functions (List[str]) –

executable: str = 'vina'
split_executable: str = 'vina_split'
energy_range: str = '10'
exhaustiveness: Any = 5
num_modes: str = '3'
scoring: str = 'vina'
scoring_functions: List[str]
class OCDocker.Config.SminaConfig(executable='smina', energy_range='10', exhaustiveness='5', num_modes='3', scoring='vinardo', scoring_functions=<factory>, custom_scoring='no', custom_atoms='no', local_only='no', minimize='no', randomize_only='no', minimize_iters='0', accurate_line='no', minimize_early_term='no', approximation='spline', factor='32', force_cap='10', user_grid='no', user_grid_lambda='no')[source]

Bases: object

Configuration for Smina docking engine.

Parameters:
  • executable (str) –

  • energy_range (str) –

  • exhaustiveness (str) –

  • num_modes (str) –

  • scoring (str) –

  • scoring_functions (List[str]) –

  • custom_scoring (str) –

  • custom_atoms (str) –

  • local_only (str) –

  • minimize (str) –

  • randomize_only (str) –

  • minimize_iters (str) –

  • accurate_line (str) –

  • minimize_early_term (str) –

  • approximation (str) –

  • factor (str) –

  • force_cap (str) –

  • user_grid (str) –

  • user_grid_lambda (str) –

executable: str = 'smina'
energy_range: str = '10'
exhaustiveness: str = '5'
num_modes: str = '3'
scoring: str = 'vinardo'
scoring_functions: List[str]
custom_scoring: str = 'no'
custom_atoms: str = 'no'
local_only: str = 'no'
minimize: str = 'no'
randomize_only: str = 'no'
minimize_iters: str = '0'
accurate_line: str = 'no'
minimize_early_term: str = 'no'
approximation: str = 'spline'
factor: str = '32'
force_cap: str = '10'
user_grid: str = 'no'
user_grid_lambda: str = 'no'
class OCDocker.Config.GninaConfig(executable='gnina', flex='no', flexres='no', flexdist_ligand='no', flexdist='no', flex_limit='no', flex_max='no', autobox_ligand='no', autobox_add='4', autobox_extend='1', no_lig='no', covalent_rec_atom='no', covalent_lig_atom_pattern='no', covalent_lig_atom_position='no', covalent_fix_lig_atom_position='no', covalent_bond_order='1', covalent_optimize_lig='no', exhaustiveness='8', num_modes='9', scoring='default', scoring_functions=<factory>, custom_scoring='no', custom_atoms='no', score_only='no', local_only='no', minimize='no', randomize_only='no', num_mc_steps='no', max_mc_steps='no', num_mc_saved='no', temperature='no', minimize_iters='0', accurate_line='no', simple_ascent='no', minimize_early_term='no', minimize_single_full='no', approximation='spline', factor='32', force_cap='10', user_grid='no', user_grid_lambda='-1', print_terms='no', print_atom_types='no', cnn_scoring='rescore', cnn='default', cnn_models=<factory>, cnn_model='no', cnn_rotation='0', cnn_mix_emp_force='no', cnn_mix_emp_energy='no', cnn_empirical_weight='1', cnn_center_x='no', cnn_center_y='no', cnn_center_z='no', cnn_verbose='no', out_flex='no', atom_terms='no', atom_term_data='no', pose_sort_order='CNNscore', full_flex_output='no', cpu='auto', seed='no', min_rmsd_filter='1', quiet='no', addH='yes', stripH='no', device='0', no_gpu='no')[source]

Bases: object

Configuration for Gnina docking engine.

Parameters:
  • executable (str) –

  • flex (str) –

  • flexres (str) –

  • flexdist_ligand (str) –

  • flexdist (str) –

  • flex_limit (str) –

  • flex_max (str) –

  • autobox_ligand (str) –

  • autobox_add (str) –

  • autobox_extend (str) –

  • no_lig (str) –

  • covalent_rec_atom (str) –

  • covalent_lig_atom_pattern (str) –

  • covalent_lig_atom_position (str) –

  • covalent_fix_lig_atom_position (str) –

  • covalent_bond_order (str) –

  • covalent_optimize_lig (str) –

  • exhaustiveness (str) –

  • num_modes (str) –

  • scoring (str) –

  • scoring_functions (List[str]) –

  • custom_scoring (str) –

  • custom_atoms (str) –

  • score_only (str) –

  • local_only (str) –

  • minimize (str) –

  • randomize_only (str) –

  • num_mc_steps (str) –

  • max_mc_steps (str) –

  • num_mc_saved (str) –

  • temperature (str) –

  • minimize_iters (str) –

  • accurate_line (str) –

  • simple_ascent (str) –

  • minimize_early_term (str) –

  • minimize_single_full (str) –

  • approximation (str) –

  • factor (str) –

  • force_cap (str) –

  • user_grid (str) –

  • user_grid_lambda (str) –

  • print_terms (str) –

  • print_atom_types (str) –

  • cnn_scoring (str) –

  • cnn (str) –

  • cnn_models (List[str]) –

  • cnn_model (str) –

  • cnn_rotation (str) –

  • cnn_mix_emp_force (str) –

  • cnn_mix_emp_energy (str) –

  • cnn_empirical_weight (str) –

  • cnn_center_x (str) –

  • cnn_center_y (str) –

  • cnn_center_z (str) –

  • cnn_verbose (str) –

  • out_flex (str) –

  • atom_terms (str) –

  • atom_term_data (str) –

  • pose_sort_order (str) –

  • full_flex_output (str) –

  • cpu (str) –

  • seed (str) –

  • min_rmsd_filter (str) –

  • quiet (str) –

  • addH (str) –

  • stripH (str) –

  • device (str) –

  • no_gpu (str) –

executable: str = 'gnina'
flex: str = 'no'
flexres: str = 'no'
flexdist_ligand: str = 'no'
flexdist: str = 'no'
flex_limit: str = 'no'
flex_max: str = 'no'
autobox_ligand: str = 'no'
autobox_add: str = '4'
autobox_extend: str = '1'
no_lig: str = 'no'
covalent_rec_atom: str = 'no'
covalent_lig_atom_pattern: str = 'no'
covalent_lig_atom_position: str = 'no'
covalent_fix_lig_atom_position: str = 'no'
covalent_bond_order: str = '1'
covalent_optimize_lig: str = 'no'
exhaustiveness: str = '8'
num_modes: str = '9'
scoring: str = 'default'
scoring_functions: List[str]
custom_scoring: str = 'no'
custom_atoms: str = 'no'
score_only: str = 'no'
local_only: str = 'no'
minimize: str = 'no'
randomize_only: str = 'no'
num_mc_steps: str = 'no'
max_mc_steps: str = 'no'
num_mc_saved: str = 'no'
temperature: str = 'no'
minimize_iters: str = '0'
accurate_line: str = 'no'
simple_ascent: str = 'no'
minimize_early_term: str = 'no'
minimize_single_full: str = 'no'
approximation: str = 'spline'
factor: str = '32'
force_cap: str = '10'
user_grid: str = 'no'
user_grid_lambda: str = '-1'
print_terms: str = 'no'
print_atom_types: str = 'no'
cnn_scoring: str = 'rescore'
cnn: str = 'default'
cnn_models: List[str]
cnn_model: str = 'no'
cnn_rotation: str = '0'
cnn_mix_emp_force: str = 'no'
cnn_mix_emp_energy: str = 'no'
cnn_empirical_weight: str = '1'
cnn_center_x: str = 'no'
cnn_center_y: str = 'no'
cnn_center_z: str = 'no'
cnn_verbose: str = 'no'
out_flex: str = 'no'
atom_terms: str = 'no'
atom_term_data: str = 'no'
pose_sort_order: str = 'CNNscore'
full_flex_output: str = 'no'
cpu: str = 'auto'
seed: str = 'no'
min_rmsd_filter: str = '1'
quiet: str = 'no'
addH: str = 'yes'
stripH: str = 'no'
device: str = '0'
no_gpu: str = 'no'
class OCDocker.Config.PLANTSConfig(executable='plants', cluster_structures=3, cluster_rmsd='2.0', search_speed='speed1', scoring='chemplp', scoring_functions=<factory>, rescoring_mode='simplex')[source]

Bases: object

Configuration for PLANTS docking engine.

Parameters:
  • executable (str) –

  • cluster_structures (int) –

  • cluster_rmsd (str) –

  • search_speed (str) –

  • scoring (str) –

  • scoring_functions (List[str]) –

  • rescoring_mode (str) –

executable: str = 'plants'
cluster_structures: int = 3
cluster_rmsd: str = '2.0'
search_speed: str = 'speed1'
scoring: str = 'chemplp'
scoring_functions: List[str]
rescoring_mode: str = 'simplex'
class OCDocker.Config.Dock6Config(executable='', vdw_defn_file='', flex_defn_file='', flex_drive_file='')[source]

Bases: object

Configuration for Dock6 docking engine.

Parameters:
  • executable (str) –

  • vdw_defn_file (str) –

  • flex_defn_file (str) –

  • flex_drive_file (str) –

executable: str = ''
vdw_defn_file: str = ''
flex_defn_file: str = ''
flex_drive_file: str = ''
class OCDocker.Config.LeDockConfig(executable='', lepro='', rmsd='', num_poses='')[source]

Bases: object

Configuration for LeDock docking engine.

Parameters:
  • executable (str) –

  • lepro (str) –

  • rmsd (str) –

  • num_poses (str) –

executable: str = ''
lepro: str = ''
rmsd: str = ''
num_poses: str = ''
class OCDocker.Config.ODDTConfig(seed='', chunk_size='', scoring_functions=<factory>)[source]

Bases: object

Configuration for ODDT scoring functions.

Parameters:
  • seed (str) –

  • chunk_size (str) –

  • scoring_functions (List[str]) –

seed: str = ''
chunk_size: str = ''
scoring_functions: List[str]
class OCDocker.Config.DatabaseConfig(backend='postgresql', host='', user='', password='', database='', optimizedb='', port=None, sqlite_path='')[source]

Bases: object

Database connection configuration.

Parameters:
  • backend (str) –

  • host (str) –

  • user (str) –

  • password (str) –

  • database (str) –

  • optimizedb (str) –

  • port (int | None) –

  • sqlite_path (str) –

backend: str = 'postgresql'
host: str = ''
user: str = ''
password: str = ''
database: str = ''
optimizedb: str = ''
port: int | None = None
sqlite_path: str = ''
class OCDocker.Config.ToolsConfig(pythonsh='pythonsh', prepare_ligand='prepare_ligand4.py', prepare_receptor='prepare_receptor4.py', chimera='', dssp='dssp', obabel='obabel', spores='spores', dudez_download='')[source]

Bases: object

Configuration for external tools.

Parameters:
  • pythonsh (str) –

  • prepare_ligand (str) –

  • prepare_receptor (str) –

  • chimera (str) –

  • dssp (str) –

  • obabel (str) –

  • spores (str) –

  • dudez_download (str) –

pythonsh: str = 'pythonsh'
prepare_ligand: str = 'prepare_ligand4.py'
prepare_receptor: str = 'prepare_receptor4.py'
chimera: str = ''
dssp: str = 'dssp'
obabel: str = 'obabel'
spores: str = 'spores'
dudez_download: str = ''
class OCDocker.Config.PathsConfig(ocdb_path='', pca_path='', pdbbind_kdki_order='u', reference_column_order=<factory>)[source]

Bases: object

Path configuration.

Parameters:
  • ocdb_path (str) –

  • pca_path (str) –

  • pdbbind_kdki_order (str) –

  • reference_column_order (List[str]) –

ocdb_path: str = ''
pca_path: str = ''
pdbbind_kdki_order: str = 'u'
reference_column_order: List[str]
class OCDocker.Config.OCDockerConfig(vina=<factory>, smina=<factory>, gnina=<factory>, plants=<factory>, dock6=<factory>, ledock=<factory>, oddt=<factory>, database=<factory>, tools=<factory>, paths=<factory>, output_level=ReportLevel.WARNING, multiprocess=True, overwrite=False, tmp_dir='', ocdocker_path='', dudez_archive='', pdbbind_archive='', parsed_archive='', logdir='', oddt_models_dir='', available_cores=1)[source]

Bases: object

Main configuration object for OCDocker.

This class encapsulates all configuration settings for OCDocker, replacing the global variables in Initialise.py.

Parameters:
vina: VinaConfig
smina: SminaConfig
gnina: GninaConfig
plants: PLANTSConfig
dock6: Dock6Config
ledock: LeDockConfig
oddt: ODDTConfig
database: DatabaseConfig
tools: ToolsConfig
paths: PathsConfig
output_level: ReportLevel = 2
multiprocess: bool = True
overwrite: bool = False
tmp_dir: str = ''
ocdocker_path: str = ''
dudez_archive: str = ''
pdbbind_archive: str = ''
parsed_archive: str = ''
logdir: str = ''
oddt_models_dir: str = ''
available_cores: int = 1
classmethod from_config_file(config_file)[source]

Load configuration from config file.

Parameters:

config_file (str) – Path to the configuration file

Returns:

Configured instance

Return type:

OCDockerConfig

classmethod from_dict(config_dict)[source]

Create configuration from dictionary.

Useful for testing and programmatic configuration.

Parameters:

config_dict (Dict[str, Any]) – Dictionary containing configuration values

Returns:

Configured instance

Return type:

OCDockerConfig

OCDocker.Config.get_config()[source]

Get the global configuration instance (singleton pattern).

Returns:

The global configuration instance

Return type:

OCDockerConfig

Note

If no configuration has been set, returns a default configuration. For proper initialization, call set_config() or bootstrap from Initialise.

OCDocker.Config.reset_config()[source]

Reset the global configuration to None.

Useful for testing to ensure clean state.

Return type:

None

OCDocker.Config.set_config(config)[source]

Set the global configuration (useful for testing).

Parameters:

config (OCDockerConfig) – Configuration instance to set as global

Return type:

None

Note

This function is thread-safe and can be used to override the global configuration, particularly useful in tests.