schrodinger.application.glide.phase_subset module

Functions and classes for reading, writing, sorting, and merging Phase subset files in the dialect used by Glide, which includes docking scores as comments.

class schrodinger.application.glide.phase_subset.PhaseSubsetWriter(filename: str, overwrite: bool = True)

Bases: object

A StructureWriter-like class that writes Phase subset files in which each line is annotated with a comment with the docking score. For example,

LIGAND_NAME = mol_2 # score = -7.2744

__init__(filename: str, overwrite: bool = True)
Parameters
  • filename – The filename to write to.

  • overwrite – If False, append to an existing file instead of overwriting it.

append(st: schrodinger.structure._structure.Structure)

Write a subset entry for a pose. The structure must have the i_glide_molID and r_i_docking_score properties.

extend(sts: Iterable[schrodinger.structure._structure.Structure])

Append all provided structures to the open file.

schrodinger.application.glide.phase_subset.sort_parse_args()
schrodinger.application.glide.phase_subset.sort(infile, outfile)
schrodinger.application.glide.phase_subset.sortmain()
schrodinger.application.glide.phase_subset.parse_mol_id(line)
schrodinger.application.glide.phase_subset.parse_score(line)

Extract the score from the comment in a line of a Phase subset file.

Sample line:

LIGAND_NAME = mol_2 # score = -6.7935

class schrodinger.application.glide.phase_subset.SubsetReader(fh)

Bases: object

Helper class for scanning subset files.

__init__(fh)
next()

Read the next line; parse it and set the score attribute. On EOF, raises StopIteration.

schrodinger.application.glide.phase_subset.merge_readers(readers, outfh, nreport=None)
schrodinger.application.glide.phase_subset.merge_batch(filenames, output_filename, nreport=None)

Merge the give subset files in a single pass. Not recommended for very large numbers of input files.

schrodinger.application.glide.phase_subset.merge_all(filenames, output_filename, batch_size=128, nreport=None)

Merge any number of subset files, opening only up to ‘batch_size’ at a time and doing multiple passes if necessary.

schrodinger.application.glide.phase_subset.parse_merge_args()

Parse arguments to the glide_subset_merge script.

schrodinger.application.glide.phase_subset.merge_main()

Main function for the glide_subset_merge script.

schrodinger.application.glide.phase_subset.phase_subset_reader(fname)

Return a context manager that reads a Phase subset file, skipping LIGAND_DIR and commented-out lines. Yields the raw lines of text without any further parsing.

schrodinger.application.glide.phase_subset.phase_subset_count(fname)

Count the lines in a Phase subset file, ignoring LIGAND_DIR lines.

schrodinger.application.glide.phase_subset.read_subset_range(subset_file: str, start: int, end: Optional[int]) tuple[int]

Return the mol IDs from the specified range of lines in a subset file (not counting the LIGAND_DIR line, if present). The mol IDs are returned sorted and deduplicated.

Parameters
  • subset_file – a Phase subset file

  • start – first line number (1-based)

  • end – last line number (1-based). This is an inclusive range, reflecting the convention of the Glide LIGAND_START and LIGAND_END keywords. Zero or None mean read until EOF.