Skip to main content

A package for extracting ligands and binding pockets from PDB files

Project description

Pocket Extraction

Pocket Extraction is a Python package built on Biopython for extracting ligands and binding pockets from structural biology files (PDB/mmCIF). It supports high-throughput screening as well as detailed structural analyses.


Key Features ✨

  • Binding Pocket Extraction
    Extract pockets around ligands using either:

    • An existing ligand file, or
    • Manually specified coordinates
      (Adjust the search radius as needed.)
  • Ligand Extraction
    Retrieve ligands by specifying names (single/multiple) or by automatically processing all non-solvent HETATM residues.

  • Flexible I/O Support

    • Input: PDB, mmCIF
    • Output: PDB (default), mmCIF
  • Advanced Filtering & Batch Processing
    Filter by model ID, chain ID, or ligand names; process multiple ligands/pockets in one command.


Installation

Install via pip:

pip install pocket_extraction

Usage Examples

The package provides both CLI and Python interfaces. Below are the consolidated examples that cover the most common use cases.

1. Extracting Binding Pockets

CLI:

# Using an existing ligand file:
extract_pocket input.pdb -o pocket.cif --ligand_file ligand.pdb --radius 12.5

# Using manual coordinates (specify ligand center):
extract_pocket input.cif -o pocket.pdb --ligand_center 10.0 20.0 30.0 --radius 10.0

Python:

from pocket_extraction import extract_pocket, get_ligand_coords

# Option A: Using an existing ligand file
ligand_coords = get_ligand_coords("ligand.pdb")
extract_pocket("input.pdb", "pocket.pdb", ligand_coords=ligand_coords, radius=12.5)

# Option B: Using manually provided coordinates
extract_pocket("input.cif", "pocket.cif", ligand_center=[10.0, 20.0, 30.0], radius=10.0)

Note: Choose the option that matches your data source. The only difference is in providing either a ligand file (or coordinates obtained from it) or manual coordinates.


2. Extracting Ligands

CLI:

# For a specific ligand or multiple ligands:
extract_ligand input.pdb -o output_path --ligands NAD         # Single ligand
extract_ligand input.cif -o output_dir --ligands ATP NAD --multi  # Multiple ligands, each saved separately

Python:

from pocket_extraction import extract_ligand

# Example for a specific ligand with optional filtering parameters:
extract_ligand("input.pdb", "nad.pdb", ligand_names=["NAD"], model_id=0, chain_id="A")

# Example for multiple ligands:
extract_ligand("input.cif", "output_dir/", ligand_names=["ATP", "NAD"], multi_mode=True)

3. Combined Extraction of Ligands and Pockets

Use the combined function for simultaneous extraction. Adjust parameters based on your workflow:

CLI:

# Example 1: Merged multi-residue ligand with a unified pocket
extract_ligand_and_pocket input.pdb -l ligand.pdb -p pocket.pdb --ligand_names HIS ARG --model_id 0 --chain_id E --radius 12.0

# Example 2: Separate files for each ligand and pocket:
extract_ligand_and_pocket input.pdb -l ligands/ -p pockets/ --ligands ATP NAD --multi --radius 10.0

# Example 3: Automatic extraction of all non-solvent ligands and pockets:
extract_ligand_and_pocket input.pdb -l auto_ligands/ -p auto_pockets/ --multi --radius 10.0

Python:

from pocket_extraction import extract_ligand_and_pocket

# Option: Customize parameters for your workflow.
extract_ligand_and_pocket(
    pdb_file="input.pdb",      # or pdb_path for automatic extraction
    ligand_path="ligand.pdb",  # or a directory (e.g., "ligands/")
    pocket_path="pocket.pdb",  # or a directory (e.g., "pockets/")
    ligand_names=["ATP", "NAD"],   # omit or adjust as needed
    model_id=0,                # optional filtering
    chain_id="E",              # optional filtering
    multi_mode=True,           # set to True for separate files
    radius=12.0                # adjust the search radius
)

Note: The Python interface uses similar parameters to the CLI. The function adapts based on whether single files or directories are provided, and whether multi_mode is enabled.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Author

Hanker Wu
📧 GitHub: HankerWu
💬 For bug reports or feature requests, please open a GitHub issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pocket_extraction-0.1.3.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocket_extraction-0.1.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file pocket_extraction-0.1.3.tar.gz.

File metadata

  • Download URL: pocket_extraction-0.1.3.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.8

File hashes

Hashes for pocket_extraction-0.1.3.tar.gz
Algorithm Hash digest
SHA256 55823dadbd859b4a4ff492e507f3b8047a01e9597b0e62c85b529db8eeb07d72
MD5 7bda43a43f4c4603327ae73334aab4ff
BLAKE2b-256 c70910187696f44f5833a409e1dcb9bc34412242002649210e53ec5f096bf633

See more details on using hashes here.

File details

Details for the file pocket_extraction-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pocket_extraction-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6243a3c8c437c17e198a84d9deabe5eedd93968810c03f8f89d4a39951c09654
MD5 954c0ce3527edfac095b6dcda793089e
BLAKE2b-256 2e3d837b8ae4d7596763f3f6874264f62250c057e9acbc01abe4a15109a704a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page