meeko.preparation module#

class meeko.preparation.MoleculePreparation(merge_these_atom_types=('H',), hydrate=False, flexible_amides=False, rigid_macrocycles=False, untyped_macrocycles=False, min_ring_size=7, max_ring_size=33, keep_chorded_rings=False, keep_equivalent_rings=False, double_bond_penalty=50, macrocycle_allow_A=False, rigidify_bonds_smarts=[], rigidify_bonds_indices=[], input_atom_params=None, load_atom_params='ad4_types', add_atom_types=None, input_offatom_params=None, load_offatom_params=None, charge_model='gasteiger', charge_atom_prop=None, dihedral_model=None, reactive_smarts=None, reactive_smarts_idx=None, add_index_map=False, remove_smiles=False)[source]#

Bases: object

A class representing the protocol for preparing a molecule for docking.

deprecated_setup_access#

Deprecated access to the setup object (deprecated since v0.5).

Type:

list

merge_these_atom_types#

A tuple of atom types to merge. For example, (“H”,) will merge all hydrogens.

Type:

tuple

hydrate#

If True, the molecule will be hydrated with water molecules.

Type:

bool

flexible_amides#

If True, amide bonds will be treated as flexible.

Type:

bool

rigid_macrocycles#

If True, macrocycles will be treated as rigid.

Type:

bool

untyped_macrocycles#

If True, macrocycles will not be typed.

Type:

bool

min_ring_size#

The minimum size of a ring to be considered a macrocycle.

Type:

int

max_ring_size#

The maximum size of a ring to be considered a macrocycle.

Type:

int

keep_chorded_rings#

If True, chorded rings will be kept in the molecule.

Type:

bool

keep_equivalent_rings#

If True, equivalent rings will be kept in the molecule.

Type:

bool

double_bond_penalty#

The penalty for double bonds in macrocycles.

Type:

float

macrocycle_allow_A#

If True, macrocycles will be allowed to have atom type A (aromatic carbon).

Type:

bool

rigidify_bonds_smarts#

A list of SMARTS patterns for bonds to be rigidified.

Type:

list

rigidify_bonds_indices#

A list of tuples of indices representing bonds to be rigidified.

Type:

list[tuple[int, int]]

input_atom_params#

A dictionary of input atom parameters.

Type:

dict

load_atom_params#

A string representing the name of the atom parameters to load.

Type:

str

add_atom_types#

A list of additional atom types to add.

Type:

list

charge_model#

The charge model to use. Options are “espaloma”, “gasteiger”, “zero”, or “read”.

Type:

str

charge_atom_prop#

The name of the atom property to use for charges.

Type:

str

dihedral_model#

The dihedral model to use. Options are None, “openff”, or “espaloma”.

Type:

str

reactive_smarts#

A string representing the SMARTS pattern for reactive groups.

Type:

str

reactive_smarts_idx#

An index representing the position of the reactive atom in the SMARTS pattern.

Type:

int

add_index_map#

If True, an index map will be added to the molecule.

Type:

bool

remove_smiles#

If True, the SMILES representation of the molecule will be removed.

Type:

bool

atom_params#

A dictionary of atom parameters.

Type:

dict

offatom_params#

A dictionary of off-atom parameters.

Type:

dict

dihedral_params#

A list of dihedral parameters.

Type:

list

espaloma_model#

An instance of the EspalomaTyper class.

Type:

EspalomaTyper

classmethod from_config(config)[source]#

Create a MoleculePreparation instance from a configuration dictionary.

Parameters:

config (dict) – A dictionary containing the configuration parameters for the MoleculePreparation instance.

Returns:

A new instance of the MoleculePreparation class with the specified configuration.

Return type:

MoleculePreparation

classmethod from_json_file(filename)[source]#

Create a MoleculePreparation instance from a JSON file containing the configuration.

Parameters:

filename (str) – The path to the JSON file containing the configuration parameters.

Returns:

A new instance of the MoleculePreparation class with the specified configuration.

Return type:

MoleculePreparation

calc_flex(setup, root_atom_index=None, not_terminal_atoms=None, delete_ring_bonds=None, glue_pseudo_atoms=None)[source]#

Calculate the flexibility model for the molecule setup.

Parameters:
  • setup (RDKitMoleculeSetup) – The molecule setup for which to calculate the flexibility model.

  • root_atom_index (int, optional) – The index of the root atom in the molecule setup. If None, the root atom will be determined automatically.

  • not_terminal_atoms (list, optional) – A list of atom indices that should be treated as non-terminal atoms.

  • delete_ring_bonds (list[tuple[int, int]], optional) – Bonds deleted for macrocycle flexibility. Each bond is a tuple of two ints (atom 0-indices).

  • glue_pseudo_atoms (dict, optional) – A dictionary for pseudo atoms mapping atom indices to their corresponding coordinates.

Return type:

None

static get_atom_params(input_atom_params, load_atom_params, add_atom_types, packaged_params)[source]#

Load and combine atom parameters from various sources.

Parameters:
  • input_atom_params (dict) – A dictionary of input atom parameters.

  • load_atom_params (str) – A string representing the name of the atom parameters to load.

  • add_atom_types (list) – A list of additional atom types to add.

  • packaged_params (dict) – A dictionary of packaged parameters. Keys are parameter group names and values are file paths to the corresponding JSON files.

Raises:
  • ValueError – If there are overlapping parameter groups or if the name of the parameter group is not recognized.

  • RuntimeError – If there are multiple groups of parameters when using add_atom_types.

Returns:

atom_params – A dictionary of combined atom parameters.

Return type:

dict

property setup#

Deprecated access to the setup object.

Returns:

The setup object in the deprecated_setup_access list.

Return type:

RDKitMoleculeSetup

Raises:

RuntimeError – If there are multiple setups in the deprecated_setup_access list.

classmethod get_defaults_dict()[source]#

Get the default values for all parameters in the class.

Returns:

A dictionary containing the default values for all parameters in the class.

Return type:

dict

prepare(mol, root_atom_index=None, not_terminal_atoms=None, delete_ring_bonds=None, glue_pseudo_atoms=None, conformer_id=-1, rename_atoms=False)[source]#

Create an RDKitMoleculeSetup from an RDKit Mol object.

Parameters:
  • mol (Chem.Mol) – An RDKit Mol with explicit hydrogens and 3D coordinates.

  • root_atom_index (int, optional) – Used to set ROOT of torsion tree instead of searching. Default is None, which means the root atom will be determined automatically.

  • not_terminal_atoms (list, optional) – A list of atom indices that should be treated as non-terminal atoms.).

  • delete_ring_bonds (list[tuple[int, int]], optional) – Bonds deleted for macrocycle flexibility. Each bond is a tuple of two ints (atom 0-indices).

  • glue_pseudo_atoms (dict, optional) – Mapping from parent atom indices to coordinates.

  • conformer_id (int) – Conformer ID to use for the molecule. Default is -1, which means the current conformer will be used.

  • rename_atoms (bool) – If True, atoms will be renamed to include their index. Default is False, which means atoms will not be renamed.

Returns:

setups – Returns a list of generated RDKitMoleculeSetups

Return type:

list[RDKitMoleculeSetup]

static check_external_ring_break(molsetup, break_ring_bonds, glue_pseudo_atoms)[source]#

Check that the external ring break bonds are in the molecule setup and that the glue pseudo atoms are present and have the correct number of coordinates.

Parameters:
  • molsetup (RDKitMoleculeSetup) – The molecule setup to check.

  • break_ring_bonds (list[tuple[int, int]]) – A list of tuples representing the bonds to break.

  • glue_pseudo_atoms (dict) – A dictionary mapping atom indices to their corresponding coordinates.

Return type:

None

Raises:

ValueError: – If bonds are missing from the MoleculeSetup, if glue_pseudo_atoms is missing certain atom indices, and if there is an incorrect number of coordinates in glue_pseudo_atoms.

write_pdbqt_string()[source]#

Writes a PDBQT string. Deprecated in Meeko v0.5.

Returns:

The PDBQT string representation of the molecule setup.

Return type:

str

Raises:

RuntimeError – If there is an error generating the PDBQT string.

write_pdbqt_file(pdbqt_filename)[source]#

Writes out a pdbqt file. Deprecated in Meeko v0.5

Parameters:

pdbqt_filename (str) – PDBQT filename to write to

Return type:

None