LBS Finder

LBS (Ligand Binding Site) Finder locates candidate docking pockets on a protein structure. It runs up to three independent prediction models — Fpocket, P2Rank, and DiffDock — and returns each pocket’s coordinates, score, and surrounding residues. Its main purpose in a scripted pipeline is to fill the gap between PdbReaderProject (structure preparation) and LigandDockerProject (docking): to_docking_boxes() converts a model’s pockets directly into the box list submit_docking() expects.

Step 1 — Reference Structure

Start by creating a project object and choosing the reference structure. Exactly one of a reference project or a local PDB file must be given.

import molcube as mc
from molcube.lbs_finder import PredictionModel

molcube = mc.API("api.molcube.com", 443)
molcube.authenticate(api_token="your-api-token")

lbs = molcube.create_lbs_finder_project()

Reference project — reuse a completed PDB Reader / Boltz-2 / Protenix project:

lbs.list_reference_projects()  # completed PDB Reader projects, by default

assert lbs.create_project(
    title="EGFR pocket scan",
    reference_project_id="12345678-90ab-cdef-1234-567890abcdef",
)

Custom PDB — upload a local structure instead:

assert lbs.create_project(
    title="EGFR pocket scan",
    custom_pdb_path="/path/to/structure.pdb",
)

create_project() options:

  • title (str): Project title, 1-50 characters.

  • reference_project_id (str, optional): An existing, completed reference project. Mutually exclusive with custom_pdb_path.

  • custom_pdb_path (str | Path, optional): A local .pdb file. Mutually exclusive with reference_project_id.

  • workspace (str, optional): "personal" or "team" (default: "personal").

list_reference_projects(reference_type) returns one page of completed projects of the given ReferenceProjectType (PDB_READER by default; BOLTZ and PROTENIX are also accepted, though only PDB Reader and Boltz-2 are exposed as choices in the web app) whose last task succeeded – narrower than the web app’s own list, which also shows projects whose final-step task failed or was cancelled.

The result behaves like a plain list – iteration, indexing, and equality against a list all work as expected – and also carries pagination info as attributes: page, per_page, total_count, total_pages, has_next, has_previous. Pass keyword="EGFR" to filter by title, or page=/per_page= to page through a large result set.

Step 2 — Prediction Models

Select which models to run, then submit. Fpocket and P2Rank need no further input; DiffDock additionally requires a ligand file.

lbs.set_prediction_models([PredictionModel.FPOCKET, PredictionModel.P2RANK])
assert lbs.submit_project()

With DiffDock — attach a ligand before submitting:

lbs.set_prediction_models(
    [PredictionModel.FPOCKET, PredictionModel.P2RANK, PredictionModel.DIFFDOCK]
)
lbs.set_ligand("/path/to/ligand.sdf")
assert lbs.submit_project()

Note: DiffDock always generates 10 poses; this is fixed server-side and cannot be changed from the SDK. Selecting more models does not cost extra tokens — a submission is billed once regardless of how many models are chosen.

Inspect State / Preview Payload

Before submitting, you can inspect the current project state or preview the exact payload that will be sent to the server.

  • get_state() — returns the current local state (Step 1 fields and Step 2 settings) as a dict. Does not contact the server.

  • preview_payload() — returns the Step 2 payload after running the same validation as submit_project(), for inspection.

lbs.get_state()
lbs.preview_payload()

Cancel a running job with stop_project() (mirrors the Cancel button in the web app):

lbs.stop_project()

Step 3 — Results

Once submit_project() returns, read back the pockets each model found. A pocket’s pocket number is only unique within its model — Fpocket’s pocket 1 and P2Rank’s pocket 1 are unrelated candidates — so every method that identifies a single pocket takes (model, pocket) together.

  • list_models() — which selected models produced results.

  • get_pockets(model) — the raw pocket list for one model (fields differ by model; see PredictionModel).

  • get_summary() — every model’s pockets flattened into one comparable table: (model, pocket, score, center).

  • get_pocket_center(model, pocket) — a single pocket’s [x, y, z] center in Å.

  • get_pocket_residues(model, pocket) — residues surrounding a pocket (always empty for DiffDock, whose result is a docking pose rather than a cavity).

  • get_binding_sites(refresh=False) — the full raw response (input PDB text plus every model’s pockets), cached after the first call since it can be several MB. Pass refresh=True to re-fetch, e.g. after resubmitting Step 2.

lbs.list_models()                              # e.g. ["fpocket", "p2rank"]
lbs.get_pockets(PredictionModel.P2RANK)
lbs.get_summary()

lbs.get_pocket_center(PredictionModel.P2RANK, 1)
lbs.get_pocket_residues(PredictionModel.P2RANK, 1)

Connecting to Ligand Docker

to_docking_boxes() converts one model’s pocket centers into the BoxDict list that LigandDockerProject.submit_docking() expects, closing the loop from structure preparation to docking without manually copying coordinates.

to_docking_boxes() options:

  • model (str | PredictionModel): Which model’s pockets to convert.

  • top_n (int, optional): Take only the first N pockets in ranked order. Mutually exclusive with pockets.

  • pockets (list[int], optional): Specific pocket numbers, in the given order. Mutually exclusive with top_n. Defaults to every pocket the model found.

  • box_size (float | tuple[float, float, float], optional): Box edge length in Å, or an (x, y, z) triple (default: 20.0).

  • name_prefix (str, optional): Prepended to each generated box name.

from molcube.ligand_docker import LigandDockerModule

boxes = lbs.to_docking_boxes(PredictionModel.P2RANK, top_n=3, box_size=20.0)

docker = molcube.create_ligand_docker_project()
docker.create_project(
    title="EGFR docking",
    pdbreader_project_id=pdbreader_project_id,
    modules=[LigandDockerModule.VINA],
)
docker.submit_docking(
    boxes=boxes,
    pose=10,
    ligand_tar_filepath="/path/to/ligands.tar.gz",
)

Download Artifacts

  • get_input_pdb() / download_input_pdb(output_path) — the prepared reference structure, as text or saved to disk.

  • download_project(output_path) — the full project archive (.tar.gz).

Note: output_path is optional. If omitted, files are saved to the current directory.

lbs.get_input_pdb()
lbs.download_input_pdb()
lbs.download_project()

3D Viewer

Use show_3d_viewer() to visualize the reference structure and one model’s pockets.

  • Jupyter notebook: renders inline in the output cell.

  • CLI / script: opens the structure in the default web browser.

Every pocket is shown as a labeled, colored sphere at its center. Passing pocket additionally highlights that pocket’s model-specific detail — Fpocket’s alpha-sphere cluster, P2Rank’s surface around its residues, or DiffDock’s docked ligand pose (rendered here even though the web viewer keeps it hidden, since the data is already present in the response).

show_3d_viewer() options:

  • model (str | PredictionModel): Which model’s pockets to show.

  • pocket (int, optional): Pocket number to highlight in detail (default: None — shows every pocket’s marker only).

  • width (int): Viewer width in pixels (default: 800).

  • height (int): Viewer height in pixels (default: 600).

  • show_surface (bool): Draw the protein’s VDW surface (default: True; turn off for large structures).

  • surface_opacity (float): Surface opacity, 0.0-1.0 (default: 0.6).

lbs.show_3d_viewer(PredictionModel.P2RANK)

# Highlight one pocket's detail
lbs.show_3d_viewer(PredictionModel.P2RANK, pocket=1)