CLI Examples

These examples demonstrate how to use OCDocker from the command line.

Basic Docking

Example of basic docking operations with Vina:

Basic Vina docking example
#!/bin/bash
# Example 1: Basic CLI docking with Vina
# This example shows how to run a simple docking job using the CLI

# Basic docking with Vina
ocdocker vs \
  --engine vina \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb \
  --outdir ./docking_output \
  --timeout 600

# Skip rescoring for faster execution
ocdocker vs \
  --engine vina \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb \
  --skip-rescore \
  --outdir ./docking_output

Multi-Engine Pipeline

Example of running a multi-engine docking pipeline:

Multi-engine docking pipeline
#!/bin/bash
# Example 2: Multi-engine docking pipeline
# This example shows how to run docking across multiple engines with clustering and rescoring

# Run pipeline with multiple engines
ocdocker pipeline \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb \
  --engines vina,smina,plants \
  --outdir ./pipeline_output \
  --timeout 900

# Pipeline with only Vina and Smina
ocdocker pipeline \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb \
  --engines vina,smina \
  --outdir ./pipeline_output

# Pipeline with vina, plants, and rescore with all engines
ocdocker pipeline \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb \
  --engines vina,plants \
  --rescoring-engines vina,smina,plants,oddt \
  --outdir ./pipeline_output \
  --multiprocess

Diagnostics

Example of running diagnostics to check your installation:

Diagnostics script
#!/bin/bash
# Example 3: Diagnostics and configuration
# This example shows how to check your OCDocker installation and create configuration files

# Run diagnostics to check installation
ocdocker doctor --conf OCDocker.cfg

# Create a new configuration file from example
ocdocker init-config --conf my_ocdocker.cfg

# Check version
ocdocker version

# Run with custom config file
ocdocker vs \
  --conf my_ocdocker.cfg \
  --engine vina \
  --receptor ./test_files/test_ptn1/receptor.pdb \
  --ligand ./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi \
  --box ./test_files/test_ptn1/compounds/ligands/ligand/boxes/box0.pdb

Interactive Console

Example of using the interactive console:

Interactive console example
#!/usr/bin/env python3
"""
Example 4: Using the interactive console
This example shows how to use the OCDocker interactive console for step-by-step workflows
"""

# To use the interactive console, run:
# ocdocker console --conf OCDocker.cfg

# The console provides:
# - Pre-imported OCDocker modules (Receptor, Ligand, Docking classes, etc.)
# - Tab completion for easier exploration
# - Step-by-step execution of docking workflows
# - Access to print_args() function to check configuration

# Example console session:
"""
$ ocdocker console --conf OCDocker.cfg

>>> print_args()  # Check current configuration
>>> print_args('paths')  # Check binary paths
>>> print_args('vina')  # Check Vina parameters

>>> import OCDocker.Receptor as ocr
>>> receptor = ocr.Receptor("./test_files/test_ptn1/receptor.pdb", name="MyReceptor")

>>> import OCDocker.Ligand as ocl
>>> ligand = ocl.Ligand("./test_files/test_ptn1/compounds/ligands/ligand/ligand.smi", name="MyLigand")

>>> import OCDocker.Docking.Vina as ocvina
>>> vina = ocvina.Vina(*parameters)
>>> vina.run_prepare_receptor()
>>> vina.run_prepare_ligand()
>>> vina.run_docking()
"""