schrodinger.pipeline.pipeutils module

Shared functions for Pipeline stages.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.pipeline.pipeutils.countRoots(ligfiles, unique_field='s_m_title')

Counts the nunber of compounds in the supplied files. Compounds are identified by the ‘unique_field’ property, and all structures that share the same ‘unique_field’ value are considered variants of the compound. Raises a RuntimeError if there is a problem reading a ligand file or if the ‘unique_field’ property is missing. Returns a tuple of the total number of structures (i.e., variants) and the total number of compounds.

class schrodinger.pipeline.pipeutils.BackwardsReader(filename)

Bases: object

Read a file line by line, backwards. Takes in a file path, returns an iterator class.

BLKSIZE = 4096
__init__(filename)

Initialize self. See help(type(self)) for accurate signature.

schrodinger.pipeline.pipeutils.get_last_20_lines(logfile)

Given a log file, returns a string of last 20 lines of it.

class schrodinger.pipeline.pipeutils.DotPrinter(total_sts=None, every=1000)

Bases: object

Class for printing a progress period or percentage every N number of iterations.

Example: dp = DotPrinter(total_sts)

for st in sr:
dp.dot()
__init__(total_sts=None, every=1000)

Initialize self. See help(type(self)) for accurate signature.

dot()
schrodinger.pipeline.pipeutils.read_unique_field(st, uniquefield)

Returns the value of the specified property for the specified st (converted to string). If the property does not exist, attempts to read the same property of different type (string/int/float).

If neither is avaible, re-raises the missing property exception.

schrodinger.pipeline.pipeutils.get_reader(filename, astext=False, sd_for_unknown=True, support_smi=True, ignore_errors=False)

Return a StructureReader object for reading the file; based on the file type.

Parameters:
  • astext (bool) – Returns a MaestroTextReader instance if specified file is a Maestro file and astext is True.
  • sd_for_unknown – Whether to open files with unknown extensions as SD.
  • support_smi (bool) – Whether to support SMILES and SMILESCSV formats.
  • ignore_errors (bool) – If True, unreadable structures will be skipped instead of raising an exception. Currently only used by the SD reader.