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 the AutoDock Vina docking engine.

Parameters:
  • executable (str, optional) – Path or name of the Vina executable, by default "vina".

  • split_executable (str, optional) – Path or name of the Vina split executable, by default "vina_split".

  • energy_range (str, optional) – Maximum energy difference between best and worst binding mode (kcal/mol), by default "10".

  • exhaustiveness (int | str, optional) – Search exhaustiveness, by default 5.

  • num_modes (str, optional) – Maximum number of binding modes to generate, by default "3".

  • scoring (str, optional) – Active scoring function name, by default "vina".

  • scoring_functions (list of str, optional) – Scoring functions available for rescoring, by default ["vina"].

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 the Smina docking engine.

Parameters:
  • executable (str, optional) – Path or name of the Smina executable, by default "smina".

  • energy_range (str, optional) – Maximum energy difference between best and worst binding mode, by default "10".

  • exhaustiveness (str, optional) – Search exhaustiveness, by default "5".

  • num_modes (str, optional) – Maximum number of binding modes to generate, by default "3".

  • scoring (str, optional) – Active scoring function name, by default "vinardo".

  • scoring_functions (list of str, optional) – Scoring functions available for rescoring, by default ["vinardo"].

  • custom_scoring (str, optional) – Custom scoring file path or "no", by default "no".

  • custom_atoms (str, optional) – Custom atom types file path or "no", by default "no".

  • local_only (str, optional) – Local optimization only flag, by default "no".

  • minimize (str, optional) – Minimize final poses flag, by default "no".

  • randomize_only (str, optional) – Randomize coordinates only flag, by default "no".

  • minimize_iters (str, optional) – Number of minimization iterations, by default "0".

  • accurate_line (str, optional) – Accurate line search flag, by default "no".

  • minimize_early_term (str, optional) – Early termination during minimization flag, by default "no".

  • approximation (str, optional) – Approximation method for scoring, by default "spline".

  • factor (str, optional) – Approximation factor, by default "32".

  • force_cap (str, optional) – Force cap during minimization, by default "10".

  • user_grid (str, optional) – User grid file path or "no", by default "no".

  • user_grid_lambda (str, optional) – User grid lambda parameter, by default "no".

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 the Gnina docking engine.

String fields use "no" where a Gnina CLI flag is disabled unless noted. List fields hold allowed scoring or CNN model identifiers.

Parameters:
  • executable (str, optional) – Path or name of the Gnina executable, by default "gnina".

  • flex (str, optional) – Flexible receptor and distance restraints, by default "no".

  • flexres (str, optional) – Flexible receptor and distance restraints, by default "no".

  • flexdist_ligand (str, optional) – Flexible receptor and distance restraints, by default "no".

  • flexdist (str, optional) – Flexible receptor and distance restraints, by default "no".

  • flex_limit (str, optional) – Flexible receptor and distance restraints, by default "no".

  • flex_max (str, optional) – Flexible receptor and distance restraints, by default "no".

  • autobox_ligand (str, optional) – Ligand file for autobox centering, by default "no".

  • autobox_add (str, optional) – Autobox padding (Å), by default "4" and "1".

  • autobox_extend (str, optional) – Autobox padding (Å), by default "4" and "1".

  • no_lig (str, optional) – Disable ligand input flag, by default "no".

  • covalent_rec_atom (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • covalent_lig_atom_pattern (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • covalent_lig_atom_position (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • covalent_fix_lig_atom_position (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • covalent_bond_order (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • covalent_optimize_lig (str, optional) – Covalent docking options, by default "no" except covalent_bond_order ("1").

  • exhaustiveness (str, optional) – Search exhaustiveness, by default "8".

  • num_modes (str, optional) – Maximum number of output poses, by default "9".

  • scoring (str, optional) – Primary scoring function, by default "default".

  • scoring_functions (list of str, optional) – Allowed Gnina scoring function names, by default GNINA default list.

  • custom_scoring (str, optional) – Custom scoring or atom-type files, by default "no".

  • custom_atoms (str, optional) – Custom scoring or atom-type files, by default "no".

  • score_only (str, optional) – Pose processing modes, by default "no".

  • local_only (str, optional) – Pose processing modes, by default "no".

  • minimize (str, optional) – Pose processing modes, by default "no".

  • randomize_only (str, optional) – Pose processing modes, by default "no".

  • num_mc_steps (str, optional) – Monte Carlo minimization controls, by default "no".

  • max_mc_steps (str, optional) – Monte Carlo minimization controls, by default "no".

  • num_mc_saved (str, optional) – Monte Carlo minimization controls, by default "no".

  • temperature (str, optional) – Monte Carlo minimization controls, by default "no".

  • minimize_iters (str, optional) – Minimization iteration count, by default "0".

  • accurate_line (str, optional) – Minimization behavior flags, by default "no".

  • simple_ascent (str, optional) – Minimization behavior flags, by default "no".

  • minimize_early_term (str, optional) – Minimization behavior flags, by default "no".

  • minimize_single_full (str, optional) – Minimization behavior flags, by default "no".

  • approximation (str, optional) – Scoring approximation method, by default "spline".

  • factor (str, optional) – Approximation factor and force cap, by default "32" and "10".

  • force_cap (str, optional) – Approximation factor and force cap, by default "32" and "10".

  • user_grid (str, optional) – User grid file, by default "no".

  • user_grid_lambda (str, optional) – User grid lambda, by default "-1".

  • print_terms (str, optional) – Debug output flags, by default "no".

  • print_atom_types (str, optional) – Debug output flags, by default "no".

  • cnn_scoring (str, optional) – CNN rescoring mode, by default "rescore".

  • cnn (str, optional) – Default CNN model set, by default "default".

  • cnn_models (list of str, optional) – Available CNN model identifiers, by default GNINA default list.

  • cnn_model (str, optional) – Explicit CNN model override, by default "no".

  • cnn_rotation (str, optional) – CNN rotation augmentation count, by default "0".

  • cnn_mix_emp_force (str, optional) – CNN / empirical score mixing weights, by default "no", "no", "1".

  • cnn_mix_emp_energy (str, optional) – CNN / empirical score mixing weights, by default "no", "no", "1".

  • cnn_empirical_weight (str, optional) – CNN / empirical score mixing weights, by default "no", "no", "1".

  • cnn_center_x (str, optional) – CNN grid center overrides, by default "no".

  • cnn_center_y (str, optional) – CNN grid center overrides, by default "no".

  • cnn_center_z (str, optional) – CNN grid center overrides, by default "no".

  • cnn_verbose (str, optional) – Verbose CNN output, by default "no".

  • out_flex (str, optional) – Output formatting options, by default "no".

  • atom_terms (str, optional) – Output formatting options, by default "no".

  • atom_term_data (str, optional) – Output formatting options, by default "no".

  • pose_sort_order (str, optional) – Pose sorting key, by default "CNNscore".

  • full_flex_output (str, optional) – Write full flexible receptor output, by default "no".

  • cpu (str, optional) – CPU thread count, by default "auto".

  • seed (str, optional) – Random seed, by default "no".

  • min_rmsd_filter (str, optional) – Minimum RMSD filter between poses, by default "1".

  • quiet (str, optional) – Suppress Gnina stdout, by default "no".

  • addH (str, optional) – Protonation controls, by default "yes" and "no".

  • stripH (str, optional) – Protonation controls, by default "yes" and "no".

  • device (str, optional) – CUDA device index, by default "0".

  • no_gpu (str, optional) – Disable GPU acceleration, by default "no".

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 the PLANTS docking engine.

Parameters:
  • executable (str, optional) – Path or name of the PLANTS executable, by default "plants".

  • cluster_structures (int, optional) – Number of cluster structures to retain, by default 3.

  • cluster_rmsd (str, optional) – RMSD threshold for clustering (Å), by default "2.0".

  • search_speed (str, optional) – PLANTS search speed preset, by default "speed1".

  • scoring (str, optional) – Primary scoring function, by default "chemplp".

  • scoring_functions (list of str, optional) – Available scoring functions, by default ["chemplp", "plp", "plp95"].

  • rescoring_mode (str, optional) – Rescoring mode after docking, by default "simplex".

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 the Dock6 docking engine.

Parameters:
  • executable (str, optional) – Path to the Dock6 executable, by default "".

  • vdw_defn_file (str, optional) – Path to the van der Waals parameter file, by default "".

  • flex_defn_file (str, optional) – Path to the flexible receptor definition file, by default "".

  • flex_drive_file (str, optional) – Path to the flexible receptor drive file, by default "".

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 the LeDock docking engine.

Parameters:
  • executable (str, optional) – Path to the LeDock executable, by default "".

  • lepro (str, optional) – Path to the LePro executable, by default "".

  • rmsd (str, optional) – RMSD clustering threshold, by default "".

  • num_poses (str, optional) – Number of poses to output, by default "".

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 rescoring functions.

Parameters:
  • seed (str, optional) – Random seed for ODDT scoring, by default "".

  • chunk_size (str, optional) – Batch chunk size for ODDT inference, by default "".

  • scoring_functions (list of str, optional) – Enabled ODDT scoring function names, by default empty list.

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, optional) – Database backend (postgresql, mysql, sqlite), by default "postgresql".

  • host (str, optional) – Database host, by default "".

  • user (str, optional) – Database user name, by default "".

  • password (str, optional) – Database password, by default "".

  • database (str, optional) – Database name, by default "".

  • optimizedb (str, optional) – Optimized database identifier, by default "".

  • port (int, optional) – Database port, by default None.

  • sqlite_path (str, optional) – Filesystem path for SQLite backend, by default "".

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 helper tools.

Parameters:
  • pythonsh (str, optional) – Python interpreter used by MGLTools scripts, by default "pythonsh".

  • prepare_ligand (str, optional) – MGLTools ligand preparation script, by default "prepare_ligand4.py".

  • prepare_receptor (str, optional) – MGLTools receptor preparation script, by default "prepare_receptor4.py".

  • chimera (str, optional) – UCSF Chimera executable path, by default "".

  • dssp (str, optional) – DSSP executable for secondary structure, by default "dssp".

  • obabel (str, optional) – Open Babel executable, by default "obabel".

  • spores (str, optional) – SPORES executable for receptor preparation, by default "spores".

  • dudez_download (str, optional) – DUDE-Z download helper path, by default "".

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 for datasets and reference files.

Parameters:
  • ocdb_path (str, optional) – Root path to the OCDocker database bundle, by default "".

  • pca_path (str, optional) – Path to PCA model artifacts, by default "".

  • pdbbind_kdki_order (str, optional) – PDBbind Kd/Ki ordering flag, by default "u".

  • reference_column_order (list of str, optional) – Reference column order for mask application, by default empty list.

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='', litpcba_archive='', parsed_archive='', logdir='', oddt_models_dir='', available_cores=1)[source]

Bases: object

Main configuration object for OCDocker.

Encapsulates docking engines, database, tools, paths, and runtime settings. Prefer get_config() for the process-wide singleton instance.

Parameters:
  • vina (VinaConfig, optional) – AutoDock Vina settings, by default factory VinaConfig.

  • smina (SminaConfig, optional) – Smina settings, by default factory SminaConfig.

  • gnina (GninaConfig, optional) – Gnina settings, by default factory GninaConfig.

  • plants (PLANTSConfig, optional) – PLANTS settings, by default factory PLANTSConfig.

  • dock6 (Dock6Config, optional) – Dock6 settings, by default factory Dock6Config.

  • ledock (LeDockConfig, optional) – LeDock settings, by default factory LeDockConfig.

  • oddt (ODDTConfig, optional) – ODDT rescoring settings, by default factory ODDTConfig.

  • database (DatabaseConfig, optional) – Database connection settings, by default factory DatabaseConfig.

  • tools (ToolsConfig, optional) – External tool paths, by default factory ToolsConfig.

  • paths (PathsConfig, optional) – Dataset and reference paths, by default factory PathsConfig.

  • output_level (ReportLevel, optional) – Global logging/report level, by default ReportLevel.WARNING.

  • multiprocess (bool, optional) – Enable multiprocessing where supported, by default True.

  • overwrite (bool, optional) – Overwrite existing output files, by default False.

  • tmp_dir (str, optional) – Temporary working directory, by default "".

  • ocdocker_path (str)

  • dudez_archive (str)

  • pdbbind_archive (str)

  • litpcba_archive (str)

  • parsed_archive (str)

  • logdir (str)

  • oddt_models_dir (str)

  • available_cores (int)

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 = ''
litpcba_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.