schrodinger.application.glide.sort_utils module

class schrodinger.application.glide.sort_utils.StructureType(value)

Bases: enum.Enum

An enumeration.

EPV_RECEP = 1
NON_EPV_RECEP = 2
POSE = 3
class schrodinger.application.glide.sort_utils.SortOrder(value)

Bases: enum.Enum

An enumeration.

ASCENDING = <built-in function lt>
DESCENDING = <built-in function gt>
class schrodinger.application.glide.sort_utils.PropertyName

Bases: object

TITLE = 's_m_title'
RECEP = 'b_glide_receptor'
LIGNUM = 'i_i_glide_lignum'
CONFNUM = 'i_i_glide_confnum'
POSENUM = 'i_i_glide_posenum'
DSCORE = 'r_i_docking_score'
EMODEL = 'r_i_glide_emodel'
CVDW = 'r_i_glide_energy'
COUL = 'r_i_glide_ecoul'
VDW = 'r_i_glide_evdw'
GSCORE = 'r_i_glide_gscore'
INTERNAL = 'r_i_glide_einternal'
XPHBOND = 'r_glide_XP_HBond'
HBOND = 'r_i_glide_hbond'
METAL = 'r_i_glide_metal'
REWARDS = 'r_i_glide_rewards'
BURP = 'r_i_glide_eburp'
RMSD = 'r_i_glide_rmsd'
LIPO = 'r_i_glide_lipo'
SITE = 'r_i_glide_esite'
ROTB = 'r_i_glide_erotb'
CUSTOM = None
class schrodinger.application.glide.sort_utils.SortCriterion(prop_name: Union[str, NoneType], order: schrodinger.application.glide.sort_utils.SortOrder, default: Union[int, str, float, bool, NoneType] = None)

Bases: object

prop_name: Optional[str]
order: schrodinger.application.glide.sort_utils.SortOrder
default: Optional[Union[int, str, float, bool]] = None
__init__(prop_name: Optional[str], order: schrodinger.application.glide.sort_utils.SortOrder, default: Optional[Union[int, str, float, bool]] = None) None
class schrodinger.application.glide.sort_utils.CustomScoringFunction(gscore_coeff: float = 0.0, cvdw_coeff: float = 0.0, internal_coeff: float = 0.0, emodel_coeff: float = 0.0)

Bases: object

gscore_coeff: float = 0.0
cvdw_coeff: float = 0.0
internal_coeff: float = 0.0
emodel_coeff: float = 0.0
__init__(gscore_coeff: float = 0.0, cvdw_coeff: float = 0.0, internal_coeff: float = 0.0, emodel_coeff: float = 0.0) None
schrodinger.application.glide.sort_utils.get_structure_record_class(sort_criteria, default, custom_scoring_function)
class schrodinger.application.glide.sort_utils.ReceptorTable

Bases: object

Maintains a list of receptors for EPV mode.

Variables

structures (list[structure.Structure]) – A list of unique structures.

__init__()
update(ct)

Add the structure to the table. Determines the receptor link and updates the structure property accordingly. If the structure is not unique, the first receptor link value for that conformation is given.

As a side effect, this method can also be used to look up a receptor link if it is already in the table.

Parameters

ct (structure.Structure) – The structure to add.

Returns

The receptor link.

Return type

int

__len__()
schrodinger.application.glide.sort_utils.m2io_type_convert(prop_name, value)

Convert a string into the correct Python type corresponding to a m2io property name.

Parameters
  • prop_name (str) – The m2io property name.

  • value (str) – The value associated with that property

Returns

The value converted to the appropriate Python type.

schrodinger.application.glide.sort_utils.get_ct_property(ct, prop_name) Optional[Union[int, str, float, bool]]
class schrodinger.application.glide.sort_utils.TempFileNameIterator(file)

Bases: object

Iterator that generates temporary file names using a filename as a template. Honors PV/EPV file naming conventions. Can be used as a context manager that will delete all files at exit.

Variables

files (list[str]) – A list of file names that have been generated by the instance.

__init__(file)
schrodinger.application.glide.sort_utils.split_ext_pv(file)

Return stem and extension, while accounting for compression and “_pv” or “_epv” as part of the extension.

For example: foo_pv.mae.gz -> (foo, _pv.mae.gz)

schrodinger.application.glide.sort_utils.is_epv_filename(file) bool

Determines whether a filename follows EPV file conventions.

schrodinger.application.glide.sort_utils.is_sd_file_list(files) bool
schrodinger.application.glide.sort_utils.write_output(outfile, receptors, poses, write_empty=False)

Write an output file with receptors at the top, followed by poses. Creates a directory and parents, if necessary. Can be used to write empty files.

Parameters
  • outfile (str) – The file location to write to.

  • receptors (Iterable[structure.Structure]) – The receptors to write to file.

  • poses (Iterable[structure.Structure]) – The poses to write to file.

  • write_empty (bool) – Ensure that a file is written even if there are no structures to write.

Returns

Number of structures written to file.

Return type

int

schrodinger.application.glide.sort_utils.write_empty_file(outfile)

Write a valid empty file.

schrodinger.application.glide.sort_utils.profile_memory(logger=None, level=10)
schrodinger.application.glide.sort_utils.get_max_batch_size()

Get the limit of open file handles for each platform.

exception schrodinger.application.glide.sort_utils.EmptyInputError

Bases: Exception

__init__(*args, **kwargs)
args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.glide.sort_utils.BestPoseFilter(nbest, ndistinct, nreport)

Bases: object

Callable class that will retain only the top poses, as specified by the criteria provided at initialization. It is a memory-efficient way to retain the best records from a list or other iterable object.

Filter will stop iteration once any of of the conditions are met.

__init__(nbest, ndistinct, nreport)
Parameters
  • nbest (int) – Retain the top N records by each ‘best_by_id’ property.

  • ndistinct (int) – Retain poses from the top N ‘best_by_id’s.

  • nreport (int) – Retain the top N total records.

class schrodinger.application.glide.sort_utils.GlideSortUtility(args, logger=None, legacy_mode=False)

Bases: object

__init__(args, logger=None, legacy_mode=False)
Parameters
  • args (argparse.Namespace) – Arguments passed from the command-line driver script.

  • logger (logging.Logger) – A logger.

  • legacy_mode (bool) – Legacy mode will defer to behavior of the original perl script, even when improvements may have otherwise been introduced.

sort()
merge(file_map=None, delete_infiles=False, no_filter=False, n_reject_missing=0, n_reject_filter=0)

Merge multiple files together on sort criteria.

Parameters
  • file_map (Optional[list[Tuple[str, int]]]) – If supplied, it should contain a list of tuples. Each tuple contains the name of a file to be merged and an integer to map the file back to the _original_ file associated with it. This is done so that a large file can be broken into smaller files, but the provenance of the file can be tracked.

  • delete_infiles (bool) – Delete an infile once it has been merged?

  • no_filter (bool) – Perform any filtering on the input poses?

  • n_reject_missing (int) – The number of poses rejected for missing values. Used for reporting purposes.

  • n_reject_filter (int) – The number of poses rejected for filter cutoffs. Used for reporting purposes.

schrodinger.application.glide.sort_utils.convert_flags_to_underscore(argv=None, logger=None)

Convert all command-line flags to underscore-delimited words instead of dash-delimited words. This is carry-over functionality from when this was a Perl script.

schrodinger.application.glide.sort_utils.parse_size(size) int

Parse user input to convert human-readable file size into bytes. Accepted suffixes are {K, M, G, T} corresponding to SI file sizes (powers of 10). :param str size: A representation a file size. :return: The file size in bytes.

class schrodinger.application.glide.sort_utils.SortAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: argparse.Action

__init__(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
class schrodinger.application.glide.sort_utils.ObsoleteAction(*args, **kwargs)

Bases: argparse.Action

__init__(*args, **kwargs)
schrodinger.application.glide.sort_utils.add_modes_group(parser)
schrodinger.application.glide.sort_utils.add_file_options_group(parser)
schrodinger.application.glide.sort_utils.add_output_options_group(parser)
schrodinger.application.glide.sort_utils.add_scoring_group(parser, progname)
schrodinger.application.glide.sort_utils.add_filter_parser_group(parser)
schrodinger.application.glide.sort_utils.add_undocumented_args(parser)
schrodinger.application.glide.sort_utils.add_obsolete_args(parser)
schrodinger.application.glide.sort_utils.check_modes(parser, args)
schrodinger.application.glide.sort_utils.set_files_from_args(parser, args)
schrodinger.application.glide.sort_utils.check_file_formats(parser, args)
schrodinger.application.glide.sort_utils.set_sort_criteria_from_args(parser, args)

Check that either user-specified sort criteria are used _or_ at most, a single ‘-use_*’ score flag. Updates the list of sort criteria accordingly.

Parameters
  • parser (argparse.ArgumentParser) – The parser being used.

  • args (Namespace) – Parsed arguments.

Returns

Whether any sort criteria flags were provided.

Return type

bool

schrodinger.application.glide.sort_utils.set_output_options_from_args(parser, args)
schrodinger.application.glide.sort_utils.set_custom_scoring_function_from_args(parser, args, sort_criteria_provided=False)
schrodinger.application.glide.sort_utils.set_filters_from_args(parser, args)