schrodinger.utils.pymol module¶
Utilities to load Maestro projects into PyMOL.
Example:
>>> cmd = PymolInstance(["/path/to/pymol"])
>>> pt = maestro.project_table_get()
>>> process_prj(cmd, pt)
Copyright Schrodinger LLC, All rights reserved.
Author: Thomas Holder
- class schrodinger.utils.pymol.Mapping¶
Bases:
object
Mappings from Maestro codes to PyMOL representations and settings
- surface_cmd = {0: 'isosurface', 1: 'isomesh', 2: 'isodot'}¶
- ramp_colors = {'rainbow': '[red, yellow, green, cyan, blue, magenta]', 'redwhiteblue': '[red, white, blue]', 'whiteblue': '[white, blue]', 'whitered': '[white, red]'}¶
- stereomethods = {'anaglyph': 'anaglyph', 'chromadepth': 'off', 'crosseyed': 'crosseye', 'hardware': 'quadbuffer', 'interlaced': 'byrow', 'walleyed': 'walleye'}¶
- class schrodinger.utils.pymol.PymolInstance(pymol_command=('pymol',))¶
Bases:
object
Represents a remote PyMOL instance (controlled via a one-way pipe)
Acts like a proxy to the cmd module, without return values on function calls (which would actually be very usefull).
See also: PyMOL XMLRPC server (pymol -R)
- __init__(pymol_command=('pymol',))¶
- Parameters
pymol_command (list or tuple) – path to pymol executable
- get_legal_name(name)¶
Replacement for cmd.get_legal_name
- Parameters
name (str) – name candidate
- Returns
legal PyMOL object name
- Return type
str
- get_unused_name(name, alwaysnumber=1)¶
Replacement for cmd.get_unused_name, does not talk back to PyMOL but maintains it’s own set of already used names.
This is only necessary because the the pipe cannot return values.
- Parameters
name (str) – name candidate
alwaysnumber (bool) – if False, only append a number if name already exists
- Returns
unused legal PyMOL object name
- Return type
str
- sendVersionCheck()¶
Print a warning on the PyMOL log window if PyMOL version is too old.
- do(cmmd)¶
Send command to PyMOL
- Parameters
cmmd (str) – PyMOL command
- Returns
True on success and False on error
- Return type
bool
- close()¶
Quit PyMOL
- class schrodinger.utils.pymol.PymolScriptInstance(pymol_command=('pymol',))¶
Bases:
schrodinger.utils.pymol.PymolInstance
Represents a PyMOL script for deferred execution.
- close(args=('-cqk',))¶
Close file handle and execute script in PyMOL
- Parameters
args (list or tuple) – extra command line arguments for pymol
- class schrodinger.utils.pymol.VisRecord(row, idx)¶
Bases:
object
Represents a surface entry in a “vis_list” file
- Variables
name_pymol (str) – PyMOL object name
visfile (str) – filename of vis file
- class schrodinger.utils.pymol.VisRecordVol(row, idx)¶
Bases:
schrodinger.utils.pymol.VisRecord
Represents a volume entry in a “vis_list” file
Volume gets auto-loaded when accessing name_pymol.
- class schrodinger.utils.pymol.RowProxy(row, cmd)¶
Bases:
schrodinger.project.project.ProjectRow
Proxy for project table row to attach additional data.
- __init__(row, cmd)¶
- Parameters
row (
schrodinger.project.ProjectRow
) – project table rowcmd (
PymolInstance
) – PyMOL API proxy
- doGroup(name)¶
Put name in PyMOL group, if row is in a Maestro group.
- Parameters
name (str) – PyMOL object name
- schrodinger.utils.pymol.select_surf_asl(row, surf_handle, name='')¶
Make a PyMOL selection for surface ASL.
- Returns
PyMOL selection name
- class schrodinger.utils.pymol.WorkspaceIdMapper(prj_handle)¶
Bases:
object
Maps workspace atom indices to (row.index, ID)
- __init__(prj_handle)¶
- Parameters
prj_handle (
schrodinger.project.Project
) – project handle
- schrodinger.utils.pymol.get_measurement_items(key, mmprojadmin)¶
Get workspace atom ids from the measurements table. If not running from Maestro, read the .tab files from the .mmproj-admin directory.
- Parameters
key (str) – one of distance, angle or dihedral
- Return type
list(int)
- Returns
List of lists of atom ids (workspace)
- schrodinger.utils.pymol.create_selection(cmd, idmapper, atom_ids)¶
Create selection list of strings from atom ids. Like this [‘1fjs & id 345’, ‘1fjs & id 571’]
- Parameters
cmd (PymolInstance) – PyMOL API proxy
idmapper (WorkspaceIdMapper) – id mapper
atom_ids (list) – atom ids
- Returns
selection list of strings
- schrodinger.utils.pymol.get_interaction_data()¶
Get interactions data
- Returns
interactions data
- schrodinger.utils.pymol.create_interactions_group(cmd, interaction_name, object_names)¶
Create interactions group
- Parameters
cmd (PymolInstance) – PyMOL API proxy
interaction_name (string) – interaction’s name
object_names (string) – space separated string of object names which will be added to the group
- schrodinger.utils.pymol.create_pi_pi_interaction_distance(cmd, idmapper, interaction_data_list, interaction_name, color)¶
Create workspace Pi Pi interaction as a distance object in PyMOL
- Parameters
cmd (PymolInstance) – PyMOL API proxy
idmapper (WorkspaceIdMapper) – id mapper
interaction_data_list (list) – list of interactions
interaction_name (string) – interaction’s name
name (string) – rgb color
- schrodinger.utils.pymol.create_pi_cation_interaction_distance(cmd, idmapper, interaction_data_list, interaction_name, color)¶
Create workspace Pi Cation interaction as a distance object in PyMOL
- Parameters
cmd (PymolInstance) – PyMOL API proxy
idmapper (WorkspaceIdMapper) – id mapper
interaction_data_list (list) – list of interactions
interaction_name (string) – interaction’s name
name (string) – rgb color
- schrodinger.utils.pymol.create_interaction_distance(cmd, idmapper, interaction_data_list, interaction_name, color)¶
Create workspace interaction as a distance object in PyMOL
- Parameters
cmd (PymolInstance) – PyMOL API proxy
idmapper (WorkspaceIdMapper) – id mapper
interaction_data_list (list) – list of interactions
interaction_name (string) – interaction’s name
name (string) – rgb color
- schrodinger.utils.pymol.process_interactions(cmd, prj_handle)¶
Send workspace interactions to PyMOL
- Parameters
cmd (PymolInstance) – PyMOL API proxy
prj_handle (schrodinger.project.Project) – project handle
- schrodinger.utils.pymol.process_measurements(cmd, prj_handle)¶
Send workspace measurements to PyMOL
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyprj_handle (
schrodinger.project.Project
) – project handle
- schrodinger.utils.pymol.get_font_id(font_name, font_style)¶
Get the PyMOL label_font_id which best matches the given font name and style.
- Return type
int
- schrodinger.utils.pymol.process_highlights(cmd, prj_handle)¶
Send “highlights” (label+arrow annotation) to PyMOL
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyprj_handle (
schrodinger.project.Project
) – project handle
- schrodinger.utils.pymol.process_prj(cmd, prj_handle, limit='all', with_surf=True, mimic=True, include_trajectories=False)¶
Send maestro project to PyMOL. By default send everything, optional filters may apply.
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyprj_handle (
schrodinger.project.Project
) – project handlelimit (str) – all, included or selected. The latter will not send workspace items like measurements and text highlights.
with_surf (bool) – send surfaces and maps (volumes)
mimic (bool) – use PyMOL settings to match style as close as possible
include_trajectories (bool) – include trajectories
- schrodinger.utils.pymol.process_watermap(cmd: schrodinger.utils.pymol.PymolInstance, row: schrodinger.project.project.ProjectRow)¶
Process watermaps. Get watermap sites from structure and send them to PyMOL as colored spheres
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyrow (
schrodinger.project.ProjectRow
) – project table row
- schrodinger.utils.pymol.process_hypothesis(cmd, row, mae)¶
Import Phase pharmacophores as CGOs into PyMOL.
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyrow (
schrodinger.project.ProjectRow
) – project table rowmae (str) – reference mae filename
- schrodinger.utils.pymol.process_row(cmd, proj, row, limit_included=False, with_surf=True, mimic=True, include_trajectories=False)¶
Send a row from the project table to PyMOL.
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyproj (
schrodinger.project.Project
) – projectrow (
schrodinger.project.ProjectRow
) – project table rowlimit_included (bool) – limit surface export to workspace
with_surf (bool) – send surfaces
mimic (bool) – use PyMOL settings to match style as close as possible
include_trajectories (bool) – include trajectories
- schrodinger.utils.pymol.process_trajectory(cmd, proj, row, mae_file_name, mimic=True)¶
Send trajectory to PyMOL
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyproj (
schrodinger.project.Project
) – projectrow (RowProxy - proxy for project table with additional data) – project table row
mae_file_name (str) – mae file name to send to PyMOL
mimic (bool) – use PyMOL settings to match style as close as possible
- schrodinger.utils.pymol.process_surface(cmd, row, e_surf)¶
Send a surface to PyMOL
- Parameters
cmd (
PymolInstance
) – PyMOL API proxyrow (
RowProxy
) – project table rowe_surf (
schrodinger.project.EntrySurface
) – surface
- schrodinger.utils.pymol.send_maestro_settings(cmd)¶
Map Maestro settings to closest matching PyMOL settings.
- Parameters
cmd (
PymolInstance
) – PyMOL API proxy- Return type
bool
- Returns
True on success and False if Maestro is not available