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.

__iter__()
__del__()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.pipeline.pipeutils', '__doc__': '\n Read a file line by line, backwards.\n Takes in a file path, returns an iterator class.\n ', 'BLKSIZE': 4096, '__init__': <function BackwardsReader.__init__>, '__iter__': <function BackwardsReader.__iter__>, '__del__': <function BackwardsReader.__del__>, '__dict__': <attribute '__dict__' of 'BackwardsReader' objects>, '__weakref__': <attribute '__weakref__' of 'BackwardsReader' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.pipeline.pipeutils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

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()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.pipeline.pipeutils', '__doc__': '\n Class for printing a progress period or percentage every N number of iterations.\n\n Example:\n dp = DotPrinter(total_sts)\n\n for st in sr:\n dp.dot()\n ', '__init__': <function DotPrinter.__init__>, 'dot': <function DotPrinter.dot>, '__dict__': <attribute '__dict__' of 'DotPrinter' objects>, '__weakref__': <attribute '__weakref__' of 'DotPrinter' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.pipeline.pipeutils'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

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.