Package schrodinger :: Package application :: Package glide :: Module glideanalysis :: Class PoseLibrary
[hide private]
[frames] | no frames]

Class PoseLibrary

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')
Instance Methods [hide private]
 
__init__(self, file_name='', file_type=None, sort_property_1='r_i_glide_gscore', sort_property_2='r_i_glide_emodel', block_sort=True)
 
_show(self)
Helper/debugging method to print out values.
 
sortPoses(self)
Helper method that calls sortIntraTitle(), then sortInterTitle().
 
sortIntraTitle(self)
Creates tuples of poses with the same title, then sorts within each title-tuple by self.sort_property_2.
 
sortInterTitle(self)
Orders the title_tuple families (see sortIntraTitle) by self.sort_property_2.
 
sortByProperties(self)
Orders the pose library in a Title agnostic manner, considering only sort_property_1; a simple (multi-key) sort of the docking results.
 
calculate_stats(self)
Calculate simple statistics on the glide scores.
 
write(self, output_lib_name='', indexes=(), block_size=4000)
Outputs an ordered pose lib file.
 
writeValidPoses(self, 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'.
 
writeTopPoses(self, output_lib_name='', max_pose_per_title=1, block_size=2000)
Writes a pose library with the top N poses per ligand.
Class Variables [hide private]
bool debug = False
Increases the verbosity of the various bookkeeping operations.
Instance Variables [hide private]
tuple best_pose_lib_order
A sorted tuple sequence of poses file indexes, from just the best pose of each title-group.
dict dock_results
A dictionary of pose properties, pose file index keys for property dict.
tuple pose_lib_order
A sorted tuple sequence of all pose file indexes.
dict title_blocks
A dictionary of pose index lists, 'title' keys for list of sorted (intra title) indexes.
list title_tuples
A list of (pose indexes) tuples, one tuple per title.
Method Details [hide private]

__init__(self, file_name='', file_type=None, sort_property_1='r_i_glide_gscore', sort_property_2='r_i_glide_emodel', block_sort=True)
(Constructor)

 
Parameters:
  • file_name (string) - Path to the file upon with to operate. The 'file_name' pose file may contain multiple poses for each ligand. Default is "".
  • file_type (string) - Should be 'pv' or 'lib'; used to determine the position of the first ligand pose. If not specified, determined from ext.
  • sort_property_1 (string) - An m2io dataname or a space-separated list of m2io datanames that identify the values for single best pose per ligand-title sorting. The input string is broken into fields by split(). Default is "r_i_glide_gscore".
  • sort_property_2 (string) - An m2io dataname or a space-separated list of m2io datanames that identify the values for ligand-title group sorting. The input string is broken into fields by split(). Default is "r_i_glide_emodel".

    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 order within a ligand-title group.

  • block_sort (bool) - Boolean for the initial sorting operation. The pose library can always be resorted at a later point, this attribute just sets the default sorting operation for the instance. If True, poses are organized into ligand-title grouping as normal. If False, the poses are organized by a straight multi-key sort of sort_property_1. If there are multiple poses per ligand title this option should be used with care. Default is True.

_show(self)

 

Helper/debugging method to print out values. Prints table of sorted poses.

sortPoses(self)

 

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

sortIntraTitle(self)

 

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.

sortInterTitle(self)

 

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

sortByProperties(self)

 

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.

calculate_stats(self)

 

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.

write(self, 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.

writeValidPoses(self, 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.

writeTopPoses(self, 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.