schrodinger.utils.cgxutils module

exception schrodinger.utils.cgxutils.SerializationError

Bases: Exception

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.cgxutils', '__weakref__': <attribute '__weakref__' of 'SerializationError' 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.utils.cgxutils'
__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.utils.cgxutils.serialize_conformations(conformations)

Converts conformations into numpy.ndarray instance.

Parameters:conformations (Iterable of iterables.) – Iterable over conformations. Each conformation must be an iterable with two elements (energy, coordinates). The “energy” must be convertible to float and “coordinates” must be a numpy.ndarray of shape (natoms, 3). Number of the “coordinates” must be the same for all “conformations”.
Returns:Serialized conformations.
Return type:numpy.ndarray
schrodinger.utils.cgxutils.deserialize_conformations(data)

Does the opposite of serialize_conformations: converts array of floats (buffer) into a list of conformations.

Parameters:data (buffer) – Serialized conformations.
Returns:List of conformations.
Return type:list((float, numpy.ndarray))
class schrodinger.utils.cgxutils.FragmentLibrary(filename)

Bases: object

Encapsulates access to CGX fragment library (SQLite3 file).

__init__(filename)

Opens existing library, or creates new one if filename does not exist.

Parameters:filename (str) – File name.
__enter__()
__exit__(*a)
close()
__contains__(smiles)
__len__()
__delitem__(smiles)
__missing__(smiles)
__getitem__(smiles)

Returns list of conformations. Each conformations is a (float, numpy.ndarray) tuple holding energy and coordinates.

__setitem__(smiles, conformations)
iteritems()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.cgxutils', '__doc__': '\n Encapsulates access to CGX fragment library (SQLite3 file).\n ', '__init__': <function FragmentLibrary.__init__>, '__enter__': <function FragmentLibrary.__enter__>, '__exit__': <function FragmentLibrary.__exit__>, 'close': <function FragmentLibrary.close>, '_lookup': <function FragmentLibrary._lookup>, '_insert': <function FragmentLibrary._insert>, '__contains__': <function FragmentLibrary.__contains__>, '__len__': <function FragmentLibrary.__len__>, '__delitem__': <function FragmentLibrary.__delitem__>, '__missing__': <function FragmentLibrary.__missing__>, '__getitem__': <function FragmentLibrary.__getitem__>, '__setitem__': <function FragmentLibrary.__setitem__>, 'iteritems': <function FragmentLibrary.iteritems>, '__dict__': <attribute '__dict__' of 'FragmentLibrary' objects>, '__weakref__': <attribute '__weakref__' of 'FragmentLibrary' 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_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.utils.cgxutils'
__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).

__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).

__weakref__

list of weak references to the object (if defined)

schrodinger.utils.cgxutils.recompute_stereo(st)
schrodinger.utils.cgxutils.has_undefined_stereo(st, logger)

Extracts and parses mmstereo properties (s_st), return True if there is an undefined (labelled as ‘?’) chirality or cis/trans.

Parameters:st (schrodinger.Structure) – Structure
schrodinger.utils.cgxutils.chop(engine, st, logger=None, i_f3d_origin='i_f3d_origin')

Chops structure into ConfGenX fragments (side effect: modifies atom properties of the input structure).

Parameters:
  • engine (schrodinger.infra.fast3d.Engine) – Fast3D engine.
  • st (schrodinger.Structure) – Structure (may include several molecules).
  • i_f3d_origin (str) – Name of the atom property to keep track of the original atom indices.
Returns:

List of fragments.

Return type:

list(schrodinger.Structure)

schrodinger.utils.cgxutils.is_builtin_fragment(smiles)

Checks whether the smiles is for one of the “built-in” fragments.

schrodinger.utils.cgxutils.uniquesmiler()

Returns unique SMILES generator.

schrodinger.utils.cgxutils.read_structures_as_conformations(source, energy_property, logger=None, engine=None)

Gets structures from file/generator, chops them into fragments. Skips the ones that have more than one fragment. Gathers conformations of the “elementary” (indivisible) fragments into a dictionary keyed by unique SMILES.

Parameters:
  • source (str or generator) – Structure file name or generator of structures.
  • energy_property (str) – Name of the “energy” CT-level property (required).
  • logger (log.Logger) – Logger (can be None).
  • engine (schrodinger.infra.fast3d.Engine) – Fast3D engine (can be None).
schrodinger.utils.cgxutils.default_custom_fraglib()

Path to the custom fragments library that is to be used by default.