schrodinger.project.utils module

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)

For the specified entries, either include them in or exclude them from the workspace. If the entries are pinned and include is True, keep the entries pinned. If the entries are pinned and include is False, exclude the entries anyway.

Parameters:
  • entry_ids (list(str)) – a list of entry IDs
  • include (bool) – whether to include (True) or exclude (False)
schrodinger.project.utils.set_entry_included(entry_id, include)

For the specified entry, either include it in or exclude it from the workspace. If the entry is pinned and include is True, keep the entry pinned. If the entry is pinned and include is False, exclude the entry anyway.

Parameters:
  • entry_id (str) – an entry ID
  • include (bool) – whether to include (True) or exclude (False)
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:

project.EntryGroup

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(entry_ids)
Parameters:entry_ids (list(str)) – a list of entry IDs
Returns:a list of either structures copied from the specified entries or None if they don’t exist
Return type:list(structure.Structure or None)
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)

Save the selection state of the project, then restore it on exit.

Parameters:pt (project.Project) – the 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)

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
Returns:

the new group

Return type:

project.EntryGroup

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