Package schrodinger :: Package thirdparty :: Module rdkit_adapter
[hide private]
[frames] | no frames]

Module rdkit_adapter

Conversions between Schrodinger structure objects (mmct) and RDKit mol objects.

There are some structural/philosophic differences between these two formats, stemming from their distinct origins (RDKit being originally used for chemiformatics, and schrodinger/mmct being originally used for molecular modeling.)

Notably: Schrodinger wants all atoms to have positions in space. RDKit allows unspecified position, or multiple conformers.

Schrodinger wants all Hydrogens to be fully specified (position and bonding). My understanding is that RDKit has three types of hydrogens:

   * Implicit - calculated based on valence. These are not shown in SMILES.
   * Explicit - as a property of the associated heavy atom. These are shown in
   SMILES like [cH]
   * Included in connectivity graph - (only these can have coordinates or
   other properties). These are show in SMILES like c([H]).

There are other distinctions, for instance Schrodinger is aware of dative, or zero-order bonds, whereas RDKit is aware of aromatic and conjugated bonds.

Functions [hide private]
rdkit.Mol
to_rdkit(st, implicitH=False, include_properties=True, include_coordinates=True)
Create a RdKit molecule from a Schrodinger structure (aka mmct).
schrodinger.Structure
from_rdkit(mol, include_properties=True, generate_coordinates=False, conformer=None)
Create a Schrodinger structure from an RdKit molecule.
 
_rdkit_parity_from_chirality(schro_st, rdkmol, index_mapping)
Use Schrodinger chirality to assign RDKit parity.
 
_get_parity(unsorted)
Use a basic bubble sort to get the parity of a list.
 
_chirality_from_rdkit_parity(rdkmol, schro_st)
Turn the atom parity (clockwise vs counterclockwise) into an R/S chirality.
 
_copy_props_mmct_to_rdk(mmct_st_or_atom, rdk_mol_or_atom)
Copy the properties from an MMCT st or atom to a RDKit mol or atom.
 
_copy_props_rdk_to_mmct(rdk_mol_or_atom, mmct_st_or_atom)
Copy the properties from a RDKit mol or atom to an MMCT st or atom.
Variables [hide private]
  CT_PROP_FORMAT = re.compile(r'[birs]_[^_ ]+_\w*')
  RDKIT_PROP_FORMAT = re.compile(r'[birs]_rdkit_(\w+)')
  BOND_TYPES_S2R = {<BondType.Double: 3>: rdkit.Chem.rdchem.Bond...
  BOND_TYPES_R2S = {rdkit.Chem.rdchem.BondType.SINGLE: <BondType...
  MMMDL_ATOM_PARITY_PROP = 'i_sd_original_parity'
  __package__ = 'schrodinger.thirdparty'
Function Details [hide private]

to_rdkit(st, implicitH=False, include_properties=True, include_coordinates=True)

 

Create a RdKit molecule from a Schrodinger structure (aka mmct).

Parameters:
  • st (schrodinger.structure.Structure) - The schrodinger structure to be translated to RDKit. The input structure remains unmodified.
  • implicitH (bool) - Should hydrogens be listed implicitly? If False, hydrogens will be included in the connectivity graph, and 3D coordinates and properties of the hydrogens will be translated. Some pattern matching in RDKit requires implicit hydrogens, however.
  • include_properties (bool) - Should atom and structure level properties be copied from the schrodinger structure to the RDKit mol?
  • include_coordinates - Should the coordinates of the structure be copied to a conformer associated with the RDKit mol?
Returns: rdkit.Mol
An rdkit mol representing the same structure as the input st

from_rdkit(mol, include_properties=True, generate_coordinates=False, conformer=None)

 

Create a Schrodinger structure from an RdKit molecule.

If the RDKit molecule does not have a 3d structure, one can be generated using fast3d.

Parameters:
  • mol (rdkit.Mol) - RDKit mol to be converted to Schrodinger space. It will not be modified.
  • include_properties (bool) - Should atom and molecule properties be copied from the RDKit mol?
  • generate_coordinates (bool) - Should 3D coordinates be generated if the RDKit mol does not have associated coordinates? Uses fast3d.
  • conformer (NoneType or int) - If the RDKit mol has more than one associated conformer, choose one to turn into a Schrodinger structure.
Returns: schrodinger.Structure
A schrodinger.Structure representing the same molecule as the input mol
Raises:
  • ValueError - If there is more than one conformer associated with the structure or if a specific conformer is requested and is unavailable.

_chirality_from_rdkit_parity(rdkmol, schro_st)

 

Turn the atom parity (clockwise vs counterclockwise) into an R/S chirality.

Cribbed from ChmMmctAdapter.


Variables Details [hide private]

BOND_TYPES_S2R

Value:
{<BondType.Double: 3>: rdkit.Chem.rdchem.BondType.DOUBLE,
 <BondType.Single: 2>: rdkit.Chem.rdchem.BondType.SINGLE,
 <BondType.Triple: 4>: rdkit.Chem.rdchem.BondType.TRIPLE}

BOND_TYPES_R2S

Value:
{rdkit.Chem.rdchem.BondType.SINGLE: <BondType.Single: 2>,
 rdkit.Chem.rdchem.BondType.DOUBLE: <BondType.Double: 3>,
 rdkit.Chem.rdchem.BondType.TRIPLE: <BondType.Triple: 4>}