schrodinger.rdkit.rdkit_adapter module

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.

schrodinger.rdkit.rdkit_adapter.ANNOTATION_PROP = 'i_rdk_index'

i_rdk_index

exception schrodinger.rdkit.rdkit_adapter.InconsistentStructureError

Bases: ValueError

exception schrodinger.rdkit.rdkit_adapter.UnsupportedStructureError

Bases: NotImplementedError

For structures that can’t be translated between RDKit and Schrodinger yet

schrodinger.rdkit.rdkit_adapter.to_rdkit(st, implicitH=False, include_properties=True, sanitize=True, include_stereo=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?

  • sanitize (bool) – Should the molecule be sanitized? Sanitization discerns aromaticity, for example. But it rejects invalid molecules.

  • include_stereo (bool) – Whether the stereochemistry of the structure should be translated into the RDKit mol.

Returns

An rdkit mol representing the same structure as the input st

Return type

rdkit.Mol

Raises
schrodinger.rdkit.rdkit_adapter.from_rdkit(mol, include_properties=True, generate_coordinates=False, conformer=None, include_stereo=True)

Create a Schrodinger structure from an RdKit molecule.

For correct behavior, requires that the RdKit molecule be sanitized beforehand.

If the RDKit molecule does not have 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. If None, then the first conformer will be used.

Returns

A schrodinger.Structure representing the same molecule as the input mol

Return type

schrodinger.Structure

Raises

ValueError – If there is more than one conformer associated with the structure or if a specific conformer is requested and is unavailable.

schrodinger.rdkit.rdkit_adapter.translate_rdkit_props_dict(props)

Make a copy of a property dict like the one returned by mol.GetPropsAsDict, in which property names that don’t look like mmct properties are prefixed with <typechar>_rdkit_.

Parameters

props (dict) – property dictionary

Returns

new property dictionary

Return type

dict

schrodinger.rdkit.rdkit_adapter.suppress_rdkit_log()

Disable all RDKIT logging.

class schrodinger.rdkit.rdkit_adapter.RdkitLoggerstate(logger: str, enabled: bool)

Bases: object

logger: str
enabled: bool
classmethod fromRdkitStatus(status: str) schrodinger.rdkit.rdkit_adapter.RdkitLoggerstate

Create a RdkitLoggerstate object from a string like “log:state”

__init__(logger: str, enabled: bool) None
schrodinger.rdkit.rdkit_adapter.get_loggerstates() Set[schrodinger.rdkit.rdkit_adapter.RdkitLoggerstate]

Get the current state of all RDKIT loggers

schrodinger.rdkit.rdkit_adapter.set_loggerstates(log_states: Set[schrodinger.rdkit.rdkit_adapter.RdkitLoggerstate])

Set the state of all RDKIT loggers

schrodinger.rdkit.rdkit_adapter.get_all_loggerstates(enabled: bool) Set[schrodinger.rdkit.rdkit_adapter.RdkitLoggerstate]

Return a new set of logger_states where every logger is enabled

schrodinger.rdkit.rdkit_adapter.convert_log_to_exception(prepend_error=True, remove_timestamps=False)
Parameters
  • prepend_error (bool) – If True, prepend “RDKit ERROR:n” to the error message

  • remove_timestamps (bool) – If True, remove all timestamps from any error message

Raise

RuntimeError if RDKit has logged any messages within the context

schrodinger.rdkit.rdkit_adapter.get_map_sdgr_to_rdk(mol)

Get a dict mapping schrodinger atoms index to rdkit atom index

Parameters

mol (rdkit.Mol) – rdkit molecule for which mapping is desired

Return type

dict

Returns

dict with key as schrodinger atom index and rdkit atoms index as value

schrodinger.rdkit.rdkit_adapter.get_map_rdk_to_sdgr(mol)

Get a dict mapping rdkit atoms index to schrodinger atom index

Parameters

mol (rdkit.Mol) – rdkit molecule for which mapping is desired

Return type

dict

Returns

dict with key as rdkit atom index and schrodinger atoms index as value