kinoml.core.ligands
¶
MolecularComponent
objects that represent ligand-like entities.
Module Contents¶
- kinoml.core.ligands.logger¶
- class kinoml.core.ligands.Ligand(molecule: Union[openff.toolkit.topology.Molecule, None] = None, smiles: str = '', name: str = '', metadata: Union[dict, None] = None, **kwargs)¶
Bases:
kinoml.core.components.BaseLigand
Create a new Ligand object. An openff representation is accessible via the molecule attribute.
Examples
Create a ligand from file:
>>> ligand = Ligand.from_file("data/molecules/chloroform.sdf", name="chloroform")
Create a ligand from an openff molecule:
>>> from openff.toolkit.topology import Molecule >>> molecule = Molecule.from_file("data/molecules/chloroform.sdf") >>> ligand = Ligand(molecule=molecule, name="chloroform")
Create a ligand from SMILES:
>>> ligand = Ligand.from_smiles("C(Cl)(Cl)Cl", name="chloroform")
Create a ligand from SMILES with lazy instantiation:
>>> ligand = Ligand(smiles="C(Cl)(Cl)Cl", name="chloroform")
- property molecule¶
Decorate molecule to modify setter and getter.
- molecule()¶
Get the _molecule attribute. If the _smiles attribute is given and _molecule is None, a new openff molecule will be created from smiles, e.g. in case of lazy instantiation.
- Returns
The openff molecular representation of the ligand.
- Return type
openff.toolkit.topology.Molecule or None
- classmethod from_smiles(smiles: str, name: str = '', allow_undefined_stereo: bool = True, **kwargs)¶
Create a Ligand from a SMILES representation.
- Parameters
smiles (str) – smiles: str The SMILES representation of the ligand.
name (str, default="") – The name of the ligand.
allow_undefined_stereo (bool, default=True) – If undefined stereo centers should be allowed.
kwargs – Any keyword arguments allowed for the from_smiles method of the openff molecule class.
- classmethod from_file(file_path: Union[pathlib.Path, str], name: str = '', allow_undefined_stereo: bool = True, **kwargs)¶
Create a Ligand from file.
- Parameters
file_path (pathlib.Path or str) – The path to the molecular file. For supported formats see the openff molecule documentation.
name (str, default="") – The name of the ligand.
allow_undefined_stereo (bool, default=True) – If undefined stereo centers should be allowed.
kwargs – Any keyword arguments allowed for the from_file method of the openff molecule class.