schrodinger.application.glide.glideanalysis module

Functions and classes for calculating Glide Docking Enrichment Factors and creating sorted pose libraries.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.glide.glideanalysis.PoseLibrary(file_name='', file_type=None, sort_property_1='r_i_glide_gscore', sort_property_2='r_i_glide_emodel', block_sort=True)

A helper class to sort a pose library. By default, multiple poses for one ligand-title are ‘block sorted’. i.e. grouped and sorted by Title and sort_property_2, and each group is sorted by its best member’s sort_property_1. The pose library may be resorted by sort_property_1, in a title agnostic manner, by calling sortByProperties().

API Example::
pl = glideanalysis.PoseLibrary(file_name=’input_lib.mae’) pl.writeTopPoses(‘output_lib.mae’)
Variables:
  • debug (bool) – Increases the verbosity of the various bookkeeping operations.
  • dock_results (dict) – A dictionary of pose properties, pose file index keys for property dict.
  • pose_lib_order (tuple) – A sorted tuple sequence of all pose file indexes.
  • best_pose_lib_order (tuple) – A sorted tuple sequence of poses file indexes, from just the best pose of each title-group.
  • title_tuples (list) – A list of (pose indexes) tuples, one tuple per title.
  • title_blocks (dict) – A dictionary of pose index lists, ‘title’ keys for list of sorted (intra title) indexes.
calculate_stats()

Calculate simple statistics on the glide scores. Sets the self.statistic dictionary and adds the standard score (glide gscore) to the self.dock_results dict.

Returns None.

debug = False
sortByProperties()

Orders the pose library in a Title agnostic manner, considering only sort_property_1; a simple (multi-key) sort of the docking results. The instance attribute ‘pose_lib_order’ is reassigned to the new ordered tuple, but since the block ordering is lost the attributes ‘best_pose_lib_order’ and ‘title_tuples’ are redefined as empty tuples, and ‘title_blocks’ is redefined to an empty dictionary.

sortInterTitle()

Orders the title_tuple families (see sortIntraTitle) by self.sort_property_2. No return value.

sortIntraTitle()

Creates tuples of poses with the same title, then sorts within each title-tuple by self.sort_property_2. No return value.

Ligands are not ‘ranked’ between titles by this function.

Raises an Exception if a pose without a title is encountered.

sortPoses()

Helper method that calls sortIntraTitle(), then sortInterTitle(). No return value.

write(output_lib_name='', indexes=(), block_size=4000)

Outputs an ordered pose lib file. The pose order is the same as indexes’ sequence of original file positions.

This method loads all pose structure.Structure objects into memory only if there are fewer than ‘block_size’ structures. Otherwise, it reads the input file multiple times, sorting structures in ‘block_size’ chunks until the entire library is sorted.

Returns None.

writeTopPoses(output_lib_name='', max_pose_per_title=1, block_size=2000)

Writes a pose library with the top N poses per ligand. Returns None.

Assumes self.title_tuples is sorted in the desired order.

writeValidPoses(output_lib_name='', actives=[], max_pose_per_active=10, max_pose_per_decoy=1, max_number_decoys=1000, block_size=2000)

Writes a pose library with multiple poses per active but a single pose per ‘decoy’. Returns None.

schrodinger.application.glide.glideanalysis.get_enrichment_calculator(file_name='', file_type=None, actives=[], report_header='', total_ligands=0, sort_property_1='r_i_glide_gscore', sort_property_2='r_i_glide_emodel')

Returns an schrodinger.analysis.enrichment.Calculator instance.

Parameters:
  • file_name (string) – The path to file upon which to operate. The ‘file_name’ pose file may contain multiple poses for each ligand, but the analysis requires culling to the best pose per ligand. Default is ‘’.
  • file_type (string) – Should be ‘pv’ or ‘lib’; used to determine the position of the first ligand pose. Default is ‘pv’.
  • actives (list of strings) – Each string corresponds to the title of a known active used in the docking experiment. Default is [].
  • total_ligands (int) – Integer number of the total number of ligands used in the experiment. Default is 0.
  • report_header (string) – Not implemented. This parameter is ignored.
  • sort_property_1 (string) – An m2io dataname that identifies the values for single pose per ligand sorting. Default is “r_i_glide_gscore”.
  • sort_property_2 (string) – An m2io dataname that identifies the values of intra-ligand group sorting. SP and HTVS poses should use ‘r_i_glide_emodel’ to pick the best pose of the same ligand-title. XP poses should use ‘i_glide_XP_PoseRank’ to determine the best pose within a ligand-title group. Default is “r_i_glide_emodel”.

This is a convenience interface for schrodinger.analysis.enrichment.Calculator, which is the preferred Enrichment metric generator. schrodinger.analysis.enrichment.Calculator has more metrics (e.g. BEDROC, ROC, AUAC), support for interactive plotting, and can generate plot png format files. This function also implements sort.py for better sorting performance.

Two files are created as a result of running this function; a list of active compound titles in <root>_actives.txt and a sorted structure file in <root>_efcalc<ext>, where <root> is the basename and <ext> the extension of the filename provided.