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