Ligand Modeler

molcube.ligand_modeler.LigandModelerProject

class LigandModelerProject(client, update_format='tqdm')

Bases: BaseProject

A class for creating and manipulating ligand reader & modeler projects.

Parameters:
  • client (APIClient)

  • update_format ('iter' | 'tqdm')

change_dihedral(file_name, atom_index_1, atom_index_2, angle, visual_protein=False)

Rotate ligand dihedral around a selected atom-atom axis.

Parameters:
  • file_name (str) – Target ligand file name.

  • atom_index_1 (int) – First atom index of rotation axis.

  • atom_index_2 (int) – Second atom index of rotation axis.

  • angle (int) – Rotation angle (0-360).

  • visual_protein (bool, optional) – Whether to overlay reference protein. Defaults to False.

Returns:

Modified ligand payload for gen_ligand_ff.

Return type:

dict

Example

modified_ligand = lrmbuilder.change_dihedral(‘1a.sdf’, 30, 8, 180)

check_atom_index(file_name, visual_protein=False)

Visualize atom indices of a ligand structure for dihedral editing.

Parameters:
  • file_name (str) – Target ligand file name in self.files_data.

  • visual_protein (bool, optional) – Whether to overlay reference protein. Defaults to False.

Returns:

None

create_project(title, ff, sdf_paths, pdbreader_project_id=None, native_ligand=None, complete_ring_match=False, stric_match=True, handle_chirality=True)

Create a new ligand modeler project.

Parameters:
  • title (str) – The title of the new project.

  • ff (str) – Project force field type.

  • sdf_paths (list) – List of SDF file paths to be uploaded.

  • pdbreader_project_id (str, optional) – The ID of the associated PDBreader project. Defaults to None.

  • native_ligand (str, optional) – Native ligand name in the PDB Reader project. Defaults to None.

  • complete_ring_match (bool, optional) – Ring matching option for alignment. Defaults to False.

  • stric_match (bool, optional) – Strict coordinate matching option. Defaults to True.

  • handle_chirality (bool, optional) – Whether to preserve chirality during matching. Defaults to True.

Returns:

True if project creation was successful, False otherwise.

Return type:

bool

download_project(filename='lrm.tar.gz')

Download the entire project as a compressed file.

Parameters:

filename (str) – Name of the file to save the project as. Defaults to ‘lrm.tar.gz’.

Returns:

None

gen_ligand_ff(ligand_ff, modified_ligands=None)

Generate ligand force-field data for selected ligands.

Parameters:
  • ligand_ff (list[LigandForceField]) – Ligand FF options to generate.

  • modified_ligands (list) – Optional modified ligand payloads.

Returns:

True if generation task succeeded, False otherwise.

Return type:

bool

Example

lrmbuilder.gen_ligand_ff([LigandForceField.OPENFF_FAST])

get_native_ligands(pdbreader_project_id)

Retrieve native ligand information from a PDB Reader project.

Parameters:

pdbreader_project_id (str) – PDB Reader project ID.

Returns:

Native ligand metadata list.

Return type:

list[dict]

get_results()

Retrieve and print ligand FF generation results.

The results are grouped by ligand force field type and include the status of each ligand’s FF generation, along with any error messages if applicable.

Returns:

A dictionary containing the FF generation results for each ligand, structured as: {

”ligand_ff_type”: {
“ligand_name”: {

“status”: “Success” or “Failed”, “message”: “Error message if failed”

Return type:

results (dict)

base_url = 'builder/m/ligand-modeler'
files_data: list[dict]

Schema

molcube.ligand_modeler.enum

class LigandForceField(*values)

Bases: StrEnum

GAFF = 'gaff'
GAFF_FAST = 'gaffFast'
OPENFF = 'openff'
OPENFF_FAST = 'openffFast'
XFF = 'xff'
XFF_FAST = 'xffFast'