schrodinger.protein.tasks.blast module

class schrodinger.protein.tasks.blast.BlastAlgorithm(value)

Bases: schrodinger.models.jsonable.JsonableEnum

An enumeration.

BLAST = 1
PSIBLAST = 2
class schrodinger.protein.tasks.blast.BlastDatabase(value)

Bases: schrodinger.models.jsonable.JsonableEnum

An enumeration.

PDB = 1
NR = 2
CUSTOM = 3
class schrodinger.protein.tasks.blast.SimilarityMatrix(value)

Bases: schrodinger.models.jsonable.JsonableEnum

An enumeration.

BLOSUM45 = 1
BLOSUM62 = 2
BLOSUM80 = 3
PAM30 = 4
PAM70 = 5
exception schrodinger.protein.tasks.blast.NoBlastHitsError

Bases: RuntimeError

Custom exception if no blast hits are returned

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

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

class schrodinger.protein.tasks.blast.BlastSettings(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

progname: schrodinger.protein.tasks.blast.BlastAlgorithm
location: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
database_name: schrodinger.protein.tasks.blast.BlastDatabase
custom_database_path: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
word_size: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
filter_query: bool

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
gap_open_cost: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
gap_extend_cost: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
possible_gap_open: set

A Param to represent sets. Values of this param will have a mutated signal that will be emitted whenever any elment is added or removed from the set.

The constructor optionally takes a item_class keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the set if specified.

allowed_gap_extend: set

A Param to represent sets. Values of this param will have a mutated signal that will be emitted whenever any elment is added or removed from the set.

The constructor optionally takes a item_class keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the set if specified.

similarity_matrix: schrodinger.protein.tasks.blast.SimilarityMatrix
num_iterations: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
evalue_threshold: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
inclusion_threshold: float

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
allow_multiple_chains: bool

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
download_structures: bool

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
align_after_download: bool

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
num_alignments: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
DEFAULTS = {<SimilarityMatrix.BLOSUM45: 1>: (15, 2), <SimilarityMatrix.BLOSUM62: 2>: (9, 2), <SimilarityMatrix.BLOSUM80: 3>: (10, 1), <SimilarityMatrix.PAM30: 4>: (9, 1), <SimilarityMatrix.PAM70: 5>: (10, 1)}
EXT_OPEN_VALUES = {<SimilarityMatrix.BLOSUM45: 1>: {3: {10, 11, 12, 13}, 2: {12, 13, 14, 15}, 1: {16, 17, 18, 19}}, <SimilarityMatrix.BLOSUM62: 2>: {2: {6, 7, 8, 9, 10, 11}, 1: {9, 10, 11, 12, 13}}, <SimilarityMatrix.BLOSUM80: 3>: {2: {8, 6, 7}, 1: {9, 10, 11}}, <SimilarityMatrix.PAM30: 4>: {2: {5, 6, 7}, 1: {8, 9, 10}}, <SimilarityMatrix.PAM70: 5>: {2: {8, 6, 7}, 1: {9, 10, 11}}}
OPEN_EXT_VALUES = {<SimilarityMatrix.BLOSUM45: 1>: {10: {3}, 11: {3}, 12: {2, 3}, 13: {2, 3}, 14: {2}, 15: {2}, 16: {1}, 17: {1}, 18: {1}, 19: {1}}, <SimilarityMatrix.BLOSUM62: 2>: {6: {2}, 7: {2}, 8: {2}, 9: {1, 2}, 10: {1, 2}, 11: {1, 2}, 12: {1}, 13: {1}}, <SimilarityMatrix.BLOSUM80: 3>: {8: {2}, 6: {2}, 7: {2}, 9: {1}, 10: {1}, 11: {1}}, <SimilarityMatrix.PAM30: 4>: {5: {2}, 6: {2}, 7: {2}, 8: {1}, 9: {1}, 10: {1}}, <SimilarityMatrix.PAM70: 5>: {8: {2}, 6: {2}, 7: {2}, 9: {1}, 10: {1}, 11: {1}}}
initConcrete()

Override to customize initialization of concrete params.

initializeValue()

Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.

classmethod fromJsonImplementation(json_obj)

Sets the value of this compound param value object from a JSON dict.

Warning

This should never be called directly.

getBlastSettings()

Returns BLAST settings as a dictionary.

Returns

Dictionary of BLAST settings.

Return type

dict

DataClass

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
__init__(default_value=<object object>, _param_type=<object object>, **kwargs)
classmethod addSubParam(name, param, update_owner=True)
align_after_downloadChanged
align_after_downloadReplaced
allow_multiple_chainsChanged
allow_multiple_chainsReplaced
allowed_gap_extendChanged
allowed_gap_extendReplaced
blockSignals(self, bool) bool
block_signal_propagation()
childEvent(self, QChildEvent)
children(self) List[QObject]
classmethod configureParam()

Override this class method to set up the abstract param class (e.g. setParamReference on child params.)

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
custom_database_pathChanged
custom_database_pathReplaced
database_nameChanged
database_nameReplaced
classmethod defaultValue()

Returns the default value for this abstract param:

default_atom = Atom.defaultValue()
assert Atom.coord.x == 0
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
download_structuresChanged
download_structuresReplaced
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
evalue_thresholdChanged
evalue_thresholdReplaced
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
filter_queryChanged
filter_queryReplaced
findChild(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

gap_extend_costChanged
gap_extend_costReplaced
gap_open_costChanged
gap_open_costReplaced
getAbstractParam()

Return the corresponding abstract param for this instance.

classmethod getJsonBlacklist()

Override to customize what params are serialized.

Implementations should return a list of abstract params that should be omitted from serialization.

..NOTE

Returned abstract params must be direct child params of cls, e.g. cls.name, not cls.coord.x.

classmethod getParamSignal(obj, signal_type='Changed')
classmethod getParamValue(obj)

Enables access to a param value on a compound param via an abstract param reference:

a = Atom()
assert Atom.coord.x.getParamValue(a) == 0 # ints default to 0
a.coord.x = 3
assert Atom.coord.x.getParamValue(a) == 3
Parameters

param (CompoundParam) – The owner param to get a param value from

classmethod getSubParam(name)

Get the value of a subparam using the string name:

c = Coord()
assert c.getSubParam('x') == 0

Note

Using the string name to access params is generally discouraged, but can be useful for serializing/deserializing param data.

Parameters

name (str) – The name of the subparam to get the value for.

classmethod getSubParams()

Return a dictionary mapping subparam names to their values.

getTypeHint()
get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

inclusion_thresholdChanged
inclusion_thresholdReplaced
inherits(self, str) bool
initAbstract()
installEventFilter(self, QObject)
classmethod isAbstract()

Whether the param is an “abstract” param.

isDefault()

Whether the current value of this instance matches the default value.

isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
locationChanged
locationReplaced
metaObject(self) QMetaObject
moveToThread(self, QThread)
num_alignmentsChanged
num_alignmentsReplaced
num_iterationsChanged
num_iterationsReplaced
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

classmethod owner()

Get the owner of the param:

# Can be called on an abstract param:
assert Coord.x.owner() == Coord

# ...or on an instance of a CompoundParam
a = Atom()
assert a.coord.owner() == a
classmethod ownerChain()

Returns a list of param owners starting from the toplevel param and ending with self. Examples:

foo.bar.atom.coord.ownerChain() will return [foo, bar, atom, coord] where every item is a concrete param.

Foo.bar.atom.coord.x.ownerChain() will return [Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x] where every item is an abstract params.

classmethod paramName()

Get the name of the param:

# Can be called on an abstract param:
print(Coord.x.paramName()) # 'x'

# ...or on an instance of a CompoundParam
a = Atom()
a.coord.paramName() # 'coord'
parent(self) QObject
possible_gap_openChanged
possible_gap_openReplaced
prognameChanged
prognameReplaced
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
reset(*abstract_params)

Resets this compound param to its default value:

class Line(CompoundParam):
    start = Coord(x=1, y=2)
    end = Coord(x=4, y=5)
line = Line()
line.start.x = line.end.x = 10
assert line.start.x == line.end.x == 10
line.reset()
assert line.start.x == 1
assert line.end.x == 4

Any number of abstract params may be passed in to perform a partial reset of only the specified params:

line.start.x = line.end.x = 10
line.reset(Line.start.x)  # resets just start.x
assert line.start.x == 1
assert line.end.x == 10

line.reset(Line.end)      # resets the entire end point
assert line.end.x == 4

line.start.y = line.end.y = 10
line.reset(Line.start.y, Line.end.y)  # resets the y-coord of both
assert line.start.y == 2
assert line.end.y == 5
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, str)
classmethod setParamValue(obj, value)

Set the value of a param on an object by specifying the instance and the value:

# Setting the param value of a basic param
a = Atom()
Atom.coord.x.setParamValue(a, 5)
assert a.coord.x == 5

# setParamValue can also be used to set the value of CompoundParams
c = Coord()
c.x = 10
atom.coord.setParamValue(a, c)
assert atom.coord.x == 10
Parameters
  • param – The owner param to set a subparam value of.

  • value – The value to set the subparam value to.

setParent(self, QObject)
setProperty(self, str, Any) bool
classmethod setReference(param1, param2)

Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of param1. Example:

class Square(CompoundParam):
    width: float = 5
    height: float = 10

    @classmethod
    def configureParam(cls):
        super().configureParam()
        cls.setReference(cls.width, cls.height)

square = Square()
assert square.width == square.height == 5 # Default value of width
                                          # takes priority
square.height = 7
assert square.width == square.height == 7
square.width = 6
assert square.width == square.height == 6
Parameters
  • param1 – The first abstract param to keep synced

  • param2 – The second abstract param. After instantiation, this param will take on the value of param1.

setValue(value=None, **kwargs)

Set the value of this CompoundParam to match value.

Parameters
  • value – The value to set this CompoundParam to. It should be the same type as this CompoundParam.

  • kwargs – For internal use only.

signalsBlocked(self) bool
similarity_matrixChanged
similarity_matrixReplaced
skip_eq_check()
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, QTimerEvent)
toDict()

Return a dictionary version of this CompoundParam. The returned dictionary is fully nested and contains no CompoundParam instances

a = Atom()
a_dict = a.toDict()
assert a_dict['coord']['x'] == 0
assert a_dict['coord'] == {'x':0, 'y':0}
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Returns a JSON representation of this value object.

Warning

This should never be called directly.

tr(str, disambiguation: str = None, n: int = - 1) str
valueChanged
word_sizeChanged
word_sizeReplaced
class schrodinger.protein.tasks.blast.BlastTask(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.tasks.jobtasks.ComboJobTask

This is a thin wrapper over BlastPlus object that implements job running and incorporation.

To enable DEBUG_MODE, set DEBUG_MODE to True at the bottom of this class. In DEBUG_MODE, no blast call will actually be made and the first top 10 hits of a BLAST search with 1cmy:a will be returned as the output.

DEFAULT_TASKDIR_SETTING = 2
PROGRAM_NAME = 'BLAST'
output: List[dict]

A Param to represent lists. Values of this param will have a mutated signal that will be emitted whenever any mutation method is called.

The constructor optionally takes a item_class keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.

class Input(*args, _param_type=<object object>, **kwargs)

Bases: schrodinger.models.parameters.CompoundParam

query_sequence: schrodinger.protein.sequence.ProteinSequence

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
settings: schrodinger.protein.tasks.blast.BlastSettings
genomes: List[str]

A Param to represent lists. Values of this param will have a mutated signal that will be emitted whenever any mutation method is called.

The constructor optionally takes a item_class keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.

getQueryName()
initConcrete()

Override to customize initialization of concrete params.

classmethod getJsonBlacklist()

@overrides: parameters.CompoundParam

Rather than encode the whole ProteinSequence object, we just save the necessary parts and rehydrate it in the backend.

classmethod fromJsonImplementation(json_obj)

Sets the value of this compound param value object from a JSON dict.

Warning

This should never be called directly.

DataClass

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
__init__(default_value=<object object>, _param_type=<object object>, **kwargs)
classmethod addSubParam(name, param, update_owner=True)
blockSignals(self, bool) bool
block_signal_propagation()
childEvent(self, QChildEvent)
children(self) List[QObject]
classmethod configureParam()

Override this class method to set up the abstract param class (e.g. setParamReference on child params.)

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
classmethod defaultValue()

Returns the default value for this abstract param:

default_atom = Atom.defaultValue()
assert Atom.coord.x == 0
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

genomesChanged
genomesReplaced
getAbstractParam()

Return the corresponding abstract param for this instance.

classmethod getParamSignal(obj, signal_type='Changed')
classmethod getParamValue(obj)

Enables access to a param value on a compound param via an abstract param reference:

a = Atom()
assert Atom.coord.x.getParamValue(a) == 0 # ints default to 0
a.coord.x = 3
assert Atom.coord.x.getParamValue(a) == 3
Parameters

param (CompoundParam) – The owner param to get a param value from

classmethod getSubParam(name)

Get the value of a subparam using the string name:

c = Coord()
assert c.getSubParam('x') == 0

Note

Using the string name to access params is generally discouraged, but can be useful for serializing/deserializing param data.

Parameters

name (str) – The name of the subparam to get the value for.

classmethod getSubParams()

Return a dictionary mapping subparam names to their values.

getTypeHint()
get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

inherits(self, str) bool
initAbstract()
initializeValue()

Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.

installEventFilter(self, QObject)
classmethod isAbstract()

Whether the param is an “abstract” param.

isDefault()

Whether the current value of this instance matches the default value.

isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

classmethod owner()

Get the owner of the param:

# Can be called on an abstract param:
assert Coord.x.owner() == Coord

# ...or on an instance of a CompoundParam
a = Atom()
assert a.coord.owner() == a
classmethod ownerChain()

Returns a list of param owners starting from the toplevel param and ending with self. Examples:

foo.bar.atom.coord.ownerChain() will return [foo, bar, atom, coord] where every item is a concrete param.

Foo.bar.atom.coord.x.ownerChain() will return [Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x] where every item is an abstract params.

classmethod paramName()

Get the name of the param:

# Can be called on an abstract param:
print(Coord.x.paramName()) # 'x'

# ...or on an instance of a CompoundParam
a = Atom()
a.coord.paramName() # 'coord'
parent(self) QObject
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

query_sequenceChanged
query_sequenceReplaced
receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
reset(*abstract_params)

Resets this compound param to its default value:

class Line(CompoundParam):
    start = Coord(x=1, y=2)
    end = Coord(x=4, y=5)
line = Line()
line.start.x = line.end.x = 10
assert line.start.x == line.end.x == 10
line.reset()
assert line.start.x == 1
assert line.end.x == 4

Any number of abstract params may be passed in to perform a partial reset of only the specified params:

line.start.x = line.end.x = 10
line.reset(Line.start.x)  # resets just start.x
assert line.start.x == 1
assert line.end.x == 10

line.reset(Line.end)      # resets the entire end point
assert line.end.x == 4

line.start.y = line.end.y = 10
line.reset(Line.start.y, Line.end.y)  # resets the y-coord of both
assert line.start.y == 2
assert line.end.y == 5
sender(self) QObject
senderSignalIndex(self) int
setObjectName(self, str)
classmethod setParamValue(obj, value)

Set the value of a param on an object by specifying the instance and the value:

# Setting the param value of a basic param
a = Atom()
Atom.coord.x.setParamValue(a, 5)
assert a.coord.x == 5

# setParamValue can also be used to set the value of CompoundParams
c = Coord()
c.x = 10
atom.coord.setParamValue(a, c)
assert atom.coord.x == 10
Parameters
  • param – The owner param to set a subparam value of.

  • value – The value to set the subparam value to.

setParent(self, QObject)
setProperty(self, str, Any) bool
classmethod setReference(param1, param2)

Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of param1. Example:

class Square(CompoundParam):
    width: float = 5
    height: float = 10

    @classmethod
    def configureParam(cls):
        super().configureParam()
        cls.setReference(cls.width, cls.height)

square = Square()
assert square.width == square.height == 5 # Default value of width
                                          # takes priority
square.height = 7
assert square.width == square.height == 7
square.width = 6
assert square.width == square.height == 6
Parameters
  • param1 – The first abstract param to keep synced

  • param2 – The second abstract param. After instantiation, this param will take on the value of param1.

setValue(value=None, **kwargs)

Set the value of this CompoundParam to match value.

Parameters
  • value – The value to set this CompoundParam to. It should be the same type as this CompoundParam.

  • kwargs – For internal use only.

settingsChanged
settingsReplaced
signalsBlocked(self) bool
skip_eq_check()
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, QTimerEvent)
toDict()

Return a dictionary version of this CompoundParam. The returned dictionary is fully nested and contains no CompoundParam instances

a = Atom()
a_dict = a.toDict()
assert a_dict['coord']['x'] == 0
assert a_dict['coord'] == {'x':0, 'y':0}
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Returns a JSON representation of this value object.

Warning

This should never be called directly.

tr(str, disambiguation: str = None, n: int = - 1) str
valueChanged
getExpectedRuntime()

Return the expected runtime of the task based on the current settings

Returns

Expected runtime in seconds

Return type

int

getQueryName()
checkLocalDatabase()

Return True if the local database exists and is correctly configured. Return False if the local database is missing or truncated.

backendMain()
getBlastAlignment()
AUTO_TASKDIR = 1
CMDLINE = 1
DONE = 3
DataClass

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
ENTRYPOINT = 'combotask_entry_point.py'
FAILED = 2
GUI = 2
INTERRUPT_ENABLED = False
RUNNING = 1
TEMP_TASKDIR = 2
WAITING = 0
__init__(*args, cmd_list=None, **kwargs)
addFuncToGroup(func, group=None, order=None)

Adds a function to the specified chain. Typically used for adding functions that are not methods of this object.

The function may optionally be decorated with a FuncGroupMarker. If so, the default group and order will be determined by the decorator. Any group or order explicitly passed in to addFuncToGroup will take precedence over the decorator settings.

Parameters
  • func – the function to add

  • group (FuncGroupMarker or None) – the group marker. If the function is decorated with a FuncGoupMarker, that group marker will be the default.

  • order (float or None) – the sorting order. If the function is decorated with a FuncGoupMarker, the order specified in the decorator will be the default.

addLicenseReservation(license, num_tokens=1)

Add a license reservation for this job. This information is used by job control to ensure the job is only started once the required licenses become available.

In a preprocessor, (i.e. before launching the backend), a reservation should be added for each license that will be checked out directly by that backend. Example:

class GlideTask(ComboJobTask):

    @preprocessor
    def _reserveGlideLicense(self):
        # Reserve a Glide license.
        self.addLicenseReservation(license.GLIDE_MAIN)

    def mainFunction(self):
        # Check out the Glide license
        lic = license.License(license.GLIDE_MAIN)

        # ... Do computations requiring Glide ...

        lic.checkin()

Licenses that will be checked out by subjobs of this job do not need reservations added here; subjobs are responsible for their own license reservations.

Parameters
  • license (module-constant from schrodinger.utils.license (e.g. license.AUTODESIGNER)) – a license that will be used by the backend

  • num_tokens (int) – number of tokens for this license reservations

addPostprocessor(func, order=0)

Adds a postproceessor function to this task instance. If the function has been decorated with @postprocessor, the order specified by the decorator will be used.

Parameters
  • func (typing.Callable) – the function to add

  • order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.

addPreprocessor(func, order=None)

Adds a preproceessor function to this task instance. If the function has been decorated with @preprocessor, the order specified by the decorator will be used as the default.

Parameters
  • func – the function to add

  • order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.

classmethod addSubParam(name, param, update_owner=True)
blockSignals(self, bool) bool
block_signal_propagation()
calling_context: CallingContext
calling_contextChanged
calling_contextReplaced
childEvent(self, QChildEvent)
children(self) List[QObject]
classmethod configToJobConfigAdapter(json_dict)
classmethod configureParam()

@overrides: parameters.CompoundParam

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
classmethod defaultValue()

Returns the default value for this abstract param:

default_atom = Atom.defaultValue()
assert Atom.coord.x == 0
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
failure_info

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
findChild(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
classmethod fromJson(json_obj)

A factory method which constructs a new object from a given dict loaded from a json string or file.

Parameters

json_obj (dict) – A json-loaded dictionary to create an object from.

Returns

An instance of this class.

Return type

cls

classmethod fromJsonFilename(filename)
classmethod fromJsonImplementation(json_dict)

Sets the value of this compound param value object from a JSON dict.

Warning

This should never be called directly.

getAbstractParam()

Return the corresponding abstract param for this instance.

getAddedFuncs(group=None)
getDebugString()
getFuncGroup(group=None)

Retrieve the functions belonging to the specified group.

Parameters

group (FuncGroupMarker) – the group marker

Returns

the functions in the specified group, in order

Return type

list

getJob() Optional[schrodinger.job.jobcontrol.Job]
classmethod getJsonBlacklist()

Override to customize what params are serialized.

Implementations should return a list of abstract params that should be omitted from serialization.

..NOTE

Returned abstract params must be direct child params of cls, e.g. cls.name, not cls.coord.x.

getLogAsString() str
classmethod getParamSignal(obj, signal_type='Changed')
classmethod getParamValue(obj)

Enables access to a param value on a compound param via an abstract param reference:

a = Atom()
assert Atom.coord.x.getParamValue(a) == 0 # ints default to 0
a.coord.x = 3
assert Atom.coord.x.getParamValue(a) == 3
Parameters

param (CompoundParam) – The owner param to get a param value from

classmethod getSubParam(name)

Get the value of a subparam using the string name:

c = Coord()
assert c.getSubParam('x') == 0

Note

Using the string name to access params is generally discouraged, but can be useful for serializing/deserializing param data.

Parameters

name (str) – The name of the subparam to get the value for.

classmethod getSubParams()

Return a dictionary mapping subparam names to their values.

getTaskDir()

Returns the full path of the task directory. This is only available if the task directory exists (after creation of the taskdir or, if no task dir is specified, any time).

getTaskFilename(fname)

Return the appropriate absolute path for an input or output file in the taskdir.

getTypeHint()
get_version()

Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.

guard()

Context manager that saves any Exception raised inside

inWriteMode()
inherits(self, str) bool
initAbstract()
initConcrete()

Override to customize initialization of concrete params.

initializeValue()

@overrides: paramters.CompoundParam

input: parameters.CompoundParam
inputChanged
inputReplaced
installEventFilter(self, QObject)
classmethod isAbstract()

Whether the param is an “abstract” param.

isBackendMode()
isDebugEnabled()
isDefault()

Whether the current value of this instance matches the default value.

isInterruptionRequested()
isRunning()
isSignalConnected(self, QMetaMethod) bool
isStartable()
isWidgetType(self) bool
isWindowType(self) bool
job_config: JobConfig

Subclass JobConfig to customize what job settings are available for a given jobtask. To disable an option, set an ordinary (non-param) class variable with value None for that option.

Subclasses may add any arbitrary options as desired; it is the responsibility of the task to handle those options.

job_configChanged
job_configReplaced
job_id

This class can be used to declare a public attribute on a CompoundParam. Declared public attributes can be used without error.

Example usage:

class Coord(CompoundParam):
    x: int
    y: int
    note = NonParamAttribute()

coord = Coord()
coord.note = "hello" # No error
property json_filename
property json_out_filename
kill()

@overrides: tasks.AbstractTask

killTimer(self, int)
mainFunction()
makeCmd()

@overrides: tasks.AbstractCmdTask

Child classes must override.

max_progress: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
max_progressChanged
max_progressReplaced
metaObject(self) QMetaObject
moveToThread(self, QThread)
name: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
nameChanged
nameReplaced
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

outputChanged
outputReplaced
classmethod owner()

Get the owner of the param:

# Can be called on an abstract param:
assert Coord.x.owner() == Coord

# ...or on an instance of a CompoundParam
a = Atom()
assert a.coord.owner() == a
classmethod ownerChain()

Returns a list of param owners starting from the toplevel param and ending with self. Examples:

foo.bar.atom.coord.ownerChain() will return [foo, bar, atom, coord] where every item is a concrete param.

Foo.bar.atom.coord.x.ownerChain() will return [Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x] where every item is an abstract params.

classmethod paramName()

Get the name of the param:

# Can be called on an abstract param:
print(Coord.x.paramName()) # 'x'

# ...or on an instance of a CompoundParam
a = Atom()
a.coord.paramName() # 'coord'
parent(self) QObject
postprocessors()
Returns

A list of postprocessors, both decorated methods on the task and external functions that have been added via addPostprocessor()

Return type

list[typing.Callable]

preprocessors()
Returns

A list of preprocessors (both decorated methods on the task and external functions that have been added via addPreprocessor)

printDebug(*args)
processFuncChain(chain=None, result_callback=None)

Execute each function in the specified chain sequentially in order.

The result_callback is called after each function with the return value of that function. This can be used to respond to the return value (e.g. present information to the user, get user feedback, log the result, etc.)

The return value of the result_callback determines whether processing will proceeed to the next function.

Parameters
  • chain (FuncChainDecorator) – which chain to process

  • result_callback – the callback that will get called with the result of each function in the chain

Returns

a list of the results from the functions

progress: int

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
progressChanged
progressReplaced
progress_string: str

Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:

class Coord(CompoundParam):
    x: int
    y: int

An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:

coord = Coord()
coord.x = 4

When a Param value is set, the valueChanged signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:

class Atom(CompoundParam):
    coord: Coord
    element: str
progress_stringChanged
progress_stringReplaced
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
replicate()

@overrides: tasks.AbstractTask

requestInterruption()

Request the task to stop.

To enable this feature, subclasses should periodically check whether an interruption has been requested and terminate if it has been. If such logic has been included, INTERRUPT_ENABLED should be set to True.

reset(*args, **kwargs)

Resets this compound param to its default value:

class Line(CompoundParam):
    start = Coord(x=1, y=2)
    end = Coord(x=4, y=5)
line = Line()
line.start.x = line.end.x = 10
assert line.start.x == line.end.x == 10
line.reset()
assert line.start.x == 1
assert line.end.x == 4

Any number of abstract params may be passed in to perform a partial reset of only the specified params:

line.start.x = line.end.x = 10
line.reset(Line.start.x)  # resets just start.x
assert line.start.x == 1
assert line.end.x == 10

line.reset(Line.end)      # resets the entire end point
assert line.end.x == 4

line.start.y = line.end.y = 10
line.reset(Line.start.y, Line.end.y)  # resets the y-coord of both
assert line.start.y == 2
assert line.end.y == 5
run()
runBackend()

@overrides: AbstractComboTask

runCmd(cmd)

@overrides: tasks.AbstractCmdTask

classmethod runFromCmdLine()

@overrides: tasks.AbstractTask

runPreprocessing(callback=None, calling_context=None)

Run the preprocessors one-by-one. By default, any failing preprocessor will raise a TaskFailure exception and terminate processing. This behavior may be customized by supplying a callback function which will be called after each preprocessor with the result of that preprocessor.

This method is “final” so that all preprocessing logic will be enclosed in the try/finally block.

Parameters
  • callback – a function that takes result and returns a bool that indicates whether to continue on to the next preprocessor

  • calling_context – specify a value here to indicate the context in which this preprocessing is being called. This value will be stored in an instance variable, self.calling_context, which can be accessed from any preprocessor method on this task. Typically this value will be either self.GUI, self.CMDLINE, or None, but any value may be supplied here and checked for in the preprocessor methods. self.calling_context always reverts back to None at the end of runPreprocessing.

runToCmd(skip_preprocessing=False)

Does the same thing as start except it doesn’t actually launch the job. Instead it just returns the final job cmd.

Intended to be used for running jobtasks on JobDJ, which requires a job cmd rather than a task.

sender(self) QObject
senderSignalIndex(self) int
setJob(job: schrodinger.job.jobcontrol.Job)

” Use given jobcontrol.Job to incorporate job results into the task and run postprocessors. Example:

task = FooTask()
cmd = task.runToCommand()
job = jobcontrol.launch_job(cmd)
job.wait()
task.setJob(job)

If the job has not been downloaded, the task will be set to FAILED with a SetJobRuntimeError.

Parameters

jobjobcontrol.Job with results to incorporate into the task.

setObjectName(self, str)
classmethod setParamValue(obj, value)

Set the value of a param on an object by specifying the instance and the value:

# Setting the param value of a basic param
a = Atom()
Atom.coord.x.setParamValue(a, 5)
assert a.coord.x == 5

# setParamValue can also be used to set the value of CompoundParams
c = Coord()
c.x = 10
atom.coord.setParamValue(a, c)
assert atom.coord.x == 10
Parameters
  • param – The owner param to set a subparam value of.

  • value – The value to set the subparam value to.

setParent(self, QObject)
setProperty(self, str, Any) bool
classmethod setReference(param1, param2)

Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of param1. Example:

class Square(CompoundParam):
    width: float = 5
    height: float = 10

    @classmethod
    def configureParam(cls):
        super().configureParam()
        cls.setReference(cls.width, cls.height)

square = Square()
assert square.width == square.height == 5 # Default value of width
                                          # takes priority
square.height = 7
assert square.width == square.height == 7
square.width = 6
assert square.width == square.height == 6
Parameters
  • param1 – The first abstract param to keep synced

  • param2 – The second abstract param. After instantiation, this param will take on the value of param1.

setValue(value=None, **kwargs)

Set the value of this CompoundParam to match value.

Parameters
  • value – The value to set this CompoundParam to. It should be the same type as this CompoundParam.

  • kwargs – For internal use only.

signalsBlocked(self) bool
skip_eq_check()
specifyTaskDir(taskdir_spec)

Specify the taskdir creation behavior. Use one of the following options:

A directory name (string). This may be a relative or absolute path

None - no taskdir is requested. The task will use the CWD as its taskdir

AUTO_TASKDIR - a new subdirectory will be created in the CWD using the task name as the directory name.

TEMP_TASKDIR - a temporary directory will be created in the schrodinger temp dir. This directory is cleaned up when the task is deleted.

Parameters

taskdir_spec – one of the four options listed above

start(*args, **kwargs)

@overrides: AbstractTask

startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
status: Status
statusChanged
statusReplaced
stop()
taskDirSetting()

Returns the taskdir spec. See specifyTaskDir() for details.

taskDone
taskFailed
taskStarted
thread(self) QThread
timerEvent(self, QTimerEvent)
toDict()

Return a dictionary version of this CompoundParam. The returned dictionary is fully nested and contains no CompoundParam instances

a = Atom()
a_dict = a.toDict()
assert a_dict['coord']['x'] == 0
assert a_dict['coord'] == {'x':0, 'y':0}
toJson(_mark_version=True)

Create and returns a data structure made up of jsonable items.

Return type

An instance of one the classes from NATIVE_JSON_DATATYPES

toJsonImplementation()

Returns a JSON representation of this value object.

Warning

This should never be called directly.

tr(str, disambiguation: str = None, n: int = - 1) str
valueChanged
wait(timeout=None)

Block until the task is finished executing or timeout seconds have passed.

Warning

This should not be called directly from GUI code - see PANEL-18317. It is safe to call inside a subprocess or job. Run git grep "task.wait(" to see safe examples annotated with “# OK”.

Parameters

timeout (NoneType or int) – Amount of time in seconds to wait before timing out. If None or a negative number, this method will wait until the task is finished.

write(skip_preprocessing=False)
writeStuZipFile()