schrodinger.application.glide.glide module¶
Classes for creating Grid Generation and Ligand Docking DICE (Impact) input files from user-friendly keyword/value pairs.
The classes use the mm.mmim* wrappers to convert the keywords and values into the actual DICE input files.
Job parameters are specified by passing a dictionary of keyword/value pairs to the class initialization method. In addition, some parameters, such as constraints, can be specified by calling class methods.
Calling the writeSimplified() method will create the input file that can be passed to $SCHRODINGER/glide. The value of the JOBNAME keyword will be used as the base name for the input file.
For a full list of keywords accepted by the Gridgen and Dock classes, respectively, see the output of
$SCHRODINGER/glide -gridgen-keywords $SCHRODINGER/glide -docking-keywords
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.glide.glide.
Constraint
(label, constype)¶ Bases:
object
Class defining a docking constraint in the receptor.
-
__init__
(label, constype)¶ Initialize self. See help(type(self)) for accurate signature.
-
__str__
()¶ Print the label for the constraint.
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': ' Class defining a docking constraint in the receptor. ', '__init__': <function Constraint.__init__>, '__str__': <function Constraint.__str__>, 'type': <function Constraint.type>, '__dict__': <attribute '__dict__' of 'Constraint' objects>, '__weakref__': <attribute '__weakref__' of 'Constraint' 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.application.glide.glide'¶
-
__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
-
__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)
-
-
class
schrodinger.application.glide.glide.
DonorConstraint
(label, atoms=None)¶ Bases:
schrodinger.application.glide.glide.Constraint
H-Bond constraint that was specified as a receptor donor atom. A ligand must have an ACCEPTOR group that is making an interaction with this atom to satisfy this constraint.
-
__init__
(label, atoms=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
atoms
()¶
-
atom
()¶
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n H-Bond constraint that was specified as a *receptor* donor atom.\n A ligand must have an ACCEPTOR group that is making an interaction with\n this atom to satisfy this constraint.\n ', '__init__': <function DonorConstraint.__init__>, 'atoms': <function DonorConstraint.atoms>, 'atom': <function DonorConstraint.atom>})¶
-
__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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
AcceptorConstraint
(label, atoms=None)¶ Bases:
schrodinger.application.glide.glide.Constraint
H-Bond constraint that was specified as a receptor acceptor atom. A ligand must have a DONOR group that is making an interaction with this atom to satisfy this constraint.
-
__init__
(label, atoms=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
atoms
()¶
-
atom
()¶
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n H-Bond constraint that was specified as a *receptor* acceptor atom.\n A ligand must have a DONOR group that is making an interaction with\n this atom to satisfy this constraint.\n ', '__init__': <function AcceptorConstraint.__init__>, 'atoms': <function AcceptorConstraint.atoms>, 'atom': <function AcceptorConstraint.atom>})¶
-
__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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
MetalConstraint
(label, atoms=None)¶ Bases:
schrodinger.application.glide.glide.Constraint
This constraint was specified as a metal receptor atom. A ligand must interact with this metal atom to satisfy this constraint.
-
__init__
(label, atoms=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
atoms
()¶
-
atom
()¶
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n This constraint was specified as a metal receptor atom. A ligand must\n interact with this metal atom to satisfy this constraint.\n ', '__init__': <function MetalConstraint.__init__>, 'atoms': <function MetalConstraint.atoms>, 'atom': <function MetalConstraint.atom>})¶
-
__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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
PositionalConstraint
(label, x=None, y=None, z=None, radius=None)¶ Bases:
schrodinger.application.glide.glide.Constraint
-
__init__
(label, x=None, y=None, z=None, radius=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__init__': <function PositionalConstraint.__init__>, '__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_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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
NOEConstraint
(label, x=None, y=None, z=None, rmin=None, rmax=None)¶ Bases:
schrodinger.application.glide.glide.Constraint
-
__init__
(label, x=None, y=None, z=None, rmin=None, rmax=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__init__': <function NOEConstraint.__init__>, '__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_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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
MetCoordConstraint
(label, xmetc, ymetc, zmetc, rmetc)¶ Bases:
schrodinger.application.glide.glide.Constraint
-
__init__
(label, xmetc, ymetc, zmetc, rmetc)¶ Initialize self. See help(type(self)) for accurate signature.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__init__': <function MetCoordConstraint.__init__>, '__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_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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
HydrophobicConstraint
(label)¶ Bases:
schrodinger.application.glide.glide.Constraint
-
__init__
(label)¶ Initialize self. See help(type(self)) for accurate signature.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__init__': <function HydrophobicConstraint.__init__>, '__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_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.application.glide.glide'¶
-
__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__
()¶ Print the label for the constraint.
-
__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)
-
type
()¶ Return the type of the (receptor) constraint as a user-friendly string. Possible return values:
- ‘Hydrophobic’
- ‘H-bond donor’
- ‘H-bond acceptor’
- ‘Metal’
- ‘Positional’
- ‘NOE’
- ‘Metal coordination’
-
-
class
schrodinger.application.glide.glide.
FeaturePattern
(smarts, atoms, exclude=False, nfill=None)¶ Bases:
object
Class defining a constraint feature pattern.
-
__init__
(smarts, atoms, exclude=False, nfill=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': ' Class defining a constraint feature pattern. ', '__init__': <function FeaturePattern.__init__>, '__dict__': <attribute '__dict__' of 'FeaturePattern' objects>, '__weakref__': <attribute '__weakref__' of 'FeaturePattern' 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.application.glide.glide'¶
-
__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)
-
-
class
schrodinger.application.glide.glide.
Feature
(patterns=None)¶ Bases:
object
A list of FeaturePattern objects. Each pattern has these properties:
smarts, atoms, exclude.-
__init__
(patterns=None)¶ Parameters: patterns (list) – List of patterns associated with this feature. A shallow copy of the patterns list will be made for the new Feature object.
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n A list of FeaturePattern objects.\n Each pattern has these properties:\n smarts, atoms, exclude.\n ', '__init__': <function Feature.__init__>, '__dict__': <attribute '__dict__' of 'Feature' objects>, '__weakref__': <attribute '__weakref__' of 'Feature' 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.application.glide.glide'¶
-
__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)
-
-
class
schrodinger.application.glide.glide.
ConstraintGroup
(parent, constraints=None, nrequired=-1)¶ Bases:
object
Class defining a constraint group.
-
__init__
(parent, constraints=None, nrequired=-1)¶ Initialize self. See help(type(self)) for accurate signature.
-
addConstraint
(label)¶
-
setup
(cons_labels, feature_sets)¶
-
cleanup
()¶ Free the memory associated with this group
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': ' Class defining a constraint group. ', '__init__': <function ConstraintGroup.__init__>, 'addConstraint': <function ConstraintGroup.addConstraint>, 'setup': <function ConstraintGroup.setup>, 'cleanup': <function ConstraintGroup.cleanup>, '__dict__': <attribute '__dict__' of 'ConstraintGroup' objects>, '__weakref__': <attribute '__weakref__' of 'ConstraintGroup' 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.application.glide.glide'¶
-
__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)
-
-
class
schrodinger.application.glide.glide.
GlideJob
(jobtype=None, specs=None, keywords=None, createhandle=False)¶ Bases:
schrodinger.application.inputconfig.InputConfig
Class for writing Glide input files - either Gridgen or Docking. The keywords passed are used to set MMIM directly with no processing.
-
__init__
(jobtype=None, specs=None, keywords=None, createhandle=False)¶ Specify a dictionary of keywords, where the key is the short keyword name and the value is what is should be set to. For indexed keywords, the value needs to be a list. It is also possible to specify a file path to a simplified input file that contains the keywords.
-
validateValues
(*args, **kwargs)¶ Validate the keywords against the spec. Unlike the parent implementation, raise a ValueError if any unknown keywords are present.
-
get
(key, default=None)¶ A version of
get
that doesn’t bypass string interpolation.
-
getAllowedRange
(key)¶ Will return a tuple of (min, max) for the allowed range of value. Either or both of these values may be None.
Returns: The allowed min/max range. Return type: Tuple of 2 ints/floats.
-
cleanup
()¶ Clean up constraints objects.
-
writeSimplified
(filename=None, yesno=False)¶ Writes a simplified input file to “<jobname>.inp”. This input file needs to be run via $SCHRODINGER/glide.
-
applyContextDependentDefaults
()¶ Apply context-dependent defaults for a Glide job. It modifies the job object, but marks the modified keywords as “default” so they won’t be written by writeSimplified().
-
checkConflicts
()¶ Check for invalid keyword combinations. Raises a ValueError if any are found.
-
setupJson
(jsdict)¶ Additional setup to do before writing a JSON file. Base implementation does nothing. This method is expected not to modify ‘self’, but only jsdict, which is the dictionary of keywords that ultimately will be written to the JSON file.
-
checkForceFieldLicense
(jsdict)¶ If we are using the default forcefield (OPLS3) and don’t have an OPLS license, fall back to using OPLS_2005.
-
writeJSON
()¶ Write the keywords as a JSON representation. Unlike writeSimplified, this includes the values for all the keywords, not only the non-default ones.
-
__class__
¶ alias of
builtins.type
-
__contains__
()¶ True if D has a key k, else False.
-
__delattr__
¶ Implement delattr(self, name).
-
__delitem__
(key)¶ Remove items from the sequence when deleting.
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n Class for writing Glide input files - either Gridgen or Docking. The\n keywords passed are used to set MMIM directly with no processing.\n ', '__init__': <function GlideJob.__init__>, '_mungeBeforeValidation': <function GlideJob._mungeBeforeValidation>, 'validateValues': <function GlideJob.validateValues>, '_applyKeyword': <function GlideJob._applyKeyword>, '_getAndApplyKeyword': <function GlideJob._getAndApplyKeyword>, 'get': <function GlideJob.get>, 'getAllowedRange': <function GlideJob.getAllowedRange>, 'cleanup': <function GlideJob.cleanup>, 'writeSimplified': <function GlideJob.writeSimplified>, 'applyContextDependentDefaults': <function GlideJob.applyContextDependentDefaults>, 'checkConflicts': <function GlideJob.checkConflicts>, 'setupJson': <function GlideJob.setupJson>, 'checkForceFieldLicense': <function GlideJob.checkForceFieldLicense>, 'writeJSON': <function GlideJob.writeJSON>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(key)¶ Fetch the item and do string interpolation.
-
__gt__
¶ Return self>value.
-
__hash__
= None¶
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ D.iterkeys() -> an iterator over the keys of D
-
__le__
¶ Return self<=value.
-
__len__
¶ Return len(self).
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.glide.glide'¶
-
__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__
()¶ x.__str__() <==> str(x)
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setitem__
(key, value, unrepr=False)¶ Correctly set a value.
Making dictionary values Section instances. (We have to special case ‘Section’ instances - which are also dicts)
Keys must be strings. Values need only be strings (or lists of strings) if
main.stringify
is set.unrepr
must be set when setting a value to a dictionary, without creating a new sub-section.
-
__setstate__
(state)¶
-
__sizeof__
() → size of D in memory, in bytes¶
-
__str__
() <==> str(x)¶
-
__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)
-
as_bool
(key)¶ Accepts a key as input. The corresponding value must be a string or the objects (
True
or 1) or (False
or 0). We allow 0 and 1 to retain compatibility with Python 2.2.If the string is one of
True
,On
,Yes
, or1
it returnsTrue
.If the string is one of
False
,Off
,No
, or0
it returnsFalse
.as_bool
is not case sensitive.Any other input will raise a
ValueError
.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_bool('a') Traceback (most recent call last): ValueError: Value "fish" is neither True nor False >>> a['b'] = 'True' >>> a.as_bool('b') 1 >>> a['b'] = 'off' >>> a.as_bool('b') 0
-
as_float
(key)¶ A convenience method which coerces the specified value to a float.
If the value is an invalid literal for
float
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') 3.2...
-
as_int
(key)¶ A convenience method which coerces the specified value to an integer.
If the value is an invalid literal for
int
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_int('a') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: 'fish' >>> a['b'] = '1' >>> a.as_int('b') 1 >>> a['b'] = '3.2' >>> a.as_int('b') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: '3.2'
-
as_list
(key)¶ A convenience method which fetches the specified value, guaranteeing that it is a list.
>>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1]
-
clear
()¶ A version of clear that also affects scalars/sections Also clears comments and configspec.
- Leaves other attributes alone :
- depth/main/parent are not affected
-
copy
() → a shallow copy of D¶
-
dict
()¶ Return a deepcopy of self as a dictionary.
All members that are
Section
instances are recursively turned to ordinary dictionaries - by calling theirdict
method.>>> n = a.dict() >>> n == a 1 >>> n is a 0
-
fromkeys
()¶ Returns a new dict with keys from iterable and values equal to value.
-
getSpecsString
()¶ Return a string of specifications. One keywords per line. Raises ValueError if this class has no specifications.
-
items
() → list of D's (key, value) pairs, as 2-tuples¶
-
iteritems
() → an iterator over the (key, value) items of D¶
-
iterkeys
() → an iterator over the keys of D¶
-
itervalues
() → an iterator over the values of D¶
-
keys
() → list of D's keys¶
-
merge
(indict)¶ A recursive update - useful for merging config files.
>>> a = '''[section1] ... option1 = True ... [[subsection]] ... more_options = False ... # end of file'''.splitlines() >>> b = '''# File is user.ini ... [section1] ... option1 = False ... # end of file'''.splitlines() >>> c1 = ConfigObj(b) >>> c2 = ConfigObj(a) >>> c2.merge(c1) >>> c2 ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})
-
pop
(key, default=<object object>)¶ ‘D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised’
-
popitem
()¶ Pops the first (key,val)
-
printout
()¶ Print all keywords of this instance to stdout.
This method is meant for debugging purposes.
-
reload
()¶ Reload a ConfigObj from file.
This method raises a
ReloadError
if the ConfigObj doesn’t have a filename attribute pointing to a file.
-
rename
(oldkey, newkey)¶ Change a keyname to another, without changing position in sequence.
Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode)
Also renames comments.
-
reset
()¶ Clear ConfigObj instance and restore to ‘freshly created’ state.
-
restore_default
(key)¶ Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
If there is no default value for this key,
KeyError
is raised.
-
restore_defaults
()¶ Recursively restore default values to all members that have them.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
It doesn’t delete or modify entries without default values.
-
setdefault
(key, default=None)¶ A version of setdefault that sets sequence if appropriate.
-
update
(indict)¶ A version of update that uses our
__setitem__
.
-
validate
(validator, preserve_errors=False, copy=False, section=None)¶ Test the ConfigObj against a configspec.
It uses the
validator
object from validate.py.To run
validate
on the current ConfigObj, call:test = config.validate(validator)
(Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the
configspec
attribute of a section though).It returns
True
if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the valueTrue
. (It also returnsFalse
if all members fail).In addition, it converts the values from strings to their native types if their checks pass (and
stringify
is set).If
preserve_errors
isTrue
(False
is default) then instead of a marking a fail with aFalse
, it will preserve the actual exception object. This can contain info about the reason for failure. For example theVdtValueTooSmallError
indicates that the value supplied was too small. If a value (or section) is missing it will still be marked asFalse
.You must have the validate module to use
preserve_errors=True
.You can then use the
flatten_errors
function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages.
-
values
() → list of D's values¶
-
walk
(function, raise_errors=True, call_on_sections=False, **keywargs)¶ Walk every member and call a function on the keyword and value.
Return a dictionary of the return values
If the function raises an exception, raise the errror unless
raise_errors=False
, in which case set the return value toFalse
.Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in.
Note: if
call_on_sections
isTrue
then - on encountering a subsection, first the function is called for the whole subsection, and then recurses into it’s members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded.See the encode and decode methods for examples, including functions.
caution
You can use
walk
to transform the names of members of a section but you mustn’t add or delete members.>>> config = '''[XXXXsection] ... XXXXkey = XXXXvalue'''.splitlines() >>> cfg = ConfigObj(config) >>> cfg ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) >>> def transform(section, key): ... val = section[key] ... newkey = key.replace('XXXX', 'CLIENT1') ... section.rename(key, newkey) ... if isinstance(val, (tuple, list, dict)): ... pass ... else: ... val = val.replace('XXXX', 'CLIENT1') ... section[newkey] = val >>> cfg.walk(transform, call_on_sections=True) {'CLIENT1section': {'CLIENT1key': None}} >>> cfg ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})
-
write
(outfile=None, section=None)¶ Write the current ConfigObj as a file
tekNico: FIXME: use StringIO instead of real files
>>> filename = a.filename >>> a.filename = 'test.ini' >>> a.write() >>> a.filename = filename >>> a == ConfigObj('test.ini', raise_errors=True) 1 >>> import os >>> os.remove('test.ini')
-
writeInputFile
(filename, ignore_none=False, yesno=False, smartsort=False)¶ Write the configuration to a file in the InputConfig format.
Parameters: - filename (a file path or an open file handle) – The file to write the configuration to.
- ignore_none (bool) – If True, keywords with a value of None will not be written to the input file.
- yesno (bool) – If True, boolean keywords will be written as “yes” and “no”, if False, as “True” and “False”.
- smartsort (bool) – If True, keywords that are identical except for the numbers at the end will be sorted such that “2” will go before “10”.
-
-
class
schrodinger.application.glide.glide.
Gridgen
(keywords)¶ Bases:
schrodinger.application.glide.glide.GlideJob
Class for writing Glide Grid Generation input files. Currently, the receptor input file for a Gridgen job (NOT created by this class) must be named “<jobname>.mae”.
-
__init__
(keywords)¶ Specify a dictionary of keywords, where the key is the short keyword name and the value is what is should be set to. For indexed keywords, the value needs to be a list. It is also possible to specify a file path to a simplified input file that contains the keywords.
- Constraint sites may be set via the following keywords:
- HBOND_CONSTRAINTS METAL_CONSTRAINTS POSIT_CONSTRAINTS NOE_CONSTRAINTS METCOORD_CONSTRAINTS METCOORD_SITES
Parameters: keywords (dict or file path) – Either a dictionary of keywords or a simplified input file path. Raises: RuntimeError – If no job name specified.
-
setupJson
(jsdict)¶ Additional setup to do before writing a JSON file. Base implementation does nothing. This method is expected not to modify ‘self’, but only jsdict, which is the dictionary of keywords that ultimately will be written to the JSON file.
-
cleanup
()¶ Free the memory associated with constraings
-
__class__
¶ alias of
builtins.type
-
__contains__
()¶ True if D has a key k, else False.
-
__delattr__
¶ Implement delattr(self, name).
-
__delitem__
(key)¶ Remove items from the sequence when deleting.
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n Class for writing Glide Grid Generation input files. Currently, the\n receptor input file for a Gridgen job (NOT created by this class) must be\n named "<jobname>.mae".\n ', '__init__': <function Gridgen.__init__>, '_defaultsTable': <function Gridgen._defaultsTable>, '_conflictsTable': <function Gridgen._conflictsTable>, '_gridfile': <function Gridgen._gridfile>, '_recep_file': <function Gridgen._recep_file>, '_grid_center_from_asl': <function Gridgen._grid_center_from_asl>, '_grid_center': <function Gridgen._grid_center>, '_inner_box': <function Gridgen._inner_box>, '_outer_box': <function Gridgen._outer_box>, 'setupJson': <function Gridgen.setupJson>, '_useSimplifiedConstraints': <function Gridgen._useSimplifiedConstraints>, '_setupPositConstraints': <function Gridgen._setupPositConstraints>, '_setupNoeConstraints': <function Gridgen._setupNoeConstraints>, '_setupMetcoordConstraints': <function Gridgen._setupMetcoordConstraints>, '_setupReceptorAtomBasedConstraints': <function Gridgen._setupReceptorAtomBasedConstraints>, '_jsonSetupConstraints': <function Gridgen._jsonSetupConstraints>, '_receptorStructure': <function Gridgen._receptorStructure>, '_ligandStructure': <function Gridgen._ligandStructure>, '_parseConsString': <function Gridgen._parseConsString>, '_setupHbondConstraints': <function Gridgen._setupHbondConstraints>, '_setupConstraints': <function Gridgen._setupConstraints>, 'cleanup': <function Gridgen.cleanup>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(key)¶ Fetch the item and do string interpolation.
-
__gt__
¶ Return self>value.
-
__hash__
= None¶
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ D.iterkeys() -> an iterator over the keys of D
-
__le__
¶ Return self<=value.
-
__len__
¶ Return len(self).
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.glide.glide'¶
-
__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__
()¶ x.__str__() <==> str(x)
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setitem__
(key, value, unrepr=False)¶ Correctly set a value.
Making dictionary values Section instances. (We have to special case ‘Section’ instances - which are also dicts)
Keys must be strings. Values need only be strings (or lists of strings) if
main.stringify
is set.unrepr
must be set when setting a value to a dictionary, without creating a new sub-section.
-
__setstate__
(state)¶
-
__sizeof__
() → size of D in memory, in bytes¶
-
__str__
() <==> str(x)¶
-
__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)
-
applyContextDependentDefaults
()¶ Apply context-dependent defaults for a Glide job. It modifies the job object, but marks the modified keywords as “default” so they won’t be written by writeSimplified().
-
as_bool
(key)¶ Accepts a key as input. The corresponding value must be a string or the objects (
True
or 1) or (False
or 0). We allow 0 and 1 to retain compatibility with Python 2.2.If the string is one of
True
,On
,Yes
, or1
it returnsTrue
.If the string is one of
False
,Off
,No
, or0
it returnsFalse
.as_bool
is not case sensitive.Any other input will raise a
ValueError
.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_bool('a') Traceback (most recent call last): ValueError: Value "fish" is neither True nor False >>> a['b'] = 'True' >>> a.as_bool('b') 1 >>> a['b'] = 'off' >>> a.as_bool('b') 0
-
as_float
(key)¶ A convenience method which coerces the specified value to a float.
If the value is an invalid literal for
float
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') 3.2...
-
as_int
(key)¶ A convenience method which coerces the specified value to an integer.
If the value is an invalid literal for
int
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_int('a') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: 'fish' >>> a['b'] = '1' >>> a.as_int('b') 1 >>> a['b'] = '3.2' >>> a.as_int('b') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: '3.2'
-
as_list
(key)¶ A convenience method which fetches the specified value, guaranteeing that it is a list.
>>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1]
-
checkConflicts
()¶ Check for invalid keyword combinations. Raises a ValueError if any are found.
-
checkForceFieldLicense
(jsdict)¶ If we are using the default forcefield (OPLS3) and don’t have an OPLS license, fall back to using OPLS_2005.
-
clear
()¶ A version of clear that also affects scalars/sections Also clears comments and configspec.
- Leaves other attributes alone :
- depth/main/parent are not affected
-
copy
() → a shallow copy of D¶
-
dict
()¶ Return a deepcopy of self as a dictionary.
All members that are
Section
instances are recursively turned to ordinary dictionaries - by calling theirdict
method.>>> n = a.dict() >>> n == a 1 >>> n is a 0
-
fromkeys
()¶ Returns a new dict with keys from iterable and values equal to value.
-
get
(key, default=None)¶ A version of
get
that doesn’t bypass string interpolation.
-
getAllowedRange
(key)¶ Will return a tuple of (min, max) for the allowed range of value. Either or both of these values may be None.
Returns: The allowed min/max range. Return type: Tuple of 2 ints/floats.
-
getSpecsString
()¶ Return a string of specifications. One keywords per line. Raises ValueError if this class has no specifications.
-
items
() → list of D's (key, value) pairs, as 2-tuples¶
-
iteritems
() → an iterator over the (key, value) items of D¶
-
iterkeys
() → an iterator over the keys of D¶
-
itervalues
() → an iterator over the values of D¶
-
keys
() → list of D's keys¶
-
merge
(indict)¶ A recursive update - useful for merging config files.
>>> a = '''[section1] ... option1 = True ... [[subsection]] ... more_options = False ... # end of file'''.splitlines() >>> b = '''# File is user.ini ... [section1] ... option1 = False ... # end of file'''.splitlines() >>> c1 = ConfigObj(b) >>> c2 = ConfigObj(a) >>> c2.merge(c1) >>> c2 ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})
-
pop
(key, default=<object object>)¶ ‘D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised’
-
popitem
()¶ Pops the first (key,val)
-
printout
()¶ Print all keywords of this instance to stdout.
This method is meant for debugging purposes.
-
reload
()¶ Reload a ConfigObj from file.
This method raises a
ReloadError
if the ConfigObj doesn’t have a filename attribute pointing to a file.
-
rename
(oldkey, newkey)¶ Change a keyname to another, without changing position in sequence.
Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode)
Also renames comments.
-
reset
()¶ Clear ConfigObj instance and restore to ‘freshly created’ state.
-
restore_default
(key)¶ Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
If there is no default value for this key,
KeyError
is raised.
-
restore_defaults
()¶ Recursively restore default values to all members that have them.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
It doesn’t delete or modify entries without default values.
-
setdefault
(key, default=None)¶ A version of setdefault that sets sequence if appropriate.
-
update
(indict)¶ A version of update that uses our
__setitem__
.
-
validate
(validator, preserve_errors=False, copy=False, section=None)¶ Test the ConfigObj against a configspec.
It uses the
validator
object from validate.py.To run
validate
on the current ConfigObj, call:test = config.validate(validator)
(Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the
configspec
attribute of a section though).It returns
True
if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the valueTrue
. (It also returnsFalse
if all members fail).In addition, it converts the values from strings to their native types if their checks pass (and
stringify
is set).If
preserve_errors
isTrue
(False
is default) then instead of a marking a fail with aFalse
, it will preserve the actual exception object. This can contain info about the reason for failure. For example theVdtValueTooSmallError
indicates that the value supplied was too small. If a value (or section) is missing it will still be marked asFalse
.You must have the validate module to use
preserve_errors=True
.You can then use the
flatten_errors
function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages.
-
validateValues
(*args, **kwargs)¶ Validate the keywords against the spec. Unlike the parent implementation, raise a ValueError if any unknown keywords are present.
-
values
() → list of D's values¶
-
walk
(function, raise_errors=True, call_on_sections=False, **keywargs)¶ Walk every member and call a function on the keyword and value.
Return a dictionary of the return values
If the function raises an exception, raise the errror unless
raise_errors=False
, in which case set the return value toFalse
.Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in.
Note: if
call_on_sections
isTrue
then - on encountering a subsection, first the function is called for the whole subsection, and then recurses into it’s members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded.See the encode and decode methods for examples, including functions.
caution
You can use
walk
to transform the names of members of a section but you mustn’t add or delete members.>>> config = '''[XXXXsection] ... XXXXkey = XXXXvalue'''.splitlines() >>> cfg = ConfigObj(config) >>> cfg ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) >>> def transform(section, key): ... val = section[key] ... newkey = key.replace('XXXX', 'CLIENT1') ... section.rename(key, newkey) ... if isinstance(val, (tuple, list, dict)): ... pass ... else: ... val = val.replace('XXXX', 'CLIENT1') ... section[newkey] = val >>> cfg.walk(transform, call_on_sections=True) {'CLIENT1section': {'CLIENT1key': None}} >>> cfg ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})
-
write
(outfile=None, section=None)¶ Write the current ConfigObj as a file
tekNico: FIXME: use StringIO instead of real files
>>> filename = a.filename >>> a.filename = 'test.ini' >>> a.write() >>> a.filename = filename >>> a == ConfigObj('test.ini', raise_errors=True) 1 >>> import os >>> os.remove('test.ini')
-
writeInputFile
(filename, ignore_none=False, yesno=False, smartsort=False)¶ Write the configuration to a file in the InputConfig format.
Parameters: - filename (a file path or an open file handle) – The file to write the configuration to.
- ignore_none (bool) – If True, keywords with a value of None will not be written to the input file.
- yesno (bool) – If True, boolean keywords will be written as “yes” and “no”, if False, as “True” and “False”.
- smartsort (bool) – If True, keywords that are identical except for the numbers at the end will be sorted such that “2” will go before “10”.
-
writeJSON
()¶ Write the keywords as a JSON representation. Unlike writeSimplified, this includes the values for all the keywords, not only the non-default ones.
-
writeSimplified
(filename=None, yesno=False)¶ Writes a simplified input file to “<jobname>.inp”. This input file needs to be run via $SCHRODINGER/glide.
-
-
class
schrodinger.application.glide.glide.
Dock
(keywords, jobtypes=None)¶ Bases:
schrodinger.application.glide.glide.GlideJob
Class for generating Glide docking input files.
-
__init__
(keywords, jobtypes=None)¶ Specify a dictionary of keywords, where the key is the short keyword name and the value is what is should be set to. For indexed keywords, the value needs to be a list. It is also possible to specify a file path to a simplified input file that contains the keywords.
Parameters: keywords (dict or file path) – Either a dictionary of keywords or a simplified input file path.
-
setLigRange
(start, end)¶ Shortcut for setting the range of ligands to be read from the LIGANDFILE.
Parameters: end – If zero, means to go to the end of the file.
-
checkConflicts
()¶ Check for invalid keyword combinations. Raises a ValueError if any are found.
-
applyContextDependentDefaults
()¶ Apply context-dependent defaults for a Glide job. It modifies the job object, but marks the modified keywords as “default” so they won’t be written by writeSimplified().
-
setupJson
(jsdict)¶ Additional setup to do before writing a JSON file. Base implementation does nothing. This method is expected not to modify ‘self’, but only jsdict, which is the dictionary of keywords that ultimately will be written to the JSON file.
-
readConsKeywords
()¶ Reads the constraint keywords, parses their values, and returns them as a tuple of (cons groups, feature sets).
-
cleanup
()¶ Free up the group handles
-
addConstraintGroup
(cons_labels, nrequired)¶ Add a new constraint group to this Docking instance.
Parameters: - cons_labels – A list of labels for constraints to use.
- nrequired – Minimum number of constraints required for match (Can be ALL).
-
useConstraint
(label)¶ Adds specified constraint to the first group.
Default group is #1; constraint type determined automatically.
-
setNRequired
(nrequired)¶ Set the minimum number of constraints required for the first group. A value of ALL means all constraints are required.
-
__class__
¶ alias of
builtins.type
-
__contains__
()¶ True if D has a key k, else False.
-
__delattr__
¶ Implement delattr(self, name).
-
__delitem__
(key)¶ Remove items from the sequence when deleting.
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.glide.glide', '__doc__': '\n Class for generating Glide docking input files.\n ', '__init__': <function Dock.__init__>, '_mungeBeforeValidation': <function Dock._mungeBeforeValidation>, 'setLigRange': <function Dock.setLigRange>, '_checkPeptide': <function Dock._checkPeptide>, '_checkFlexOH': <function Dock._checkFlexOH>, '_autoLigFormat': <function Dock._autoLigFormat>, '_defaultsTable': <function Dock._defaultsTable>, '_conflictsTable': <function Dock._conflictsTable>, 'checkConflicts': <function Dock.checkConflicts>, '_setupCombiGlide': <function Dock._setupCombiGlide>, 'applyContextDependentDefaults': <function Dock.applyContextDependentDefaults>, '_setupPhase': <function Dock._setupPhase>, 'setupJson': <function Dock.setupJson>, '_setupJsonTorcons': <function Dock._setupJsonTorcons>, '_gridfile': <function Dock._gridfile>, '_featfile': <function Dock._featfile>, 'readConsKeywords': <function Dock.readConsKeywords>, '_setupConstraints': <function Dock._setupConstraints>, 'cleanup': <function Dock.cleanup>, 'addConstraintGroup': <function Dock.addConstraintGroup>, 'useConstraint': <function Dock.useConstraint>, 'setNRequired': <function Dock.setNRequired>, '_setupTorCons': <function Dock._setupTorCons>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__getitem__
(key)¶ Fetch the item and do string interpolation.
-
__gt__
¶ Return self>value.
-
__hash__
= None¶
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__
()¶ D.iterkeys() -> an iterator over the keys of D
-
__le__
¶ Return self<=value.
-
__len__
¶ Return len(self).
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.glide.glide'¶
-
__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__
()¶ x.__str__() <==> str(x)
-
__setattr__
¶ Implement setattr(self, name, value).
-
__setitem__
(key, value, unrepr=False)¶ Correctly set a value.
Making dictionary values Section instances. (We have to special case ‘Section’ instances - which are also dicts)
Keys must be strings. Values need only be strings (or lists of strings) if
main.stringify
is set.unrepr
must be set when setting a value to a dictionary, without creating a new sub-section.
-
__setstate__
(state)¶
-
__sizeof__
() → size of D in memory, in bytes¶
-
__str__
() <==> str(x)¶
-
__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)
-
as_bool
(key)¶ Accepts a key as input. The corresponding value must be a string or the objects (
True
or 1) or (False
or 0). We allow 0 and 1 to retain compatibility with Python 2.2.If the string is one of
True
,On
,Yes
, or1
it returnsTrue
.If the string is one of
False
,Off
,No
, or0
it returnsFalse
.as_bool
is not case sensitive.Any other input will raise a
ValueError
.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_bool('a') Traceback (most recent call last): ValueError: Value "fish" is neither True nor False >>> a['b'] = 'True' >>> a.as_bool('b') 1 >>> a['b'] = 'off' >>> a.as_bool('b') 0
-
as_float
(key)¶ A convenience method which coerces the specified value to a float.
If the value is an invalid literal for
float
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') 3.2...
-
as_int
(key)¶ A convenience method which coerces the specified value to an integer.
If the value is an invalid literal for
int
, aValueError
will be raised.>>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_int('a') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: 'fish' >>> a['b'] = '1' >>> a.as_int('b') 1 >>> a['b'] = '3.2' >>> a.as_int('b') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: '3.2'
-
as_list
(key)¶ A convenience method which fetches the specified value, guaranteeing that it is a list.
>>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1]
-
checkForceFieldLicense
(jsdict)¶ If we are using the default forcefield (OPLS3) and don’t have an OPLS license, fall back to using OPLS_2005.
-
clear
()¶ A version of clear that also affects scalars/sections Also clears comments and configspec.
- Leaves other attributes alone :
- depth/main/parent are not affected
-
copy
() → a shallow copy of D¶
-
dict
()¶ Return a deepcopy of self as a dictionary.
All members that are
Section
instances are recursively turned to ordinary dictionaries - by calling theirdict
method.>>> n = a.dict() >>> n == a 1 >>> n is a 0
-
fromkeys
()¶ Returns a new dict with keys from iterable and values equal to value.
-
get
(key, default=None)¶ A version of
get
that doesn’t bypass string interpolation.
-
getAllowedRange
(key)¶ Will return a tuple of (min, max) for the allowed range of value. Either or both of these values may be None.
Returns: The allowed min/max range. Return type: Tuple of 2 ints/floats.
-
getSpecsString
()¶ Return a string of specifications. One keywords per line. Raises ValueError if this class has no specifications.
-
items
() → list of D's (key, value) pairs, as 2-tuples¶
-
iteritems
() → an iterator over the (key, value) items of D¶
-
iterkeys
() → an iterator over the keys of D¶
-
itervalues
() → an iterator over the values of D¶
-
keys
() → list of D's keys¶
-
merge
(indict)¶ A recursive update - useful for merging config files.
>>> a = '''[section1] ... option1 = True ... [[subsection]] ... more_options = False ... # end of file'''.splitlines() >>> b = '''# File is user.ini ... [section1] ... option1 = False ... # end of file'''.splitlines() >>> c1 = ConfigObj(b) >>> c2 = ConfigObj(a) >>> c2.merge(c1) >>> c2 ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})
-
pop
(key, default=<object object>)¶ ‘D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised’
-
popitem
()¶ Pops the first (key,val)
-
printout
()¶ Print all keywords of this instance to stdout.
This method is meant for debugging purposes.
-
reload
()¶ Reload a ConfigObj from file.
This method raises a
ReloadError
if the ConfigObj doesn’t have a filename attribute pointing to a file.
-
rename
(oldkey, newkey)¶ Change a keyname to another, without changing position in sequence.
Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode)
Also renames comments.
-
reset
()¶ Clear ConfigObj instance and restore to ‘freshly created’ state.
-
restore_default
(key)¶ Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
If there is no default value for this key,
KeyError
is raised.
-
restore_defaults
()¶ Recursively restore default values to all members that have them.
This method will only work for a ConfigObj that was created with a configspec and has been validated.
It doesn’t delete or modify entries without default values.
-
setdefault
(key, default=None)¶ A version of setdefault that sets sequence if appropriate.
-
update
(indict)¶ A version of update that uses our
__setitem__
.
-
validate
(validator, preserve_errors=False, copy=False, section=None)¶ Test the ConfigObj against a configspec.
It uses the
validator
object from validate.py.To run
validate
on the current ConfigObj, call:test = config.validate(validator)
(Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the
configspec
attribute of a section though).It returns
True
if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the valueTrue
. (It also returnsFalse
if all members fail).In addition, it converts the values from strings to their native types if their checks pass (and
stringify
is set).If
preserve_errors
isTrue
(False
is default) then instead of a marking a fail with aFalse
, it will preserve the actual exception object. This can contain info about the reason for failure. For example theVdtValueTooSmallError
indicates that the value supplied was too small. If a value (or section) is missing it will still be marked asFalse
.You must have the validate module to use
preserve_errors=True
.You can then use the
flatten_errors
function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages.
-
validateValues
(*args, **kwargs)¶ Validate the keywords against the spec. Unlike the parent implementation, raise a ValueError if any unknown keywords are present.
-
values
() → list of D's values¶
-
walk
(function, raise_errors=True, call_on_sections=False, **keywargs)¶ Walk every member and call a function on the keyword and value.
Return a dictionary of the return values
If the function raises an exception, raise the errror unless
raise_errors=False
, in which case set the return value toFalse
.Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in.
Note: if
call_on_sections
isTrue
then - on encountering a subsection, first the function is called for the whole subsection, and then recurses into it’s members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded.See the encode and decode methods for examples, including functions.
caution
You can use
walk
to transform the names of members of a section but you mustn’t add or delete members.>>> config = '''[XXXXsection] ... XXXXkey = XXXXvalue'''.splitlines() >>> cfg = ConfigObj(config) >>> cfg ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) >>> def transform(section, key): ... val = section[key] ... newkey = key.replace('XXXX', 'CLIENT1') ... section.rename(key, newkey) ... if isinstance(val, (tuple, list, dict)): ... pass ... else: ... val = val.replace('XXXX', 'CLIENT1') ... section[newkey] = val >>> cfg.walk(transform, call_on_sections=True) {'CLIENT1section': {'CLIENT1key': None}} >>> cfg ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})
-
write
(outfile=None, section=None)¶ Write the current ConfigObj as a file
tekNico: FIXME: use StringIO instead of real files
>>> filename = a.filename >>> a.filename = 'test.ini' >>> a.write() >>> a.filename = filename >>> a == ConfigObj('test.ini', raise_errors=True) 1 >>> import os >>> os.remove('test.ini')
-
writeInputFile
(filename, ignore_none=False, yesno=False, smartsort=False)¶ Write the configuration to a file in the InputConfig format.
Parameters: - filename (a file path or an open file handle) – The file to write the configuration to.
- ignore_none (bool) – If True, keywords with a value of None will not be written to the input file.
- yesno (bool) – If True, boolean keywords will be written as “yes” and “no”, if False, as “True” and “False”.
- smartsort (bool) – If True, keywords that are identical except for the numbers at the end will be sorted such that “2” will go before “10”.
-
writeJSON
()¶ Write the keywords as a JSON representation. Unlike writeSimplified, this includes the values for all the keywords, not only the non-default ones.
-
writeSimplified
(filename=None, yesno=False)¶ Writes a simplified input file to “<jobname>.inp”. This input file needs to be run via $SCHRODINGER/glide.
-
-
schrodinger.application.glide.glide.
read_constraints
(gridfile)¶ Reads the receptor constraints from the specified grid file.
The constraints are actually read from the *.cons file. The resulting constraint “type” refers to the atom type in the RECEPTOR, where applicable. Specifically, H-bond and metal-binding constraints.
The matching ligand atom for an H-bond donor receptor constraint should be an H-bond acceptor (by default). Likewire the matching ligand ato for and H-bond acceptor receptor constraint should be a donor (polar H atom).
Other constraint types don’t refer to any specific atom type (Positional, NOE), or require the same atom type in the ligand as in the receptor (Hydrophobic) so the constraint type is valid for both molecules (ligand and receptor).
To get the constraint label, simply do str(Constraint).
Parameters: gridfile – The gridfile name; should be either a *.grd or *.zip file. Return type: A list of Constraint objects.
-
schrodinger.application.glide.glide.
read_yaml
()¶ Read mmim_keywords.json and return a list of objects. The read_yaml() name was retained for compatibility.
-
schrodinger.application.glide.glide.
read_keywords_file
()¶ Read the mmim_keywords.json file from the mmshare data directory and return a list of objects.
-
schrodinger.application.glide.glide.
read_keywords_file_as_dict
()¶ Read the mmim_keywords.json file from the mmshare data directory and return a dict of dicts, where the key is the keyword name and the value is the spec for the keyword (see get_keyword for more details).
-
schrodinger.application.glide.glide.
get_keyword
(keyword)¶ Return the specification of a Glide keyword as a dictionary, with keys such as “keyword”, “type”, “default”, “allowed”, “min”, “max”, and “comment”. For the full list and description for each field, see the comments in mmim_keywords.yaml.
-
schrodinger.application.glide.glide.
get_keywords_dicts
(jobtypes, include_undocumented=False)¶ Return the raw mmim_keywords.yaml data filtered to include only the keywords for the requested job types.
-
schrodinger.application.glide.glide.
keyword_spec
(jobtypes, include_undocumented=False)¶ Return a string with the specification of the mmim keywords that are valid for the jobtypes given. Jobtypes should be an iterable with items such as ‘docking’, ‘multi_docking’, or ‘gridgen’. Keywords for jobtype ‘all’ are always included.
By default, undocumented keywords are not included in the return value, but that behavior can be overridden by setting ‘include_undocumented’ to True.
-
schrodinger.application.glide.glide.
validation_specs
(jobtype)¶ Return a list of validation specs for a given jobtype (e.g., ‘docking’ or ‘gridgen’) or list of jobtypes. This includes not only the keywords returned by keyword_spec(jobtype), but also some extra keywords that are supported by glide.py but not by mmim.
-
schrodinger.application.glide.glide.
get_keywords_set
(jobtypes)¶ Return the set of all keywords valid for the given job types.
-
schrodinger.application.glide.glide.
is_gridgen_keyword
(keyword)¶ Return True is a keyword is valid for gridgen jobs.
-
schrodinger.application.glide.glide.
is_docking_keyword
(keyword)¶ Return True is a keyword is valid for docking jobs.
-
schrodinger.application.glide.glide.
calc_ligand_size
(coords)¶ Given a list of (x, y, z) coordinates for all atoms in a ligand, calculate the ligand size. This value should be added to the innerbox to get the default outerbox.
Parameters: coords (List of 3-item tuples.) – List of coordinates for all ligand atoms. Return type: float Returns: The size of the ligand.
-
schrodinger.application.glide.glide.
get_default_box_size
(struct, ligand_asl='all')¶ Gets the default box size for a grid. This returns the outer and inner box lengths.
Parameters: - struct (structure.StructureReader) – The structure containing the reference ligand
- ligand_asl (str) – The ASL for the ligand. Default: “all”
Return type: tuple of lists, e.g. ([10, 10, 10], [-5.9863, -1.887 , -0.2703])
-
schrodinger.application.glide.glide.
is_gridgen_job
(keywords)¶ Return True if the keywords suggest that this is a gridgen job.
Return type: bool
-
schrodinger.application.glide.glide.
get_glide_job
(input_file)¶ Return a Gridgen or Dock object given an SIF input filename or keyword dictionary. If it is a filename, use it to set JOBNAME (e.g. for “dir/myjob.in”, set it to “myjob”).
-
schrodinger.application.glide.glide.
is_false
(val)¶
-
schrodinger.application.glide.glide.
is_equivalent_to_mininplace
(val)¶ Checks if val is equivalent to mininplace