schrodinger.thirdparty.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.

exception schrodinger.thirdparty.rdkit_adapter.InconsistentStructureError

Bases: ValueError

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.thirdparty.rdkit_adapter', '__weakref__': <attribute '__weakref__' of 'InconsistentStructureError' objects>, '__doc__': None})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.thirdparty.rdkit_adapter'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception schrodinger.thirdparty.rdkit_adapter.UnsupportedStructureError

Bases: NotImplementedError

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

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.thirdparty.rdkit_adapter', '__doc__': "For structures that can't be translated between RDKit and Schrodinger yet", '__weakref__': <attribute '__weakref__' of 'UnsupportedStructureError' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.thirdparty.rdkit_adapter'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

schrodinger.thirdparty.rdkit_adapter.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:

An rdkit mol representing the same structure as the input st

Return type:

rdkit.Mol

Raises:

InconsistentStructureError – if the input structure has inconsistent or incorrect stereochemical labels.

schrodinger.thirdparty.rdkit_adapter.from_rdkit(mol, include_properties=True, generate_coordinates=False, conformer=None)

Create a Schrodinger structure from an RdKit molecule.

For correct behavoir, 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.
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.thirdparty.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