schrodinger.project.utils module¶
- schrodinger.project.utils.get_PT()¶
Safe getter for the project instance that swallows exceptions that occur if the project has been closed.
Using this function avoids unnecessary tracebacks that occur if the project is requested in the brief period after the project has been closed before a new one is created.
- Returns
a project instance, if a project is available in Maestro
- Return type
project.Project or NoneType
- schrodinger.project.utils.set_entries_pinned(entry_ids, pin)¶
Pin or unpin entries from the workspace.
- Parameters
entry_ids (list(str)) – a list of entry IDs
pin (bool) – whether to pin or unpin the specified entries to the workspace
- schrodinger.project.utils.set_entry_pinned(entry_id, pin)¶
Pin or unpin an entry from the workspace.
- Parameters
entry_id (str) – an entry ID
pin (bool) – whether to pin or unpin the specified entry to the workspace
- schrodinger.project.utils.set_entries_included(entry_ids, include, override_pin=False)¶
For the specified entries, either include them in or exclude them from the workspace.
- Parameters
entry_ids (list(str)) – a list of entry IDs
include (bool) – whether to include (
True
) or exclude (False
)override_pin (bool) – if
False
, ignore pinned entries. IfTrue
, exclude entries that are set to be excluded even if they are pinned. If pinned entries are set to be included, leave them as pinned (because they are also included as pinned entries)
- schrodinger.project.utils.set_entry_included(entry_id, include, override_pin=False)¶
For the specified entry, either include it in or exclude it from the workspace.
- Parameters
entry_id (str) – an entry ID
include (bool) – whether to include (
True
) or exclude (False
)override_pin (bool) – if
False
, ignore pinned entries. IfTrue
, exclude entries that are set to be excluded even if they are pinned. If pinned entries are set to be included, leave them as pinned (because they are also included as pinned entries)
- schrodinger.project.utils.entry_is_pinned(entry_id)¶
Return whether the specified entry is pinned in the workspace.
- Parameters
entry_id (str) – the entry ID of a row in the project
- Returns
whether the entry is pinned in the workspace
- Return type
bool
- schrodinger.project.utils.entry_is_included(entry_id)¶
Return whether the specified entry is included in the workspace.
- Parameters
entry_id (str) – the entry ID of a row in the project
- Returns
whether the entry is included in the workspace
- Return type
bool
- schrodinger.project.utils.entry_is_selected(entry_id)¶
Return whether the specified entry is selected in the project.
- Parameters
entry_id (str) – the entry ID of a row in the project
- Returns
whether the entry is selected in the project
- Return type
bool
- schrodinger.project.utils.set_entry_locked(entry_id, lock)¶
Set the supplied project table entry to be “locked” or “unlocked.”
These operations are grouped because they are both performed when locking an entry in the visual interface.
- Parameters
entry_id (str) – the entry ID of a row in the project
lock (bool) – whether to lock or unlock the specified entry
- schrodinger.project.utils.entry_is_locked(entry_id)¶
Return whether the supplied project entry is read-only and not deletable.
These properties are both tested because both values are set when locking an entry in the visual interface.
- Parameters
entry_id (str) – the entry ID of a row in the project
- Returns
whether the entry is locked
- Return type
bool
- schrodinger.project.utils.remove_entries(entry_ids)¶
Cleanly remove the specified entries from the project. If an entry cannot be found, do not raise an exception.
- Parameters
entry_id (list(str)) – a list of entry IDs
- schrodinger.project.utils.create_subgroup(entry_ids, group_name, subgroup_title)¶
Create a subgroup of the specified project group, and place the supplied entries into it.
- Parameters
entry_ids (list(str)) – entry IDs for project entries to be placed into the new subgroup
group_name (str) – name of the group to which this new subgroup will belong
subgroup_title (str) – the title of the new subgroup
- Returns
the new group object
- Return type
- schrodinger.project.utils.move_group(group, row_number)¶
Move all of the entries in the specified group to be below a specified row number in the project, while still retaining their group identity.
- Parameters
group (project.EntryGroup) – a non-empty entry group
row_number (int) – the number of a row in the project: one that designates order within the project, not an entry ID
- schrodinger.project.utils.get_rows(entry_ids)¶
- Parameters
entry_id (list(str)) – a list of entry IDs
- Returns
a list of either project rows corresponding to the provided entry IDs, if they exist, or
None
otherwise- Return type
list(project.ProjectRow or None)
- schrodinger.project.utils.get_row(entry_id)¶
- Parameters
entry_id (str) – an entry ID
- Returns
row corresponding to the entry ID, if it exists
- Return type
project.ProjectRow or None
- schrodinger.project.utils.get_structures_for_entry_ids(entry_ids, copy=True, props=True, pt=None)¶
Iterate over structures for the given entry IDs.
- schrodinger.project.utils.get_included_structures(copy=True, props=True, pt=None)¶
Iterate over structures for entries that are included n the Workspace.
- schrodinger.project.utils.get_included_entry_ids(pt=None)¶
Iterate over entry IDs for entries that are included in the Workspace.
- Return type
Iterator[str]
- Returns
Each iteration yields the entry id of an included project entry
- schrodinger.project.utils.get_selected_structures(copy=True, props=True, pt=None)¶
Iterate over structures for entries that are selected in the Project Table.
- schrodinger.project.utils.get_selected_entry_ids(pt=None)¶
Iterate over entry IDs for entries that are selected in the Project Table.
- Return type
Iterator[str]
- Returns
Each iteration yields the entry id of an included project entry
- schrodinger.project.utils.get_structure(entry_id)¶
- Parameters
entry_ids (str) – an entry ID
- Returns
a structure from the specified entry, if available
- Return type
structure.Structure or None
- schrodinger.project.utils.preserve_selection(pt=None)¶
Save the selection state of the project, then restore it on exit.
- Parameters
pt (project.Project or NoneType) – optionally, a project instance
- schrodinger.project.utils.unlock_entries(entry_ids, update_pt=True)¶
Temporarily unlock the specified entries, if they are locked. Otherwise, do not modify their lock state. Suppress signals from the project model during this process.
- Parameters
entry_ids (list(str)) – a list of entry IDs
update_pt (bool) – whether to update the project table on exiting the context environment
- schrodinger.project.utils.create_child_group(entry_ids, parent_group_name, group_name=None, before_entry_id=None)¶
Create a new group using the supplied entry IDs as a child group of the specified parent group.
- Raises
ValueError – if no entry IDs are provided
- Parameters
entry_ids (list(str)) – a list of entry IDs to put into the new group
parent_group_name (str) – the name of the group that should be the parent of the group created by this function
group_name (str or None) – the name of the group to be created; if not supplied, a unique name will be randomly generated
before_entry_id (str or NoneType) – optionally, the entry ID of a project entry above which the new subgroup should be created
- Returns
the new group
- Return type
- schrodinger.project.utils.get_entry_group(group_name)¶
Return the group in the project with the specified name.
- Parameters
group_name (str) – the name of the desired group
- Returns
the group with the specified name, if available
- Return type
str or None
- schrodinger.project.utils.generate_unique_group_name()¶
- Returns
a unique entry group name
- Return type
str
- schrodinger.project.utils.get_top_entry(entry_ids)¶
Given a list of project entry IDs, return the one that appears in the highest visual row in the project.
- Parameters
entry_ids (list(str)) – a list of project entry IDs
- Returns
the entry ID corresponding to the “highest” entry in
entry_ids
- Return type
str
- schrodinger.project.utils.entry_is_marked(entry_id)¶
Return whether the specified entry is “marked” with the Maestro property
b_m_Mark
.- Parameters
entry_id (str) – a project entry ID
- Returns
whether the specified entry has the Mark property, and that the value of that property is
True
- Return type
bool
- schrodinger.project.utils.set_entries_marked(entry_ids)¶
Programmatically mimic the behavior of the Maestro command “entrymarkincluded”, but for an arbitrary group of entries. If all entries are marked, unmark all entries. Otherwise, mark all entries.
- Parameters
entry_ids (list(str)) – a list of entry IDs
- schrodinger.project.utils.get_base_entry_group(entry_id)¶
For the specified entry, return the highest-level parent group to which it belongs, if possible.
- Parameters
entry_id (str) – a project entry ID
- Returns
the top-level entry group that contains the entry, if the entry belongs to any group
- Return type
project.EntryGroup or NoneType
- schrodinger.project.utils.move_row(entry_id, row_number)¶
Move the specified entry row to the specified position in the project.
- Parameters
entry_id (str) – an entry ID
row_number (int) – the position to which the specified entry should be moved
- schrodinger.project.utils.modify_row_structure(entry_id=None, row=None)¶
Context which returns a structure from the row corresponding to the given entry id and sets the structure back to the row afterwards. Also preserves the structure’s trajectory property.
- Parameters
entry_id (str) – entry id of rows to modify
row (project.ProjectRow) – The project row for this entry. Either row or entry_id must be supplied
- Returns
a structure in a context manager that will set the structure back onto the project row when control is returned to this function
- Return type
structure.Structure or NoneType
- schrodinger.project.utils.has_valid_wscore_block(row)¶
Given a ProjectRow instance, return True if the entry has associated WScore data and a valid receptor; False otherwise.
- class schrodinger.project.utils.ProjectStructure(row=None, eid=None, modify=True)¶
Bases:
object
A Context manager that gets the structure for an entry from the project table and then optionally puts it back in the PT upon exit
- __init__(row=None, eid=None, modify=True)¶
Create a ProjectStructure instance
- Parameters
row (project.ProjectRow) – The project row for this entry. Either row or eid must be supplied
eid (str) – The entry ID for this entry. Either row or eid must be suppled. If the eid is not found in the project, the self.row attribute will be None.
modify (bool) – If True (default), set the structure back in the project on exit. If False, do not modify the structure in the project.
- Raises
AttributeError – If neither row nor eid are supplied
- schrodinger.project.utils.get_trajectory_path(proj, eid)¶
Method will return None if passed a falsey entry ID. Return trajectory file path if any, or None.
- Param
proj: Project on which to operate.
- Type
proj: Project
- Param
eid: Entry id associated with the given project.
- Type
eid: int or str
- schrodinger.project.utils.has_watermap(proj, eid)¶
If entry has watermap
- Param
proj: Project on which to operate.
- Type
proj: Project
- Param
eid: Entry id associated with the given project.
- Type
eid: int or str
- Returns
True if entry has watermap, False otherwise
- Return type
boolean
- schrodinger.project.utils.has_trajectory(proj, eid)¶
Whether the entry with given entry id has a trajectory associated with it
- Param
proj: Project on which to operate.
- Type
proj: Project
- Param
eid: Entry id associated with the given project.
- Type
eid: int or str
- schrodinger.project.utils.has_desmond_trajectory(proj, eid)¶
Whether the entry with given entry id has desmond trajectory
- Param
proj: Project on which to operate.
- Type
proj: Project
- Param
eid: Entry id associated with the given project.
- Type
eid: int or str
- schrodinger.project.utils.has_materials_trajectory(proj, eid)¶
Whether the entry with given entry id has materials trajectory
- Param
proj: Project on which to operate.
- Type
proj: Project
- Param
eid: Entry id associated with the given project.
- Type
eid: int or str
- schrodinger.project.utils.entry_excluded(entry_id: str)¶
Exclude the given entry temporarily.
- Parameters
entry_id – Entry id to be excluded temporarily.
- schrodinger.project.utils.restore_included_entries()¶
Store and restore any included entries.