schrodinger.application.glide.http_client module

Glide HTTP client

This module implements objects that connect to a Glide HTTP server (see schrodinger.application.glide.http_server) and use the server to dock ligands remotely.

Sample usage:

from schrodinger import structure from schrodinger.application.glide import http_client

client = http_client.HTTPClient(host=’localhost’, port=8000) ct = structure.Structure.read(‘mylig.mae’) poses = client.dock(ct) for pose in poses:

print “gscore=%f” % pose.properties[‘r_i_glide_gscore’]

For a higher level API that also starts up and monitors the server itself, see GlideServerManager.

class schrodinger.application.glide.http_client.HTTPClient(con=None, host='localhost', port=8000, timeout=1000)

Bases: object

This class provides an API to connect to an existing Glide HTTP server. For a higher level API that also starts up and monitors the server itself, see GlideServerManager.

__init__(con=None, host='localhost', port=8000, timeout=1000)

Initialize a new HTTPClient object. The optional ‘con’ is an existing httplib.HTTPConnection object. If not provided, then ‘host’, ‘port’, and ‘timeout’ will be used to create one. The default timeout value is very large to make sure that it is enough for most docking jobs to finish.

dock(ct)

Dock the ligand in Structure object ‘ct’ using the remote Glide server. Returns an iterator with the output pose(s).

ct_to_multipart(ct)

Encode a CT in multipart/form-data format, ready to POST. Returns the body of the request and the boundary

shutdown_server()

Ask the Glide HTTP server to shut down.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.glide.http_client', '__doc__': '\n This class provides an API to connect to an existing Glide HTTP server.\n For a higher level API that also starts up and monitors the server itself,\n see `GlideServerManager`.\n ', '__init__': <function HTTPClient.__init__>, 'dock': <function HTTPClient.dock>, 'ct_to_multipart': <function HTTPClient.ct_to_multipart>, 'shutdown_server': <function HTTPClient.shutdown_server>, '__dict__': <attribute '__dict__' of 'HTTPClient' objects>, '__weakref__': <attribute '__weakref__' of 'HTTPClient' 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.http_client'
__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.http_client.GlideServerManager(keywords, jobdir='.', jobname='glide_server', host='localhost', port=0, timeout=1000)

Bases: object

A class to start, stop, monitor, and use a Glide HTTP server. Sample use:

server = GlideServerManager({‘GRIDFILE’: ‘grid.zip’}) server.start() while not server.isReady():

time.sleep(1)

poses = server.dock(st) server.stop()

__init__(keywords, jobdir='.', jobname='glide_server', host='localhost', port=0, timeout=1000)
Parameters:keywords – Glide keywords to use for the job. The only required

keyword is GRIDFILE. :type keywords: dict

Parameters:
  • jobdir (str) – job directory
  • jobname – basename for input and output files and for job control
  • host – host to which the server should bind to
  • port (int) – port where the server should listen. If zero, pick one automatically.
  • timeout (int) – the server will shut down automatically if this time, in seconds, passes without receiving any connections.
start()

Launch the Glide Server job. Returns as soon as the job is launched, but to make sure that the job is ready to dock call .isReady() until True.

isReady()
Returns:is the server ready to dock?
Return type:bool
dock(st)

Dock a ligand. Returns a list of poses, which may be empty. If there was a problem connecting to the server, socket.error exceptions may be propagated.

Parameters:st (schrodinger.structure.Structure) – Structure to dock
Returns:list of poses
Return type:list of schrodinger.structure.Structure
stop()

Stop the server. First it will try to send it a shutdown request via HTTP; if that doesn’t work, it will kill via job control.

config

A dictionary with the information needed to connect with the server: host, port, and jobid. This data is obtained from a JSON file written by the server. If the file does not exist (yet?), the dict will be empty.

client

Client object to be used for connecting to the Glide server process.

Return type:HTTPClient
Returns:the client object.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.glide.http_client', '__doc__': "\n A class to start, stop, monitor, and use a Glide HTTP server.\n Sample use:\n\n server = GlideServerManager({'GRIDFILE': 'grid.zip'})\n server.start()\n while not server.isReady():\n time.sleep(1)\n poses = server.dock(st)\n server.stop()\n ", '__init__': <function GlideServerManager.__init__>, 'start': <function GlideServerManager.start>, 'isReady': <function GlideServerManager.isReady>, 'dock': <function GlideServerManager.dock>, 'stop': <function GlideServerManager.stop>, '_clearConfig': <function GlideServerManager._clearConfig>, '_readConfig': <function GlideServerManager._readConfig>, 'config': <property object>, 'client': <property object>, '__dict__': <attribute '__dict__' of 'GlideServerManager' objects>, '__weakref__': <attribute '__weakref__' of 'GlideServerManager' 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.http_client'
__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)