schrodinger.application.glide_ws.driver module

Driver module for Glide WS.

Copyright Schrodinger, LLC. All rights reserved.

exception schrodinger.application.glide_ws.driver.BadComplex

Bases: Exception

class schrodinger.application.glide_ws.driver.State(basename)

Bases: object

An object that stores the persistent “state” of the Glide WS job. This is used for data such as the watermap and coulomb parameters, the models, the constitution of the ensembles, offset parameters, etc. However, this is a generic, “dumb” class that only knows how to save and load itself and doesn’t “know” anything about the data that it contains. Users are free to create arbitrary properties in objects of this class. All properties used by the class itself start with an underscore, so user-added properties shouldn’t start with an underscore to minimize the risk of clashes.

The current storage implementation is a pickle, but that is subject to change.

__init__(basename)
static fname(basename)

Return the filename for a state file based on a basename.

save()

Save the state to a pickle.

remove()

Remove the state file.

class schrodinger.application.glide_ws.driver.NodeState

Bases: object

An object that is used by nodes to store arbitrary properties that should persist after the node is done. This is normally used for per-node data that will be needed by subsequent nodes. This class is reponsible for storing the the total cpu time of the node.

__init__()
class schrodinger.application.glide_ws.driver.GlideWSJob(config=None, nodes=None, state_class=<class 'schrodinger.application.glide_ws.driver.State'>, cmd_args=None, save_state=True)

Bases: object

This is the main controller class for the Glide WS driver and startup scripts. It has methods for parsing command-line arguments and input files, and a ‘run’ method to run the job. In principle, all one needs to do to run a Glide WS job is:

glide_ws_job = GlideWSJob() glide_ws_job.run()

__init__(config=None, nodes=None, state_class=<class 'schrodinger.application.glide_ws.driver.State'>, cmd_args=None, save_state=True)

Create a GlideWSJob object. All arguments are optional, and are mostly useful for testing:

  • ‘config’: a dictionary representing the input config. If provided, then no attempt is made at reading the usual command-line-supplied input file.

  • ‘nodes’: a list of Node objects. If provided, this list is used to drive the workflow instead of the default node list.

  • ‘state_class’: a State class or equivalent that is used for storing persistent state data.

  • ‘args’: a list of arguments to use instead of sys.argv[1:] if provided.

  • ‘save_state’: whether to actually write the state file. Turning this off is useful when running a startup script that does no real computation and produces no state worth saving.

is_docking_job()
init_nodes(nodes)

Initialize the node list and associated properties such as .node_names and .current_node.

add_node(node, first=False)

Add a node to the workflow. Normally, it is added at the end of the workflow, but if ‘first’ is True, it is inserted at the beginning.

insert_node_to_run(node)

Add a node to run at the beginning of the workflow. It is assumed that this node type (as identified by its name) is already known to the job.

replace_initial_node_to_run(node)

Replace the first node in the part of the workflow that will actually run. The new node must have the same name as the original one. This is useful for restarting jobs.

node(node_name)

Return the node object given a node name.

static default_nodes()

Return a list of new Node objects representing the default Glide WS workflow.

static single_receptor_nodes()

Return a list of new Node objects representing the single receptor Glide WS workflow.

init_state()

Read the state file and extract the necessary properties from it, such as .offsets, .models, and .current_node. If the state file doesn’t exist, create a new one.

reset_state()

Reset the state to a “blank slate”. This entails remove the current state file, if it exists!

node_state(node)

Return a persistent NodeState object where a given node can store arbitrary properties that should be stored in the state file.

set_hosts()

Initialize host-related variables such as self.hosts.

parse_args(cmd_args)

Parse the command line and return a Namespace object.

check_args(args, config)

Make sure that the command-line arguments are valid beyond what can be done implicitly by the parse_args.

saveState()

Save the persistent state object self.state.

sanitize_string(s, name='string')

Return the sanitized version of s or raise a fatal error if not possible. Replaces whitespace with underscores and checks that all characters after that are in the whitelist.

config_spec(job_type=3, exclusive=False, hide_hidden_keywords=False)

Return the configspec used for validating the input file, and containing the default values for keywords that have them. If ‘exclusive’ is True, only the keywords that can only be used for that job type will be returned.

allowed_keywords(job_type=3)

Return the set of allowed keywords for a given job type.

complex_config_spec()

Return the configspec for a COMPLEX section.

complex_allowed_keywords()

Return the set of keywords allowed within a COMPLEX block.

print_keywords(hide_hidden_keywords=True)
property config

InputConfig object holding the configuration settings for this Glide WS job.

docking_params()

Return a dictionary with global docking parameters, to be passed when creating all docking input files.

set_nodes_to_run()
init_complexes()
property wscore_jobparams
auto_add_gridgen_node()

Add the gridgen node unless we already have all the necessary grids or dogridgen is False.

auto_add_wmap_node()

Add the WMAP_GEN node unless we already have all the necessary WaterMap files.

init_model()

Read the model file and set the .models property. also set complex.constraint_groups and self.features if specified.

getConstraintsForModelComplexes(complex)

Read constraint group definitions from Complex sections. For docking jobs only.

readComplexes(wscore_jobparams)

Process the COMPLEX sections of the config file and return a list of Complex objects.

remove_complex(complex)

Remove a complex from the training set. This only has a meaningful effect during the early nodes, when the jobs are complex-based. Later nodes, which are model-based, don’t use the complex list directly anymore.

get_complex_by_name(complex_name)
trigger_failure(node, trigger_files)

Tell the driver to stop at the end of the current node due to a trigger failure. The files listed in ‘trigger_files’ should contain the failed poses.

add_job_to_db()

Push job to jobs table in WScore database

one_valid_gridfile()

Checks if at least one of the complexes contains a valid gridfile

run()

Run the Glide WS job. If an “expected” fatal error occurs, this will raise a GlideWSError exception. If an “unexpected” (as in, “this should never happen!”) fatal error occur, some other exception may bubble up, but that should be considered a bug.

compute_cpu_times(node_list)

Computes total CPU time over all of the nodes.

update_total_cpu_times(time_dict)

Updates the appopriate job CPU time with the total CPU time of a single single node.

property monitor_file
write_monitor_file()
print_header()

Print the main job header that goes at the top of the log file.

Print the main job footer that goes at the bottom of the log file.

property actives_ligfile

The filename of the concatenated actives ligand file, “<jobname>_active_ligs.maegz”.

property sp_decoys_libfile

The filename of the best decoy ligands after the SP_DECOYS node.

property modelfile

The model filename, “<jobname>_models.zip”.

property datadir

The directory used to hold the extracted gridfiles and watermap files during the MODEL run. This is <jobname>/tmpdata unless an uncompressed model directory was used as input.

jc_files()

Return a tuple of three sets (inputs, outputs, logs), where each set contains the files of that type that need to be registered with job control at startup time.

get_restart_files()

Return the set of files needed to restart a job.

register_files(launcher)

Register input/output/logfiles with the Launcher object provided.

launch(launcher_class=<class 'schrodinger.job.launcher.Launcher'>)

Launch the driver job using job control.

cleanup()

Remove the temporary job directory and the state file.

check_license()
get_trigger_config()

Return a TriggerConfig object initialized using the trigger files determined from the Glide WS input file.

user_trigger_files()

Return the set of user-specified trigger files.

property log_archive
property decoy_ligs

Return the path to the decoys lig file.

extract_files()

Extract the grid files and watermap files from the model file.

validate_input_structures()

Do some sanity checks on the input structures (actives, decoys, and optionally, testset). For now, the only check is to ensure that each structure has a title. :raises: GlideWSError if failed.

schrodinger.application.glide_ws.driver.validate_titles(filename)

Check that the first 1000 structures in a file have a non-empty title. :raises: GlideWSError if failed.

schrodinger.application.glide_ws.driver.add_dir_to_jobcontrol(pathname, launcher)

Add an existing job directory to job control, so that the job can be restarted. Useful for restarting a job or “forcing” a job from a specified node.