Skip to content

deeporigin.drug_discovery.complex

Module to support Drug Discovery workflows using Deep Origin

Classes

Complex dataclass

class to represent a set of a protein and 1 or many ligands

Attributes

ligands property writable
ligands: list[Ligand]

Get the current ligands

protein instance-attribute
protein: Protein = protein

Functions

connect
connect() -> None

Connect instance of Complex to the databases on Deep Origin. This method uploads ligand and protein files if needed, and retrieves job IDs of tasks for all tools, if they exist.

Before running any tool, it is required to call this method.

from_dir classmethod
from_dir(directory: str) -> Complex

Initialize a Complex from a directory containing protein and ligand files.

Parameters:

Name Type Description Default
directory str

Directory containing ligand and protein files.

required

The directory should contain: - Exactly one PDB file for the protein - One or more SDF files for the ligands. Each SDF file can contain one or more molecules.

Returns:

Name Type Description
Complex Complex

A new Complex instance initialized from the files in the directory.

Raises:

Type Description
ValueError

If no PDB file is found or if multiple PDB files are found.

get_csv_results_for
get_csv_results_for(tool: VALID_TOOLS)

Generic method to get CSV results for a particular tool and combine them as need be

Parameters:

Name Type Description Default
tool VALID_TOOLS

One of "Docking", "ABFE", "RBFE"

required
get_result_files_for
get_result_files_for(
    *,
    tool: VALID_TOOLS,
    ligand_ids: Optional[list[str]] = None
)

Retrieve result files for a specific computational tool used with this complex.

This method fetches data from the specified tool's database, filters for results associated with this complex, downloads any missing result files to the local storage directory, and returns paths to all result files.

Parameters:

Name Type Description Default
tool VALID_TOOLS

One of "Docking", "ABFE", "RBFE" - specifies which computational method's results to retrieve

required
ligand_ids Optional[list[str]]

Optional; list of ligand IDs to filter results. If None, results for all ligands in the complex will be retrieved.

None
show_ligands
show_ligands(
    *, view: str = "2d", limit: Optional[int] = None
)

Display ligands in the complex object.

Parameters:

Name Type Description Default
view str

Visualization type, either "2d" (default) or "3d". - "2d": Shows ligands in a table with 2D structure renderings - "3d": Shows 3D molecular structures using SDF files

'2d'
limit Optional[int]

Optional; maximum number of ligands to display. If None, all ligands will be shown.

None