schrodinger.application.glide_ws.trigger module¶
- schrodinger.application.glide_ws.trigger.recursive_get(recursive_dict, prop_path)¶
Get a value from a recursive dict by passing a dot-separated key. For example, recursive_get(d, ‘x.y’) is equivalent to d[‘x’][‘y’].
- class schrodinger.application.glide_ws.trigger.Trigger(name, min_val=None, max_val=None, level='strict')¶
Bases:
object
A Trigger defines the range of acceptable values for a property. Property names may use a dot-separated path notation to access data blocks (e.g., “m_wsviz_data.r_wsviz_rotexpen”).
- __init__(name, min_val=None, max_val=None, level='strict')¶
- check(props, level='critical')¶
Check if the trigger passes given a dictionary of properties. Retuns a FailedTrigger object on Failure, or None on success. The trigger level an job setting for trigger will determine whether a trigger check is performed.
- as_dict()¶
Return a plain Python dict representation of the Trigger.
- class schrodinger.application.glide_ws.trigger.FailedTrigger(trigger, value)¶
Bases:
object
This class represents a failed trigger. It consists of a Trigger and the value for the property.
- __init__(trigger, value)¶
- class schrodinger.application.glide_ws.trigger.TriggerSet(trigger_dict=None)¶
Bases:
object
A TriggerSet is a set of Trigger objects, identified by name. All triggers in a given TriggerSet are of the same “type” (e.g., triggers for a given node such as NATIVE).
- __init__(trigger_dict=None)¶
- update_from_dict(trigger_dict)¶
- add_trigger(trigger)¶
Add a Trigger to the TriggerSet. If a Trigger of the same name already exists, it is replaced.
- check_ct(st, verbose=False, level='critical')¶
Check if a Structure object passes all the triggers in the set. Returns a list of FailedTrigger objects.
- check_cts(reader, writer, verbose=False, level='critical')¶
Check the triggers against multiple structures (from ‘reader’). Modified copies of the structures, in which an additional data block ‘m_ws_triggers’ is added for structures that failed any triggers, are appended to ‘writer’. Returns the number of structures that failed.
- add_failed_triggers_to_ct(st, failed_triggers)¶
Store the information describing a list of failed triggers in a Structure, in an additional data block called ‘m_ws_triggers’.
- as_dict()¶
Return a plain Python dict representation of the TriggerSet.
- class schrodinger.application.glide_ws.trigger.TriggerConfig(fname=None, config_dict=None)¶
Bases:
object
A TriggerConfig holds a set of TriggerSet objects, each one identified by name. The idea is that there will be one such set per major type of trigger; for example, one for “active triggers” and another one for “decoy triggers”.
TriggerConfig objects may be stored in JSON files.
- __init__(fname=None, config_dict=None)¶
- read_json(fname)¶
Add TriggerSets read from a JSON file to the TriggerConfig object. If the TriggerConfig object is not empty, the TriggerSets from the JSON file get merged into the current config. This can be used, for example, to read a global config first, followed by reading a user config which may override part of the global config.
- update_from_dict(config_dict)¶
Update a TriggerConfig from a dictionary representation.
- add_trigger_set(name, trigger_set)¶
Add a TriggerSet to the TriggerConfig object. If a TriggerSet of that name already exists, it is replaced.
- trigger_set(name)¶
Return a trigger set by name.
- write_json(fname)¶
Write the TriggerConfig as a JSON file.
- as_dict()¶
Return a plain Python dict representation of the TriggerConfig.
- check_cts(name, reader, writer, verbose=False, level='critical')¶
Check if the Structures from ‘reader’ pass all the triggers of type ‘name’. Append the failed Structures to ‘writer’.
- check_ct(name, st, verbose=False, level='critical')¶
Check if a Structure passes all the triggers of type ‘name’. Returns a list of FailedTrigger objects.
- schrodinger.application.glide_ws.trigger.get_failed_triggers_from_ct(st)¶
Return a list of FailedTrigger objects based on data from the ‘m_ws_triggers’ data block associated with a Structure object.
- schrodinger.application.glide_ws.trigger.main()¶
A simple command-line script for manual testing of the trigger module.