schrodinger.application.glide_ws.model module¶
Model module for WScore.
Here “model” is used a bit in the model-view-controller sense, to mean the part of the system that stores the data, but note that there is also a Model class here, which is used to represent a type of protein model in the molecular modeling sense.
The “controller” would be schrodinger.application.glide_ws.driver. And the “view”, presumably, is the startup script and the log file (and Maestro, of course!)
- class schrodinger.application.glide_ws.model.Constraint(label, feature)¶
Bases:
tuple
- feature¶
Alias for field number 1
- label¶
Alias for field number 0
- schrodinger.application.glide_ws.model.readModelFile(modelpath, newjobname='wscore_dock', datadir='wscore_dock/tmp', active_model_name=None)¶
Read a model file (or directory). If it’s a file, it is expected to be a .zip file.
- Parameters
modelpath (str) – model file or directory
newjobname (str) – name of the WScore docking job that will use this model file. It used for the name of the job directory, under which all input and output files are written.
datadir (str) – path to which to extract the contents of the model file when running the job. Unused when ‘modelpath’ is a directory.
active_model_name (str) – name of the model to pick from the model file
- Returns
tuple (active model, all models)
- Return type
- schrodinger.application.glide_ws.model.extract_model_file(zipname)¶
Extract the .models file from a model .zip archive.
- Parameters
zipname (str) – model .zip archive
- Returns
path to extracted .models file
- Return type
str
- schrodinger.application.glide_ws.model.parse_model_config_file(fname, newjobname='', datadir=None, active_model=None)¶
- schrodinger.application.glide_ws.model.parse_model_section(fname, newjobname, section, modtitle, datadir=None)¶
- schrodinger.application.glide_ws.model.get_features_from_dict(config_dict)¶
Extract the constraint matching feature from the input config dictionary. An example of the returned feature dictionary: {‘1’: {‘PATTERN1’: ‘[#1][#7] 1 include’, ‘PATTERN2’: ‘[#1][S;X2] 1 include’, ‘PATTERN3’: ‘[#1][O-] 1 include’, ‘PATTERN4’: ‘[#1][O;X2] 1 include’}}
- Parameters
config_dict (dict) – dictionary read from the input
- Returns
features: dictionary containing patterns for each feature
- Return type
features: dict
- schrodinger.application.glide_ws.model.get_constraint_groups_from_dict(complex_dict)¶
Extract the constraint groups from the [COMPLEX:i] section from the input config dictionary.
- Parameters
constraint_groups_dict (Dict) – [COMPLEX:i] section from the input config dictionary
- Returns
constraint_groups: list of constraint group
- Return type
constraint_groups: List(ConstraintGroup)
- schrodinger.application.glide_ws.model.writeModelFile(jobname, models, node=None, node_names=None, active_model=None, fh=None, rename=True, save_enrichment=True)¶
Write a .models file containing details about the models contained in the “models” list
- schrodinger.application.glide_ws.model.writeModelArchive(jobname, models, node=None, node_names=None, active_model=None, fh=None, zipobj=None, rename=True, save_enrichment=True)¶
Write model data (ensemble, parameters, grid and Watermap file names) to a “model file” (<jobname>.models), and to archive this model file and all the associated grids and wmaps to a Zip file “<jobname>_models.zip.” If fh and zipobj are set, they are used for writing the model file and model archive.
- schrodinger.application.glide_ws.model.models_dict(active_model_name, jobname, models, datanames, node, node_names, rename=True, save_enrichment=True)¶
Return a dict with the data structure that ultimately gets written to the model file.
- schrodinger.application.glide_ws.model.generate_json_header(complexes, excluded_recep_pairs, offsets, ndecoys)¶
Generate the header section for actives.json and decoys.json
- Parameters
complexes (Complex) – all complexes
excluded_recep_pairs (list((str, str))) – a collection of mutually exclusive complexes identified by their names
offsets (list) – offsets for all complexes
ndecoys (int) – number of decoys
- Returns
header: a JSON dumpable header
- Return type
header: list of dict
- schrodinger.application.glide_ws.model.complexes_are_aligned(ref_recep, complex_recep, cutoff)¶
Alignment check of receptor cts by COM check
- schrodinger.application.glide_ws.model.auto_align_complexes(complexes, cutoff=5.0)¶
If the center of mass of any of the receptors differs by more than a given threshold, they are all aligned (relative to the first complex)
- schrodinger.application.glide_ws.model.align_and_update_complex_cts(complexes, pre_receps, post_receps)¶
- schrodinger.application.glide_ws.model.wmap_needs_align(complex, rmsd_tol, cutoff)¶
Check whether WMap receptor and Complex receptor are well aligned. Alpha carbons of the residues within cutoff distance to the WMap ligand are used to calculate the RMSD between two receptors.
- Parameters
complex (WScore Complex) – complex that contains the wmap file and receptor.
rmsd_tol (float) – Max RMSD that is considered “well aligned”
cutoff (float) – Residues distance cutoff for checking and aligning receptors.
- Returns
needs align, list of alpha carbon atoms index in Wmap receptor, list of alpha carbon atoms index in complex receptor
- Return type
bool, list(int) or None, list(int) or None
- schrodinger.application.glide_ws.model.align_and_update_wmap(complex, wm_recep_atom_index, complex_recep_atom_index)¶
Align Wmap receptor to complex receptor. Also transform Wmap water ct and Wmap ligand with the same transformation matrix. Write the aligned cts to <complex.directory>/<complex>_aligned_wm.maegz (or .zip). Then sets complex.wm_wmfile to the new file.
- Parameters
complex (WScore Complex) – complex that contains the wmap file and receptor.
wm_recep_atom_index (list(int)) – list of alpha carbon index in WMap receptor
complex_recep_atom_index (list(int)) – list of alpha carbon index in complex receptor
- schrodinger.application.glide_ws.model.align_wmap_to_recep(complex, rmsd_tol=0.2, cutoff=5)¶
Align the cts in Wmap file to complex receptor if necessary.
- Parameters
complex (WScore Complex) – complex that contains the wmap file and receptor.
rmsd_tol (float) – Max RMSD that is considered “well aligned”
cutoff (float) – Residues distance cutoff for checking and aligning receptors. (see wmap_needs_align() for details)
- class schrodinger.application.glide_ws.model.Complex(name, ligfile, gridfile=None, gridzip=None, recepfile=None, prefix=None, index=1, force_include=False, confgen_extra='', constraints=None, constraint_groups=None, is_dummy=False)¶
Bases:
object
Class to generate and store experimental and wscore information for a single protein-ligand complex.
- __init__(name, ligfile, gridfile=None, gridzip=None, recepfile=None, prefix=None, index=1, force_include=False, confgen_extra='', constraints=None, constraint_groups=None, is_dummy=False)¶
A complex must have a ligfile and either a gridfile or a recepfile. The prefix is used to construct the directory name used by jobs related to this complex: directory = <prefix>/<name>.
- Parameters
gridfile – grid file to be used for docking (may be .grd or .zip)
gridzip – grid file to be stored in model file (must be .zip)
- property gridname¶
The gridfile, but with the extension removed. Read-only.
- property gridfile¶
The grid file for this complex. This is a magic property that automatically accounts for the backend runtime path.
- property wm_wmfile¶
The watermap file for this complex. It may be a _wm.zip or a _wm.maegz. This is a magic property that automatically accounts for the backend runtime path.
- property ligfile¶
The ligand file for this complex. This is a magic property that automatically accounts for the backend runtime path.
- property recepfile¶
The receptor file for this complex. This is a magic property that automatically accounts for the backend runtime path.
- property wm_maefile¶
Returns the path to the _wm.maegz file, extracting it from a _wm.zip archive if necessary.
- property wm_contfile¶
Returns the path to the -continuous.maegz file, extracting it from a _wm.zip archive if necessary.
- extract_wmap_files()¶
Extract the _wm.maegz and -continuous.maegz files from a WaterMap zip archive. Does not overwrite existing files.
- property wmap_cts¶
return the Structure objects contained in self.wm_maefile
- property ligand_ct¶
Return the Structure object from the first structure on the ligand file. This method sets the COMPLEX property to the complex name to make it easier to identify where it came from.
- property receptor_ct¶
Return the Structure object from the first structure on the receptor file. This method sets the COMPLEX property to the complex name to make it easier to identify where it came from.
- property metal_atoms_st¶
- receptor_string_from_grid()¶
Extract receptor file from grid archive and return its contents as a string.
- getLigandCenterAndSize()¶
Returns the “diameter” of the bound ligand in a complex, defined as the distance between the two most widely separated ligand atoms.
- gridgen_job(jobdir=None, rangespec=None, center=None, recep_path=None, hbond_constraints=None, posit_constraints=None, sp=False)¶
- docking_job(jobdir=None, reflig=False, startlig=1, endlig=0, inputring=False, loose_rms=False, offset=None, ligfile=None, jobname=None, ligoffset=0, sort=True, epik_penalties=True, maxatoms=500, maxrotbonds=50, lig_maecharges=False, zroff=None, ref_ligand_file=None, confgen_extra='', void=False, canonicalize=False, core_definition='allheavy', core_atoms=None, core_filter=False, core_pos_max_rmsd=1.0, core_restrain=False, core_restrain_v=5.0, core_smarts=None, excluded_pdb_waters=None, excluded_wmap_waters=None, excluded_prot_residues=None, excluded_water_coords=None, sip_mode=False, keep_state=False, cutoff_config_filename=None, use_constraints=False, features=None, glide_cons_finalonly=False, wscore_2cycle=False, use_confgenx=True, numconf_confgenx=1000, time_limit=30.0, macrocycle=False, docking_method='confgen', **d)¶
Return a schrodinger.application.glide.Dock object representing a docking job for the complex.
- docking_sif(**d)¶
Generate the SIF input for a docking job for this complex, returning it as a string. For arguments, see docking_job().
- gridgen_sif(**d)¶
- schrodinger.application.glide_ws.model.get_models_from_optimizer_output(opt_dict_list, jobname, complexes, features)¶
Return a list of Model objects given the dictionary produced by WScore_Optimizer.
- class schrodinger.application.glide_ws.model.Model(complexes, prefix, rmsd=0.0, count=0, score=None, rank=1, gbsa_score_params=None, zroff=2.0, gbshift=(0.0, 0.0), offset=2.0, features=None, enrichment=None)¶
Bases:
object
A Model is the combination of an set of complexes (ensemble), receptor offsets for each complex, and a gbshift parameter.
Other public properties of interest:
rmsd: deviation vs experiment for training set ligands
rank: ranking (1..N) for a job that generated multiple models.
gbshift: parameters used for MMGBSA scoring
enrichment: an Enrichment object containing the enrichment metrics for the model. May be None if the model came from an old model file.
- __init__(complexes, prefix, rmsd=0.0, count=0, score=None, rank=1, gbsa_score_params=None, zroff=2.0, gbshift=(0.0, 0.0), offset=2.0, features=None, enrichment=None)¶
- offset(complex)¶
Return the offset value for a given complex.
- set_offset(complex, offset)¶
Set the offset value for a given complex.
- gbshift(complex)¶
Return the gbshift value for a given complex.
- set_gbshift(complex, gbshift)¶
Set the gbshift value for a given complex.
- as_string()¶
A more verbose representation of the model as a string. Returns a table listing the ensemble members and their offsets, and the enrichment and RMSD for the model.
- property directory¶
Read-only property for the subdirectory for this model, “<prefix>/<modelname>”.
- libfile(node_name)¶
- actives_libfile_per_node(node_name)¶
Return the path to the libfile that contains the active poses needed by a given node.
- merged_libfile(node_name)¶
- property cross_libfile¶
- property testset_libfile¶
- property decoys_libfile¶
- property model_libfile¶
- property model_output_libfile¶
- property training_merged_libfile¶
- property testset_merged_libfile¶
- enrichment_report(node)¶
- property training_enrichment_report¶
- property testset_enrichment_report¶
- property model_epvfile¶
The final epv file for this model. Note that unlike intermediate lib files above, this one is in the top directory and not in a model subdirectory. When a libfile is specified for the pose outtype, a final libfile will be written to the top directory.
- property csv_filename¶
The final csv file for this model. Written to the top directory.
- results_files(node, nodes)¶
Return a list of “final results” files, which are presumably worth keeping. Only files that are produced up to and including node ‘node’ are listed.
- merge_enrich(setname, node_name, ligfile, decoy_titles)¶
Merge the actives and decoys lib files and compute enrichment.
- Parameters
setname (str) – name of the subset used for the enrichment calculation (e.g., “training” or “testset”)
nodename (str) – node whence the libfile with active ligand poses comes from (e.g., “cross” or “testset”)
ligfile (str) – name of file containing all active ligands
decoy_titles (set(str)) – set of titles of decoy ligands to use for calculation.
- merge_with_decoys(outfileprefix, actives_libfile, decoy_titles)¶
Merge the ligand pose file for the current step (training set or test set) and model with the decoy pose file for that model.
- run_enrichment(fileprefix, activefile, ndecoys)¶
Run enrichment calculations on merged actives+decoys pose file for current step and model, writing report to <jobname>_<model_str>/<step_prefix>_<model_str>.enrich.
- property complex_names¶
- class schrodinger.application.glide_ws.model.Enrichment(metrics)¶
Bases:
object
- PROPERTIES = ['bedroc160_9', 'alphaRa160_9', 'ef_1pct']¶
- __init__(metrics)¶
Initialize an Enrichment object. ‘metrics’ must have the enrichment metrics listed in PROPERTIES, either as attributes or as uppercase dictionary keys. (This is so both enrichment.Calculator and InputConfig objects can be supported).
- as_dict()¶
Return the enrichment metrics as a dict.
- class schrodinger.application.glide_ws.model.EnsembleLigand(lignum)¶
Bases:
object
Store information about docked ligands, as derived from Glide ensemble docking.
- __init__(lignum)¶
Input lignum is the index in the original ligand file, which doesn’t necessarily start from 1.
- class schrodinger.application.glide_ws.model.ConstraintGroup(name, definition)¶
Bases:
object
Store information related to an individual constraint group.constraint
- __init__(name, definition)¶
- readConstraints(constraint_defs)¶
Process constraint specifications for a constraint group.
- property used_cons_string¶
- getConstraintDict()¶
return a dictionary in the same format with the input config dictionary