### Install ODDT from Source Source: https://oddt.readthedocs.io/en/latest/index.html Installs ODDT by downloading the source code, extracting it, and running the setup script. Requires manual download and extraction. ```bash wget https://github.com/oddt/oddt/archive/0.5.tar.gz tar zxvf 0.5.tar.gz cd oddt-0.5/ python setup.py install ``` -------------------------------- ### ODDT Command Line Interface Examples Source: https://oddt.readthedocs.io/en/latest/index.html Provides various examples of using the oddt_cli tool for docking, filtering, and rescoring ligands via terminal commands. ```bash oddt_cli -h oddt_cli input_ligands.sdf --dock autodock_vina --receptor rec.mol2 --auto_ligand crystal_ligand.mol2 --score rfscore_v2 -O output_ligands.sdf oddt_cli input_ligands.sdf --filter ro5 --filter pains --dock autodock_vina --receptor rec.mol2 --auto_ligand crystal_ligand.mol2 -O output_ligands.sdf oddt_cli ampc/actives_final.mol2.gz --dock autodock_vina --receptor ampc/receptor.pdb --size '(8,8,8)' --center '(1,2,0.5)' --exhaustiveness 20 --seed 1 -O ampc_docked.sdf oddt_cli docked_ligands.sdf --receptor rec.mol2 --score rfscore_v1 --score rfscore_v2 --score rfscore_v3 --score TrainedNN.pickle -O docked_ligands_rescored.sdf ``` -------------------------------- ### Install ODDT from GitHub using PIP Source: https://oddt.readthedocs.io/en/latest/index.html Installs the latest development version of ODDT directly from its GitHub repository using pip. ```bash pip install git+https://github.com/oddt/oddt.git@master ``` -------------------------------- ### Install ODDT using PIP Source: https://oddt.readthedocs.io/en/latest/index.html Installs the ODDT package and its dependencies using pip. Assumes OpenBabel or RDKit is already installed. ```bash pip install oddt ``` -------------------------------- ### GET /oddt/docking/vina Source: https://oddt.readthedocs.io/en/latest/genindex.html Handles docking operations using the AutoDock Vina integration within ODDT. ```APIDOC ## POST /oddt/docking/vina ### Description Executes docking of a ligand into a protein target using the Vina docking engine. ### Method POST ### Endpoint /oddt/docking/vina ### Parameters #### Request Body - **ligand_file** (string) - Required - Path or content of the ligand file - **protein_file** (string) - Required - Path or content of the protein file ### Request Example { "ligand_file": "ligand.sdf", "protein_file": "protein.pdb" } ### Response #### Success Response (200) - **score** (float) - The calculated docking score - **output_file** (string) - Path to the resulting PDBQT file #### Response Example { "score": -8.5, "output_file": "output.pdbqt" } ``` -------------------------------- ### Writing Molecules to Files Source: https://oddt.readthedocs.io/en/latest/rst/oddt.toolkits.html Examples for exporting molecule data to files using the Outputfile class or the molecule's built-in write method. ```python # Using the write method mol.write(format='smi', filename='output.smi', overwrite=True) # Using the Outputfile class from oddt.toolkits.rdk import Outputfile out = Outputfile(format='sdf', filename='out.sdf') out.write(mol) out.close() ``` -------------------------------- ### Loading Molecules and Calculating Interactions Source: https://oddt.readthedocs.io/en/latest/index.html Provides examples for loading molecular structures from files (PDB, SDF) and calculating interactions such as hydrogen bonds and hydrophobic contacts between a protein and a ligand. ```APIDOC ## Loading Molecules and Calculating Interactions ### Description This section covers loading molecular data from files and performing interaction analysis between molecules, including hydrogen bonds and hydrophobic contacts. ### Method File reading and function calls ### Endpoint N/A (In-memory operations) ### Parameters - **file_path** (string) - Required - Path to the molecular file (e.g., 'protein.pdb', 'ligand.sdf'). - **protein** (Molecule object) - Required - The protein molecule object. - **ligand** (Molecule object) - Required - The ligand molecule object. ### Request Example ```python import oddt from oddt.interactions import hbonds, hydrophobic_contacts # Load protein and ligand protein = next(oddt.toolkit.readfile('pdb', 'protein.pdb')) protein.protein = True # Mark as protein to access residue information ligand = next(oddt.toolkit.readfile('sdf', 'ligand.sdf')) # Calculate hydrogen bonds protein_atoms_hb, ligand_atoms_hb, strict_hb = hbonds(protein, ligand) print(f"Residues involved in H-bonds: {protein_atoms_hb['resname']}") # Calculate hydrophobic contacts protein_atoms_hc, ligand_atoms_hc = hydrophobic_contacts(protein, ligand) print(f"Hydrophobic contacts: {protein_atoms_hc}, {ligand_atoms_hc}") # Loading multiple molecules mols = list(oddt.toolkit.readfile('sdf', 'ligands.sdf')) ``` ### Response - **protein_atoms_hb** (dict): Dictionary containing properties of protein atoms involved in hydrogen bonds. - **ligand_atoms_hb** (dict): Dictionary containing properties of ligand atoms involved in hydrogen bonds. - **strict_hb** (bool): Indicates if the hydrogen bond calculation was strict. - **protein_atoms_hc** (dict): Dictionary containing properties of protein atoms involved in hydrophobic contacts. - **ligand_atoms_hc** (dict): Dictionary containing properties of ligand atoms involved in hydrophobic contacts. ``` -------------------------------- ### Initialize ODDT Virtual Screening Module Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/virtualscreening.html Imports necessary dependencies for the virtual screening pipeline, including multiprocessing, file path utilities, and compatibility layers for Python 2/3. This setup is required for executing parallelized screening tasks. ```python """ODDT pipeline framework for virtual screening""" from __future__ import print_function import sys import csv from os.path import dirname, isfile, join from multiprocessing import Pool from itertools import chain from functools import partial import warnings import six from six.moves import filter ``` -------------------------------- ### POST /docking/vina/initialize Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/docking/internal.html Initializes a Vina docking object with protein, ligand, and search box parameters. ```APIDOC ## POST /docking/vina/initialize ### Description Initializes the `vina_docking` class to prepare for docking simulations. It sets the protein structure, ligand, and the search box dimensions. ### Method POST ### Endpoint /docking/vina/initialize ### Parameters #### Request Body - **rec** (object) - Required - Protein molecule object - **lig** (object) - Optional - Ligand molecule object - **box** (array) - Optional - Search box coordinates - **box_size** (float) - Optional - Size of the docking box ### Request Example { "rec": "protein_object", "lig": "ligand_object", "box": [[0,0,0], [10,10,10]] } ### Response #### Success Response (200) - **status** (string) - Initialization status #### Response Example { "status": "success" } ``` -------------------------------- ### ODDT Initialization and Configuration Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/rdk.html Initializes the ODDT library, sets the backend to RDKit, and configures image generation settings. It also checks for IPython notebook environment. ```python from rdkit.Chem.Lipinski import NumRotatableBonds from rdkit.Chem.AllChem import ComputeGasteigerCharges from rdkit.Chem.Pharm2D import Gobbi_Pharm2D, Generate from rdkit.Chem import CanonicalRankAtoms from oddt.toolkits.common import detect_secondary_structure, canonize_ring_path from oddt.toolkits.extras.rdkit import (_sybyl_atom_type, MolFromPDBBlock, MolToPDBQTBlock, MolFromPDBQTBlock) _descDict = dict(Descriptors.descList) backend = 'rdk' __version__ = rdkit.__version__ image_backend = 'png' # png or svg image_size = (200, 200) try: if get_ipython().config: ipython_notebook = True else: ipython_notebook = False except NameError: ipython_notebook = False elementtable = Chem.GetPeriodicTable() ``` -------------------------------- ### GET /oddt/surface/find_surface_residues Source: https://oddt.readthedocs.io/en/latest/rst/oddt.html Finds residues close to the molecular surface. ```APIDOC ## GET /oddt/surface/find_surface_residues ### Description Finds residues close to the molecular surface using marching cubes. Ignores hydrogens and waters. ### Method GET ### Endpoint /oddt/surface/find_surface_residues ### Parameters #### Query Parameters - **molecule** (oddt.toolkit.Molecule) - Required - The molecule to analyze. - **max_dist** (numeric) - Optional - Maximum distance from the surface. - **scaling** (float) - Optional - Grid expansion factor for accuracy. ### Response #### Success Response (200) - **atom_dict** (numpy array) - An atom_dict containing surface residues. ``` -------------------------------- ### Initialize OpenBabel Backend for ODDT Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/ob.html This snippet demonstrates the initialization process for the OpenBabel backend, including handling potential import errors for different OpenBabel versions and setting up the atom type translation table. It ensures that f2py-dependent libraries are loaded before OpenBabel to prevent segmentation faults. ```python from scipy.optimize import fmin_l_bfgs_b try: from openbabel import pybel, openbabel as ob from openbabel.pybel import * from openbabel.openbabel import OBAtomAtomIter, OBAtomBondIter, OBTypeTable except ImportError: import pybel import openbabel as ob from pybel import * from openbabel import OBAtomAtomIter, OBAtomBondIter, OBTypeTable ob.OBIterWithDepth.__next__ = ob.OBIterWithDepth.next typetable = OBTypeTable() typetable.SetFromType('INT') typetable.SetToType('SYB') ``` -------------------------------- ### GET /interactions/pi-stacking Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/interactions.html Identifies pi-stacking interactions between rings of two molecules. ```APIDOC ## GET /interactions/pi-stacking ### Description Returns pairs of rings that meet pi-stacking criteria, evaluating both parallel and perpendicular orientations. ### Method GET ### Endpoint /interactions/pi-stacking ### Parameters #### Query Parameters - **mol1** (object) - Required - First molecule object - **mol2** (object) - Required - Second molecule object - **cutoff** (float) - Optional - Distance cutoff (default 5) - **tolerance** (int) - Optional - Angular tolerance (default 30) ### Response #### Success Response (200) - **r1** (array) - Rings from molecule 1 - **r2** (array) - Rings from molecule 2 - **strict_parallel** (array) - Boolean array for parallel strictness - **strict_perpendicular** (array) - Boolean array for perpendicular strictness ``` -------------------------------- ### GET /surface/residues Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/surface.html Identifies residues located near the molecular surface. ```APIDOC ## GET /surface/residues ### Description Finds residues close to the molecular surface by utilizing the marching cubes surface generation method. Hydrogens and waters are ignored. ### Method GET ### Endpoint /surface/residues ### Parameters #### Query Parameters - **molecule** (oddt.toolkit.Molecule) - Required - The molecule to analyze. - **max_dist** (float) - Optional - Maximum distance threshold for residue inclusion. - **scaling** (float) - Optional - Scaling factor for the underlying grid. ### Request Example { "molecule": "", "max_dist": 5.0 } ### Response #### Success Response (200) - **residues** (list) - List of residues found on the surface. #### Response Example { "residues": ["ALA1", "GLY2"] } ``` -------------------------------- ### Initialize Autodock Vina Engine Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/docking/AutodockVina.html This snippet demonstrates the initialization of the autodock_vina class. It configures the docking box dimensions, center, and performance parameters like exhaustiveness and CPU usage. ```python from oddt.docking import autodock_vina # Initialize the engine vina_engine = autodock_vina( size=(20, 20, 20), center=(0, 0, 0), exhaustiveness=8, num_modes=9, n_cpu=4 ) ``` -------------------------------- ### GET /metrics/average_precision Source: https://oddt.readthedocs.io/en/latest/_modules/sklearn/metrics/_ranking.html Computes the average precision score for binary classification tasks. ```APIDOC ## GET /metrics/average_precision ### Description Computes the average precision (AP) from prediction scores. This score summarizes the precision-recall curve as the weighted mean of precisions achieved at each threshold. ### Method GET ### Endpoint /metrics/average_precision ### Parameters #### Query Parameters - **y_true** (array) - Required - True binary labels. - **y_score** (array) - Required - Target scores or probability estimates. - **pos_label** (int/str) - Optional - The label of the positive class (default=1). - **sample_weight** (array) - Optional - Sample weights. ### Request Example { "y_true": [0, 0, 1, 1], "y_score": [0.1, 0.4, 0.35, 0.8] } ### Response #### Success Response (200) - **average_precision** (float) - The computed average precision score. #### Response Example { "average_precision": 0.83 } ``` -------------------------------- ### GET /oddt/surface/generate_surface_marching_cubes Source: https://oddt.readthedocs.io/en/latest/rst/oddt.html Generates a molecular surface mesh using the marching cubes algorithm. ```APIDOC ## GET /oddt/surface/generate_surface_marching_cubes ### Description Generates a molecular surface mesh using the marching_cubes method from scikit-image. ### Method GET ### Endpoint /oddt/surface/generate_surface_marching_cubes ### Parameters #### Query Parameters - **molecule** (oddt.toolkit.Molecule) - Required - The molecule for surface generation. - **remove_hoh** (bool) - Optional - Whether to remove waters. - **scaling** (float) - Optional - Grid expansion factor. - **probe_radius** (float) - Optional - Radius of the ball used to patch holes. ### Response #### Success Response (200) - **verts** (numpy array) - Spatial coordinates for mesh vertices. - **faces** (numpy array) - Faces referencing vertices. ``` -------------------------------- ### Match SMARTS Patterns Source: https://oddt.readthedocs.io/en/latest/rst/oddt.toolkits.html Demonstrates how to initialize a SMARTS pattern and use it to match or find occurrences within a molecule. ```python from oddt.toolkits.ob import Smarts # Initialize SMARTS pattern smarts = Smarts("[#6]O") # Check for match if smarts.match(molecule): matches = smarts.findall(molecule) ``` -------------------------------- ### GET /atom-representation Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/fingerprints.html Generates a feature representation for an atom, useful for ECFP or FCFP fingerprinting. ```APIDOC ## GET /atom-representation ### Description Provides a simple description of an atom based on its properties or pharmacophoric features, excluding hydrogens. ### Method GET ### Endpoint /atom-representation ### Parameters #### Query Parameters - **mol** (object) - Required - The input molecule object. - **idx** (int) - Required - Root atom index (0-based). - **use_pharm_features** (bool) - Optional - Whether to use pharmacophoric features instead of atomic numbers. ### Response #### Success Response (200) - **atom_repr** (tuple) - A tuple representing the atom's features. #### Response Example { "atom_repr": [0, 1, 0, 0, 0, 1] } ``` -------------------------------- ### Outputfile Initialization and Writing Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/rdk.html Initializes an Outputfile object to write molecules to a specified file format (SDF, SMI, InChI, MOL2, PDB, PDBQT). It handles different file formats and compression (gzip). The write method appends a molecule to the output file, formatting it according to the specified format. ```python def __init__(self, filename, format='sdf', **kwargs): if os.path.exists(filename): raise IOError("%s already exists. Use 'overwrite=True' to overwrite it." % self.filename) if format == "sdf": self._writer = Chem.SDWriter(self.filename, **kwargs) elif format == "smi": self._writer = Chem.SmilesWriter(self.filename, isomericSmiles=True, includeHeader=False, **kwargs) elif format in ('inchi', 'inchikey') and Chem.INCHI_AVAILABLE: self._writer = open(filename, 'w') elif format in ('mol2', 'pdbqt'): self._writer = gzip.open(filename, 'w') if filename.split('.')[-1] == 'gz' else open(filename, 'w') elif format == "pdb": self._writer = Chem.PDBWriter(self.filename) else: raise ValueError("%s is not a recognised RDKit format" % format) self.total = 0 # The total number of molecules written to the file self.writer_kwargs = kwargs def write(self, molecule): """Write a molecule to the output file. Required parameters: molecule """ if not self.filename: raise IOError("Outputfile instance is closed.") if self.format in ('inchi', 'inchikey', 'mol2'): self._writer.write(molecule.write(self.format, **self.writer_kwargs) + '\n') if self.format == 'pdbqt': self._writer.write('MODEL %i\n' % (self.total + 1) + molecule.write(self.format, **self.writer_kwargs) + '\nENDMDL\n') else: self._writer.write(molecule.Mol) self.total += 1 def close(self): """Close the Outputfile to further writing.""" self.filename = None self._writer.flush() del self._writer ``` -------------------------------- ### Vina Docking Class Initialization (Python) Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/docking/internal.html Initializes the Vina docking class, setting up parameters for receptor, ligand, and docking box. It also defines default scoring weights. ```python class vina_docking(object): def __init__(self, rec, lig=None, box=None, box_size=1., weights=None): self.box_size = box_size # TODO: Unify box if rec: self.set_protein(rec) if lig: self.set_ligand(lig) self.set_box(box) # constants self.weights = weights or np.array((-0.0356, -0.00516, 0.840, -0.0351, -0.587, 0.0585)) self.mask_inter = {} self.mask_intra = {} ``` -------------------------------- ### GET /atom-environments Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/fingerprints.html Retrieves circular atom environments for a specified molecule up to a defined depth. ```APIDOC ## GET /atom-environments ### Description Calculates the circular environments of a root atom within a molecule up to a specified depth using a BFS search. ### Method GET ### Endpoint /atom-environments ### Parameters #### Query Parameters - **mol** (object) - Required - The oddt.toolkit.Molecule object. - **root_atom_idx** (int) - Required - 0-based index of the root atom. - **depth** (int) - Required - Maximum depth of environments to return. ### Response #### Success Response (200) - **envs** (list) - A list of atoms at each respective environment depth. #### Response Example { "envs": [[0], [1, 2], [3]] } ``` -------------------------------- ### GET /oddt/scoring/train Source: https://oddt.readthedocs.io/en/latest/genindex.html Endpoint documentation for training scoring functions within the ODDT framework. ```APIDOC ## POST /oddt/scoring/train ### Description Trains a scoring function model such as NNScore, PLECscore, or RFScore using provided training data. ### Method POST ### Endpoint /oddt/scoring/train ### Parameters #### Request Body - **model_type** (string) - Required - The type of scoring function (e.g., 'nnscore', 'plecscore', 'rfscore') - **training_data** (object) - Required - The dataset used for training the model ### Request Example { "model_type": "rfscore", "training_data": { "features": [], "labels": [] } } ### Response #### Success Response (200) - **status** (string) - Training completion status - **model_id** (string) - Identifier for the trained model #### Response Example { "status": "success", "model_id": "rf_model_001" } ``` -------------------------------- ### Write Molecules to File using Outputfile Source: https://oddt.readthedocs.io/en/latest/rst/oddt.toolkits.html Demonstrates how to use the Outputfile class to write one or more molecules to a specified file format. It supports optional format-specific parameters and file overwriting. ```python from oddt.toolkits.ob import Outputfile # Initialize output file output = Outputfile(format="sdf", filename="output.sdf", overwrite=True) # Write a molecule output.write(molecule) # Close the file output.close() ``` -------------------------------- ### Load Molecular Data for Similarity Analysis Source: https://oddt.readthedocs.io/en/latest/index.html Demonstrates how to read molecular files from disk using the ODDT toolkit to prepare for shape comparison. ```python query = next(oddt.toolkit.readfile('sdf', 'query.sdf')) database = list(oddt.toolkit.readfile('sdf', 'database.sdf')) ``` -------------------------------- ### GET /interactions/hydrophobic-contacts Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/interactions.html Identifies hydrophobic contacts between two molecules based on a distance cutoff. ```APIDOC ## GET /interactions/hydrophobic-contacts ### Description Calculates hydrophobic contacts between two molecules by checking the distance between atoms identified as hydrophobic. ### Method GET ### Endpoint /interactions/hydrophobic-contacts ### Parameters #### Query Parameters - **cutoff** (float) - Optional - Distance cutoff for hydrophobe pairs (default=4). ### Request Example { "mol1": "molecule_object_1", "mol2": "molecule_object_2", "cutoff": 4.0 } ### Response #### Success Response (200) - **mol1_atoms** (array) - Aligned array of atoms from mol1 forming hydrophobic contacts. - **mol2_atoms** (array) - Aligned array of atoms from mol2 forming hydrophobic contacts. #### Response Example { "mol1_atoms": [...], "mol2_atoms": [...] } ``` -------------------------------- ### Initialize Binana Descriptor with Vina and Close Contacts Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/scoring/descriptors/binana.html Initializes the Binana descriptor by setting up Vina descriptors and close contact descriptors. It configures specific atom type pairs and cutoffs for close contact calculations, essential for molecular scoring. ```python import numpy as np from oddt.scoring.descriptors import ( atoms_by_type, close_contacts_descriptor, oddt_vina_descriptor) from oddt.interactions import ( close_contacts, hbonds, hydrophobic_contacts, pi_cation, pi_stacking, salt_bridges) class binana_descriptor(object): def __init__(self, protein=None): """ Descriptor build from binana script (as used in NNScore 2.0 Parameters ---------- protein: oddt.toolkit.Molecule object (default=None) Protein object to be used while generating descriptors. """ self.protein = protein self.titles = [] self.vina = oddt_vina_descriptor(protein, vina_scores=['vina_gauss1', 'vina_gauss2', 'vina_repulsion', 'vina_hydrophobic', 'vina_hydrogen']) self.titles += self.vina.titles # Close contacts descriptor generators cc_4_types = (('A', 'A'), ('A', 'C'), ('A', 'CL'), ('A', 'F'), ('A', 'FE'), ('A', 'HD'), ('A', 'MG'), ('A', 'MN'), ('A', 'N'), ('A', 'NA'), ('A', 'OA'), ('A', 'SA'), ('A', 'ZN'), ('BR', 'C'), ('BR', 'HD'), ('BR', 'OA'), ('C', 'C'), ('C', 'CL'), ('C', 'F'), ('C', 'HD'), ('C', 'MG'), ('C', 'MN'), ('C', 'N'), ('C', 'NA'), ('C', 'OA'), ('C', 'SA'), ('C', 'ZN'), ('CL', 'FE'), ('CL', 'HD'), ('CL', 'MG'), ('CL', 'N'), ('CL', 'OA'), ('CL', 'ZN'), ('F', 'HD'), ('F', 'N'), ('F', 'OA'), ('F', 'SA'), ('F', 'ZN'), ('FE', 'HD'), ('FE', 'N'), ('FE', 'OA'), ('HD', 'HD'), ('HD', 'I'), ('HD', 'MG'), ('HD', 'MN'), ('HD', 'N'), ('HD', 'NA'), ('HD', 'OA'), ('HD', 'P'), ('HD', 'S'), ('HD', 'SA'), ('HD', 'ZN'), ('MG', 'NA'), ('MG', 'OA'), ('MN', 'N'), ('MN', 'OA'), ('N', 'N'), ('N', 'NA'), ('N', 'OA'), ('N', 'SA'), ('N', 'ZN'), ('NA', 'OA'), ('NA', 'SA'), ('NA', 'ZN'), ('OA', 'OA'), ('OA', 'SA'), ('OA', 'ZN'), ('S', 'ZN'), ('SA', 'ZN'), ('A', 'BR'), ('A', 'I'), ('A', 'P'), ('A', 'S'), ('BR', 'N'), ('BR', 'SA'), ('C', 'FE'), ('C', 'I'), ('C', 'P'), ('C', 'S'), ('CL', 'MN'), ('CL', 'NA'), ('CL', 'P'), ('CL', 'S'), ('CL', 'SA'), ('CU', 'HD'), ('CU', 'N'), ('FE', 'NA'), ('FE', 'SA'), ('I', 'N'), ('I', 'OA'), ('MG', 'N'), ('MG', 'P'), ('MG', 'S'), ('MG', 'SA'), ('MN', 'NA'), ('MN', 'P'), ('MN', 'S'), ('MN', 'SA'), ('N', 'P'), ('N', 'S'), ('NA', 'P'), ('NA', 'S'), ('OA', 'P'), ('OA', 'S'), ('P', 'S'), ('P', 'SA'), ('P', 'ZN'), ('S', 'SA'), ('SA', 'SA'), ('A', 'CU'), ('C', 'CD')) cc_4_rec_types, cc_4_lig_types = zip(*cc_4_types) self.titles += ['cc_%s.%s_4' % (t1, t2) for t1, t2 in cc_4_types] self.cc_4 = close_contacts_descriptor(protein, cutoff=4, protein_types=cc_4_rec_types, ligand_types=cc_4_lig_types, mode='atom_types_ad4', aligned_pairs=True) self.ele_types = (('A', 'A'), ('A', 'C'), ('A', 'CL'), ('A', 'F'), ('A', 'FE'), ('A', 'HD'), ('A', 'MG'), ('A', 'MN'), ('A', 'N'), ('A', 'NA'), ('A', 'OA'), ('A', 'SA'), ('A', 'ZN'), ('BR', 'C'), ('BR', 'HD'), ('BR', 'OA'), ('C', 'C'), ('C', 'CL'), ('C', 'F'), ('C', 'HD'), ('C', 'MG'), ('C', 'MN'), ('C', 'N'), ('C', 'NA'), ('C', 'OA'), ('C', 'SA'), ('C', 'ZN'), ('CL', 'FE'), ('CL', 'HD'), ('CL', 'MG'), ('CL', 'N'), ('CL', 'OA'), ('CL', 'ZN'), ('F', 'HD'), ('F', 'N'), ('F', 'OA'), ('F', 'SA'), ('F', 'ZN'), ('FE', 'HD'), ('FE', 'N'), ('FE', 'OA'), ('HD', 'HD'), ('HD', 'I'), ('HD', 'MG'), ('HD', 'MN'), ('HD', 'N'), ('HD', 'NA'), ('HD', 'OA'), ('HD', 'P'), ('HD', 'S'), ('HD', 'SA'), ('HD', 'ZN'), ``` -------------------------------- ### GET /atom/{id} Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/rdk.html Retrieves properties of an atom, including its index, neighbors, and partial charges. ```APIDOC ## GET /atom/{id} ### Description Fetches specific atom data including 0-based/1-based indexing, neighbor lists, and calculated partial charges. ### Method GET ### Endpoint /atom/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The internal RDKit index of the atom. ### Response #### Success Response (200) - **idx0** (integer) - 0-based index - **idx1** (integer) - 1-based index - **partialcharge** (float) - Calculated partial charge - **neighbors** (list) - List of neighboring atoms #### Response Example { "idx0": 0, "idx1": 1, "partialcharge": 0.05, "neighbors": [1, 2] } ``` -------------------------------- ### POST /virtualscreening/load_ligands Source: https://oddt.readthedocs.io/en/latest/rst/oddt.html Loads a file containing ligands into the virtual screening pipeline. ```APIDOC ## POST /virtualscreening/load_ligands ### Description Loads a molecular file into the pipeline for processing. ### Method POST ### Endpoint /virtualscreening/load_ligands ### Parameters #### Request Body - **fmt** (string) - Required - The format of the molecular file (e.g., 'sdf', 'mol2'). - **ligands_file** (string) - Required - The file path to the ligands file. ### Request Example { "fmt": "sdf", "ligands_file": "/path/to/ligands.sdf" } ### Response #### Success Response (200) - **status** (string) - Confirmation of successful loading. ``` -------------------------------- ### Initialize and Predict with PLECscore Source: https://oddt.readthedocs.io/en/latest/rst/oddt.scoring.functions.html Demonstrates how to instantiate the PLECscore class with specific model parameters and use it to predict binding affinity for a set of ligands. ```python from oddt.scoring.functions.PLECscore import PLECscore # Initialize PLECscore with a linear model scorer = PLECscore(protein=my_protein, version='linear', n_jobs=-1) # Predict binding affinity for a list of ligands predictions = scorer.predict(ligands) ``` -------------------------------- ### GET /interactions/pi-metal Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/interactions.html Identifies pairs of ring and metal atoms that meet pi-metal interaction criteria. ```APIDOC ## GET /interactions/pi-metal ### Description Returns pairs of ring-metal atoms which meet pi-metal criteria based on distance and perpendicularity. ### Method GET ### Endpoint /interactions/pi-metal ### Parameters #### Query Parameters - **cutoff** (float) - Optional - Distance cutoff for Pi-metal pairs (default=5). - **tolerance** (int) - Optional - Range (+/- tolerance) from perfect perpendicular direction (default=30). ### Response #### Success Response (200) - **r1** (ring_dict) - Aligned rings forming pi-metal. - **m** (atom_dict) - Aligned metals forming pi-metal. - **strict_parallel** (bool array) - Boolean array indicating if the interaction is 'strict' or 'crude'. ``` -------------------------------- ### Train and Predict with ODDT Models Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/scoring.html Demonstrates the core model lifecycle methods including fitting a model to ligand data, generating predictions for new ligands, and evaluating model performance using built-in scoring metrics. ```python def fit(self, ligands, target, *args, **kwargs): self.train_descs = self.descriptor_generator.build(ligands) return self.model.fit(self.train_descs, target, *args, **kwargs) def predict(self, ligands, *args, **kwargs): descs = self.descriptor_generator.build(ligands) return self.model.predict(descs) def score(self, ligands, target, *args, **kwargs): descs = self.descriptor_generator.build(ligands) return self.model.score(descs, target, *args, **kwargs) ``` -------------------------------- ### GET /rcsb/affinity Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/extras/rdkit/fixer.html Fetches binding affinity data for a list of PDB IDs from the RCSB PDB server. ```APIDOC ## GET /rcsb/affinity ### Description Retrieves a table of protein-ligand binding affinities for specified PDB structures. ### Method GET ### Parameters #### Query Parameters - **pdbids** (array-like) - Required - List of PDB IDs. - **affinity_types** (array-like) - Required - List of affinity types (e.g., Ki, Kd, IC50). ### Response #### Success Response (200) - **ligand_affinity** (pd.DataFrame) - Table containing structureId, ligandId, ligandFormula, ligandMolecularWeight, and requested affinity columns. #### Response Example { "structureId": ["1ABC"], "ligandId": ["LIG"], "ligandFormula": ["C10H10O"], "ligandMolecularWeight": [150.2], "Ki": ["10nM"] } ``` -------------------------------- ### GET /interactions/halogen-bonds Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/interactions.html Calculates halogen bonds between two molecules based on distance and angular tolerance criteria. ```APIDOC ## GET /interactions/halogen-bonds ### Description Calculates halogen bonds between two molecules. Returns aligned arrays of atoms forming the bond and a boolean array indicating if the bond is 'strict' based on angular cutoffs. ### Method GET ### Endpoint /interactions/halogen-bonds ### Parameters #### Query Parameters - **mol1** (object) - Required - First molecule object - **mol2** (object) - Required - Second molecule object - **cutoff** (float) - Optional - Distance cutoff for A-H pairs (default 4) - **tolerance** (int) - Optional - Angular tolerance in degrees (default 30) ### Response #### Success Response (200) - **mol1_atoms** (array) - Aligned atoms from molecule 1 - **mol2_atoms** (array) - Aligned atoms from molecule 2 - **strict** (array) - Boolean array indicating strict bond status ``` -------------------------------- ### POST /vina/write_pdbqt Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/docking/AutodockVina.html Writes a molecule to a PDBQT file format suitable for Autodock Vina, handling flexible/rigid configurations. ```APIDOC ## POST /vina/write_pdbqt ### Description Converts a molecule object into a PDBQT file. This is essential for preparing ligands or proteins for Vina docking simulations. ### Method POST ### Endpoint /vina/write_pdbqt ### Parameters #### Request Body - **mol** (object) - Required - The oddt.toolkit.Molecule object to write. - **directory** (string) - Required - The target directory path. - **flexible** (boolean) - Optional - Whether to treat the molecule as flexible (default: True). - **name_id** (string) - Optional - Identifier to prepend to the filename. ### Response #### Success Response (200) - **path** (string) - The file path of the generated PDBQT file. ``` -------------------------------- ### ODDT Command Line Interface Source: https://oddt.readthedocs.io/en/latest/index.html CLI tool for virtual screening, docking, and scoring ligands without programming. ```APIDOC ## CLI: oddt_cli ### Description Interface for virtual screening, docking, and scoring ligands. Supports filtering, docking, and rescoring. ### Usage `oddt_cli [input_files] [options] -O [output_file]` ### Common Options - **--dock**: Specify docking engine (e.g., autodock_vina). - **--receptor**: Path to receptor file. - **--score**: Scoring function to apply. - **--filter**: Apply filters (e.g., ro5, pains). ### Example: Docking with Vina `oddt_cli input.sdf --dock autodock_vina --receptor rec.mol2 --auto_ligand crystal.mol2 -O output.sdf` ``` -------------------------------- ### GET /load Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/scoring/functions/PLECscore.html Loads a pre-trained PLECscore model from a file or trains a new one if the file is not found. ```APIDOC ## GET /load ### Description Attempts to load a PLECscore model from a specified pickle file. If the file is not found, it triggers the training process automatically. ### Method GET ### Endpoint /load ### Parameters #### Query Parameters - **filename** (string) - Optional - Path to the pickle file. - **version** (string) - Optional - Model version (default 'linear'). - **pdbbind_version** (integer) - Optional - PDBBind version to use if training is required. ### Request Example { "filename": "PLEClinear_p5_l1_pdbbind2016_s65536.pickle" } ### Response #### Success Response (200) - **model** (object) - The loaded PLECscore model instance. #### Response Example { "status": "success", "message": "Model loaded successfully" } ``` -------------------------------- ### ODDT Library Functions and Classes - A Source: https://oddt.readthedocs.io/en/latest/genindex.html This section lists functions and classes starting with the letter 'A' in the ODDT library. ```APIDOC ## Functions and Classes (A) ### Description This section lists functions and classes in the ODDT library that start with the letter 'A'. ### Functions and Classes - acceptor_metal() (in module oddt.interactions) - activities() (oddt.datasets.pdbbind property) - AddAtomsError - addh() (oddt.toolkits.ob.Molecule method) - (oddt.toolkits.rdk.Molecule method) - AddMissingAtoms() (in module oddt.toolkits.extras.rdkit.fixer) - angle() (in module oddt.spatial) - angle_2v() (in module oddt.spatial) - apply_filter() (oddt.virtualscreening.virtualscreening method) - Atom (class in oddt.toolkits.ob) - (class in oddt.toolkits.rdk) - atom_dict() (oddt.toolkits.ob.Molecule property) - (oddt.toolkits.rdk.Molecule property) - atomicnum() (oddt.toolkits.rdk.Atom property) - AtomListToSubMol() (in module oddt.toolkits.extras.rdkit) - atoms() (oddt.toolkits.ob.Bond property) - (oddt.toolkits.ob.Molecule property) - (oddt.toolkits.ob.Residue property) - (oddt.toolkits.rdk.Bond property) - (oddt.toolkits.rdk.Molecule property) - (oddt.toolkits.rdk.Residue property) - AtomStack (class in oddt.toolkits.ob) - (class in oddt.toolkits.rdk) - auc() (in module oddt.metrics) - autodock_vina (class in oddt.docking) - (class in oddt.docking.AutodockVina) - autodock_vina_descriptor (class in oddt.scoring.descriptors) ``` -------------------------------- ### Load Ligands into Pipeline (Python) Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/virtualscreening.html Loads ligands from a specified file into the virtual screening pipeline. Supports different file formats and includes specific handling for 'mol2' files when using the Open Babel backend, potentially disabling certain optimizations. ```python from itertools import chain import oddt def load_ligands(self, fmt, ligands_file, **kwargs): """Loads file with ligands. Parameters ---------- file_type: string Type of molecular file ligands_file: string Path to a file, which is loaded to pipeline """ if fmt == 'mol2' and oddt.toolkit.backend == 'ob': if 'opt' in kwargs: kwargs['opt']['c'] = None else: kwargs['opt'] = {'c': None} self._mol_feed = chain(self._mol_feed, oddt.toolkit.readfile(fmt, ligands_file, **kwargs)) ``` -------------------------------- ### GET /residue/{idx} Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/toolkits/ob.html Retrieves information about a specific residue within a molecule, including its atoms, chain, and name. ```APIDOC ## GET /residue/{idx} ### Description Retrieves details for a specific residue identified by its index within the molecule. ### Method GET ### Endpoint /residue/{idx} ### Parameters #### Path Parameters - **idx** (integer) - Required - The 0-based index of the residue. ### Response #### Success Response (200) - **atoms** (list) - List of Atom objects in the residue. - **name** (string) - The name of the residue. - **chain** (string) - The chain identifier. - **number** (integer) - The residue number. #### Response Example { "name": "ALA", "chain": "A", "number": 1 } ``` -------------------------------- ### GET /interactions/acceptor-metal Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/interactions.html Identifies pairs of acceptor and metal atoms that meet specific distance and angular coordination criteria. ```APIDOC ## GET /interactions/acceptor-metal ### Description Returns pairs of acceptor-metal atoms that meet metal coordination criteria. This function is directional where mol1 holds acceptors and mol2 holds metals. ### Method GET ### Endpoint /interactions/acceptor-metal ### Parameters #### Query Parameters - **cutoff** (float) - Optional - Distance cutoff for A-M pairs (default=4). - **tolerance** (int) - Optional - Range (+/- tolerance) from perfect direction defined by atoms hybridization (default=30). ### Response #### Success Response (200) - **a** (atom_dict) - Aligned array of acceptor atoms. - **m** (atom_dict) - Aligned array of metal atoms. - **strict** (bool array) - Boolean array indicating if the interaction is 'strict' or 'crude'. ``` -------------------------------- ### Initialize Virtual Screening Pipeline (Python) Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/virtualscreening.html Initializes the virtual screening pipeline stack. Configurable parameters include the number of CPU cores for parallel processing, a verbosity flag, and the chunk size for processing. ```python import oddt class virtualscreening: def __init__(self, n_cpu=-1, verbose=False, chunksize=100): """Virtual Screening pipeline stack Parameters ---------- n_cpu: int (default=-1) The number of parallel procesors to use verbose: bool (default=False) Verbosity flag for some methods """ self._pipe = [] self._mol_feed = [] self.n_cpu = n_cpu if n_cpu else -1 self.num_input = 0 self.num_output = 0 self.verbose = verbose self.chunksize = chunksize ``` -------------------------------- ### Initialize DUD-E Dataset Wrapper Source: https://oddt.readthedocs.io/en/latest/_modules/oddt/datasets.html The dude class initializes a connection to a DUD-E dataset directory. It validates the presence of required files for each target and provides an interface to iterate or access specific targets. ```python class dude(object): def __init__(self, home): self.home = home if not os.path.isdir(self.home): raise Exception('Directory %s doesn\'t exist' % self.home) self.ids = [] # ... initialization logic ... def __iter__(self): for dude_id in self.ids: yield _dude_target(self.home, dude_id) def __getitem__(self, dude_id): if dude_id in self.ids: return _dude_target(self.home, dude_id) else: raise KeyError('There is no such target ("%s")' % dude_id) ``` -------------------------------- ### ODDT Library Functions and Classes - D Source: https://oddt.readthedocs.io/en/latest/genindex.html This section lists functions and classes starting with the letter 'D' in the ODDT library. ```APIDOC ## Functions and Classes (D) ### Description This section lists functions and classes in the ODDT library that start with the letter 'D'. ### Functions and Classes - data() (oddt.toolkits.rdk.Molecule property) - descs (in module oddt.toolkits.rdk) - detect_secondary_structure() (in module oddt.toolkits.common) - dice() (in module oddt.fingerprints) - dihedral() (in module oddt.spatial) - distance() (in module oddt.spatial) - diverse_conformers_generator() (in module oddt.toolkits.ob) - (in module oddt.toolkits.rdk) - dock() (oddt.docking.autodock_vina method) - (oddt.docking.AutodockVina.autodock_vina method) - (oddt.virtualscreening.virtualscreening method) - dude (class in oddt.datasets) ```