openpharmacophore.Ligand

class openpharmacophore.Ligand(mol)[source]

Bases: object

Represents a ligand. Wrapper for rdkit Mol object

Methods

add_conformers

Add conformers to a ligand.

add_hydrogens

Add hydrogens to this ligand.

draw

Draw the ligand.

fix_bond_order

Fix the bond order of a ligand.

from_string

Create a ligand from a smiles, smarts, inchi, pdb block, or mol2 block

generate_conformers

Generate conformers for this ligand.

get_chem_feats

Find chemical features in this ligand.

get_chem_feats_with_directionality

Find chemical features in this ligand.

get_conformer

Get the coordinates of the specified conformer

get_feat_indices

has_aromatic_bonds

Returns true if the ligand has aromatic bonds.

has_double_bonds

Returns true if the ligand has double bonds.

to_rdkit

Returns the ligand as an rdkit molecule.

Attributes

feat_ind

has_conformers

has_hydrogens

Returns true if the ligand has any hydrogen atoms

lig_id

ID of the ligand if it was extracted from a protein.

n_atoms

n_bonds

n_conformers

n_heavy_atoms

add_conformers(coords)[source]

Add conformers to a ligand.

Parameters:

coords (puw.Quantity) – A quantity of shape (n_conformers, n_atoms, 3)

add_hydrogens()[source]

Add hydrogens to this ligand. Modifies the ligand in place.

Can only add hydrogens to a ligand that only has one conformer.

draw()[source]

Draw the ligand.

fix_bond_order(smiles)[source]

Fix the bond order of a ligand. This is necessary when a ligand is extracted from a Protein object.

Parameters:

smiles (str) – Smiles of the ligand

classmethod from_string(string, form)[source]

Create a ligand from a smiles, smarts, inchi, pdb block, or mol2 block

Parameters:
  • string (str) – The string that encodes the ligand

  • form (str) – Can be “smi”, “smarts”, “inchi”, “mol2”, “pdb”.

Return type:

Ligand

generate_conformers(n_confs)[source]

Generate conformers for this ligand. Removes current conformers if any

get_chem_feats(conf_ind, types=None, indices=False)[source]

Find chemical features in this ligand.

Parameters:
  • conf_ind (int) – Index of the conformer.

  • types (set[str], optional) – The chemical features that will be searched for.

  • indices (bool, default=False) – Whether to store the indices of the atoms in the chemical features.

Return type:

ChemFeatContainer

get_chem_feats_with_directionality(conf_ind, types=None)[source]

Find chemical features in this ligand. Hydrogen bond donors obtained with this method will include information about hydrogen atoms, and aromatic ring will contain their normal vector.

Parameters:
  • conf_ind (int) – Index of the conformer.

  • types (set[str], optional) – The chemical features that will be searched for.

Return type:

ChemFeatContainer

get_conformer(conf_ind)[source]

Get the coordinates of the specified conformer

Parameters:

conf_ind (int) – Index of the conformer

Returns:

A quantity of shape (n_atoms, 3)

Return type:

puw.Quantity

has_aromatic_bonds()[source]

Returns true if the ligand has aromatic bonds.

Return type:

bool

has_double_bonds()[source]

Returns true if the ligand has double bonds.

Return type:

bool

property has_hydrogens: bool

Returns true if the ligand has any hydrogen atoms

Return type:

bool

property lig_id: str

ID of the ligand if it was extracted from a protein.

to_rdkit()[source]

Returns the ligand as an rdkit molecule.

Return type:

rdkit.Chem.Mol