Skip to content

deeporigin.drug_discovery.Pocket

A class representing a binding pocket in a protein structure.

Attributes

block_content class-attribute instance-attribute

block_content: str = ''

block_type class-attribute instance-attribute

block_type: str = ''

color class-attribute instance-attribute

color: str = 'red'

coordinates class-attribute instance-attribute

coordinates: Optional[ndarray] = None

file_path class-attribute instance-attribute

file_path: Optional[Path] = None

index class-attribute instance-attribute

index: Optional[int] = 0

name class-attribute instance-attribute

name: Optional[str] = None

pdb_id class-attribute instance-attribute

pdb_id: Optional[str] = None

props class-attribute instance-attribute

props: Optional[Dict[str, Any]] = field(
    default_factory=dict
)

structure class-attribute instance-attribute

structure: Optional[ndarray] = None

Functions

from_block classmethod

from_block(
    block_content: str,
    block_type: str = "pdb",
    **kwargs: Any
) -> Pocket

Create a Pocket instance from block content.

Parameters:

Name Type Description Default
block_content str

The content of the pocket structure.

required
block_type str

The format of the block content (default: "pdb").

'pdb'
**kwargs Any

Additional arguments to pass to the Pocket constructor.

{}

Returns:

Name Type Description
Pocket Pocket

A new Pocket instance.

from_file classmethod

from_file(file_path: str, **kwargs: Any) -> Pocket

Create a Pocket instance from a file.

Parameters:

Name Type Description Default
file_path str

Path to the pocket structure file.

required
**kwargs Any

Additional arguments to pass to the Pocket constructor.

{}

Returns:

Name Type Description
Pocket Pocket

A new Pocket instance.

from_name classmethod

from_name(name: str, **kwargs: Any) -> Pocket

Create a Pocket instance by searching for a file with the given name in the pockets directory.

Parameters:

Name Type Description Default
name str

Name of the pocket to search for.

required
**kwargs Any

Additional arguments to pass to the Pocket constructor.

{}

Returns:

Name Type Description
Pocket Pocket

A new Pocket instance.

from_pocket_finder_results classmethod

from_pocket_finder_results(
    pocket_finder_results_dir: str | Path,
) -> List[Pocket]

Create a list of Pocket objects from pocket finder results directory.

Parameters:

Name Type Description Default
pocket_finder_results_dir str | Path

Directory containing pocket finder results with PDB files for each pocket and a CSV properties file.

required

Returns:

Type Description
List[Pocket]

List of Pocket objects with properties from the CSV file.

from_structure classmethod

from_structure(
    structure: ndarray,
    name: Optional[str] = None,
    **kwargs: Any
) -> Pocket

Create a Pocket instance directly from a structure array.

Parameters:

Name Type Description Default
structure ndarray

The structure array.

required
name Optional[str]

Name for the pocket.

None
**kwargs Any

Additional arguments to pass to the Pocket constructor.

{}

Returns:

Name Type Description
Pocket Pocket

A new Pocket instance.

get_center

get_center() -> ndarray

Get the center of the pocket based on its coordinates.

Returns:

Type Description
ndarray

np.ndarray: A numpy array containing the center of the pocket.

get_directory staticmethod

get_directory() -> str

Generates and ensures the existence of a directory for pockets.

Returns:

Name Type Description
str str

The path to the pockets directory.

load_structure

load_structure(structure_file_path: str | Path) -> None

Load a PDB structure from a file path into the structure attribute.

Parameters:

Name Type Description Default
structure_file_path str | Path

Path to the PDB file.

required

load_structure_from_block

load_structure_from_block(
    block_content: str, block_type: str
)

Load a pocket structure from block content.

Parameters: - block_content (str): String containing the pocket data. - block_type (str): Format of the block content ('pdb').

Returns: - AtomArray: Loaded structure.

Raises: - ValueError: If the block type is unsupported.

pocket_props

pocket_props()

get the properties of the pocket

show

show()

show the pocket in a jupyter notebook

update_coordinates

update_coordinates(coords: ndarray)

update coordinates of the pocket structure

write_to_file

write_to_file(output_path: str, output_format: str = 'pdb')

Write the current state of the structure to a PDB file.

Parameters: - file_path (str): Path where the pocket structure will be written.