Python Functions implementing User Commands

The chimerax.std_commands and chimerax.core.commands modules contain Python functions for the standard commands available from the ChimeraX command-line. Tools define additional commands noted with a (*) and their code location is described with the function descriptions.

2dlabels * - Show text labels with graphics
alias - Define aliases for commands
align - Align one set of atoms to another
bumps * - Mark cell protrusions in 3D light microscopy
cage * - Place models on polygonal cages
camera - Change camera settings
cartoon * - Display atomic structure ribbons or pipes/planks
cd - Change working directory
clip - Clip models
close - Close models
cofr - Set center of rotation method
color - Color atoms, ribbons and surfaces
coordset - Play through structure coordinate sets
crossfade - Fade between scenes for movie making
crosslinks * - Move atomic structures to minimize crosslinks
delete - Delete models
devel - For developers to package tools
device * - Enable devices such virtual reality headsets and space navigator
distance * - Show distances between atoms
echo - Write message to log
exit - Quit
fitmap - fit atomic structures in density maps
graphics - set graphics rendering parameters
help - Show documentation
hide - Hide atoms, ribbons, models
info * - Report model info
interfaces * - Make a buried area contact graph
ks * - Enable keyboard shortcuts
label * - Show text labels on atoms
lighting - Change lighting parameters
log * - Clear or save the log
material - Change surface material light reflection properties
measure - Calculate properties of models
mlp * - Color surfaces by molecular lipophilicity
molmap - Calculate a density map from atoms
morph * - Morph between atomic models
move - Move camera
movie * - Record videos
mseries * - Display a series of models
open - Open data files
perframe - Run a command for every rendered frame
pwd - Print working directory
rainbow - Color residues and chains
rename - Rename models
resfit * - Show density around residues
roll - Rotate models
run - Run a user command string
save - Save sessions, images, density maps…
select - Select objects
set - Set rendering effects (background color, silhouettes)
show - Show atoms, ribbons, models
style - Set rendering style for atoms, ribbons, models
size - Change atom, bond, pseudobond sizes
smoothlines * - Smooth paths in line drawings
split - Split atomic structures into pieces
stop - Stop motion
struts * - Add struts between atoms for 3d printing
style - Change atom display style and sizes
surface - Compute a molecular surface
sym - Show molecular assemblies involving symmetry
time - Time a command
toolshed * - Control the Tool Shed user interface
transparency - Set transparency of atoms, ribbons and surfaces
turn - Rotate models
ui * - Control tool windows and set mouse modes
view - Move camera to view specified objects
volume - Change density map settings and filter maps
vseries - Play density map time series
wait - Wait before executing next command
windowsize - Set or report graphics window size
zoom - Zoom in or out

2dlabels

Function found in chimerax.label.label2d

label_create(session, name, text='', color=None, bg_color=None, size=24, font='Arial', bold=None, italic=None, xpos=0.5, ypos=0.5, visibility=True, margin=0, outline=0)

Experimental API . Create a label at a fixed position in the graphics window.

Parameters:
  • name (string) – Identifier for the label used to change or delete label.

  • text (string) – Displayed text of the label.

  • color (Color) – Color of the label text. If no color is specified black is used on light backgrounds and white is used on dark backgrounds.

  • bg_color (Color) – Draw rectangular label background in this color. If omitted, background is transparent.

  • size (int) – Font size in points.

  • font (string) – Font name. This must be a true type font installed on Mac in /Library/Fonts and is the name of the font file without the “.ttf” suffix.

  • xpos (float) – Placement of left edge of text. Range 0 - 1 covers full width of graphics window.

  • ypos (float) – Placement of bottom edge of text. Range 0 - 1 covers full height of graphics window.

  • visibility (bool) – Whether or not to display the label.

  • margin (float) – Amount of padding to add around text

  • outline (float) – width of contrasting outline to place around background/margin

label_change(session, labels, *, text=None, color=None, bg_color=None, size=None, font=None, bold=None, italic=None, xpos=None, ypos=None, visibility=None, margin=None, outline=None, frames=None)

Experimental API . Change label parameters.

label_delete(session, labels=None)

Experimental API . Delete label.

alias

alias(session, name, text='')

Experimental API . Create command alias

Parameters:
  • name – name of the alias

  • text – optional text of the alias

If the alias name is not given, then a text list of all the aliases is shown. If alias text is not given, the text of the named alias is shown. If both arguments are given, then a new alias is made.

align

align(session, atoms, to_atoms=None, move=None, each=None, match_chain_ids=False, match_numbering=False, match_atom_names=False, sequence=None, cutoff_distance=None, report_matrix=False, log_info=True)

Experimental API . Move atoms to minimize RMSD with to_atoms. Returns matched atoms and matched to_atoms, matched atom rmsd, paired atom rmsd, and a chimerax.geometry.Place instance (i.e. the transform to place the match atoms onto the “to” atoms). The matched atoms can be fewer than the paired atoms if cutoff distance is specified. If “each” is not None then nothing is returned.

If ‘move’ is ‘structures’, superimpose the models by changing the model positions. If it is ‘atoms’, ‘residues’, ‘chains’ or ‘structure atoms’, then atoms promoted extended to this level are moved. If move is False move nothing or True move structures. If move is an Atoms collection then move only the specified atoms.

If ‘each’ is “structure” then each structure of atoms is separately aligned to the to_atoms. If ‘each’ is “chain” then each chain is aligned separately. If ‘each’ is “coordset” then each coordinate set of the first set of atoms (which must belong to a single structure) is aligned. Default is that all atoms are aligned as one group.

If ‘match_chain_ids’ is true then only atoms with matching chain identifiers are paired. Unpaired atoms or to_atoms are not used for alignment.

If ‘match_numbering’ is true then only atoms with matching residue numbers are paired. It is assumed the atoms are in residue number order. Unpaired atoms or to_atoms are not used.

If ‘match_atom_names’ is true then only atoms with matching names are paired. Unpaired atoms or to_atoms are not used for alignment.

If ‘sequence’ names a reference sequence then the previously calculated alignment of atoms and to_atoms to that reference sequence is used to pair the atoms.

If ‘report_matrix’ is True, report the transformation matrix to the Reply Log.

If ‘log_info’ is True, report RMSD and pruned atoms to the log.

bumps

bumps(session, volume, center=None, range=None, base_area=10.0, height=1.0, marker_radius=1.0, marker_color=(100, 200, 100, 255), color_surface=True, name='bumps', all_extrema=False)

Experimental API . Find protrusions on T-cells in 3d light microscopy.

Algorithm finds points on contour surface whose distance from a center point is locally maximal then extends to neighbor grid points inside the surface as long as the border area (ie protrusion base area) is less than a specified value. Protrusions of sufficient height are marked. A marker closer to the center and within another protrusion is not marked.

Parameters:
  • volume (Volume) – Map to find protrusions on. Highest surface contour level used.

  • center (Center) – Point which is the cell center for finding radial protrusions.

  • range (float or None) – How far out from center to look for protrusions.

  • base_area (float) – Area of base of protrusion. Protrusion is extended inward until this area is attained and that defines the protrusion height.

  • height (float) – Minimum height of a protrusion to be marked.

  • marker_radius (float) – Size of marker spheres to place at protrusion tips.

  • marker_color (uint8 4-tuple) – Color of markers. Default light green.

  • color_surface (bool) – Whether to color the protrusion surface near the protrusion grid points. Each protrusion is assigned a random color. Default true.

  • name (string) – Name of created marker model. Default “bumps”.

  • all_extrema (bool) – Whether to mark all radial extrema even if the don’t meet the protrusion height minimum. Markers within another protrusion are colored yellow, ones that never attain the specified protrusion base_area (often smal disconnected density blobs) are colored pink, markers on protrusions that are too short are colored blue.

cage

cage(session, cage, place_model=None, polygon_sides=6, surface_only=False, resolution=None)

Experimental API . Build polygonal cages and place molecules on faces.

Parameters:
  • cage (Structure) – Cage model.

  • place_model (Model) – Place copies of model on each n-sided polygon of cage.

  • polygon_sides (int) – Place on polygons with this number of sides.

  • surface_only (bool) – Instead of showing instances of the molecule, show instances of surfaces of each chain. The chain surfaces are computed if they do not already exist.

  • resolution (float) – Resolution for computing surfaces when surface_only is true.

camera

camera(session, type=None, field_of_view=None, eye_separation=None, pixel_eye_separation=None, convergence=None, cube_pixels=1024)

Experimental API . Change camera parameters.

Parameters:
  • type (string) – Controls type of projection, currently “mono”, “360”, “dome”, “360tb” (stereoscopic top-bottom layout), “360sbs” (stereoscopic side-by-side layout), “stereo”, “sbs” (side by side stereo), “tb” (top bottom stereo)

  • field_of_view (float) – Horizontal field of view in degrees.

  • eye_separation (float) – Distance between left/right eye cameras for stereo camera modes in scene distance units.

  • pixel_eye_separation (float) – Physical distance between viewer eyes for stereo camera modes in screen pixels. This is needed for shutter glasses stereo so that an object very far away appears has left/right eye images separated by the viewer’s physical eye spacing. Usually this need not be set and will be figured out from the pixels/inch reported by the display. But for projectors the size of the displayed image is unknown and it is necessary to set this option to get comfortable stereoscopic viewing.

  • cube_pixels (int) – Controls resolution of 360 and dome modes as the width of the cube map faces in pixels. For best appearance this value should be about as large as the window size. Default is 1024.

cartoon

cartoon(session, atoms=None, smooth=None, suppress_backbone_display=None, spine=False)

Experimental API . Display cartoon for specified residues.

Parameters:
  • atoms (Atoms) – Show ribbons for the specified residues. If no atom specifier is given then ribbons are shown for all residues. Residues that are already shown as ribbons remain shown as ribbons.

  • smooth (floating point number) – Adjustment factor for strand and helix smoothing. A factor of zero means the cartoon will pass through the atom position. A factor of one means the cartoon will pass through the “ideal” position, e.g., center of the cylinder that best fits a helix. A factor of “default” means to return to default (0.7 for strands and 0 for everything else).

  • suppress_backbone_display (boolean) – Set whether displaying a ribbon hides the sphere/ball/stick representation of backbone atoms.

  • spine (boolean) – Display ribbon “spine” (horizontal lines across center of ribbon). This parameter applies at the atomic structure level, so setting it for any residue sets it for the entire structure.

uncartoon(session, atoms=None)

Experimental API . Undisplay ribbons for specified residues.

Parameters:

atoms (Atoms) – Hide ribbons for the specified residues. If no atoms are given then all ribbons are hidden.

cd

cd(session, directory=None)

Experimental API . Change working directory.

clip

clip(session, near=None, far=None, front=None, back=None, slab=None, position=None, axis=None, coordinate_system=None, cap=None)

Experimental API . Enable or disable clip planes.

Parameters:
  • near (float or "off") – Distance to move near, far, front or back clip planes. Near and far clip planes remain perpendicular to the view direction. Front and back planes rotate with models. If a plane is not currently enabled then the offset value is from the center of rotation. Positive distances are further away, negative are closer.

  • far (float or "off") – Distance to move near, far, front or back clip planes. Near and far clip planes remain perpendicular to the view direction. Front and back planes rotate with models. If a plane is not currently enabled then the offset value is from the center of rotation. Positive distances are further away, negative are closer.

  • front (float or "off") – Distance to move near, far, front or back clip planes. Near and far clip planes remain perpendicular to the view direction. Front and back planes rotate with models. If a plane is not currently enabled then the offset value is from the center of rotation. Positive distances are further away, negative are closer.

  • back (float or "off") – Distance to move near, far, front or back clip planes. Near and far clip planes remain perpendicular to the view direction. Front and back planes rotate with models. If a plane is not currently enabled then the offset value is from the center of rotation. Positive distances are further away, negative are closer.

  • position (Center) – Plane offsets are relative to this point. If not give then offsets are relative to current plane positions. If plane is not enabled then offset is relative to center of bounding box of displayed models.

  • axis (Axis) – Normal to clip plane for planes front and back. Not used for near and far planes.

  • coordinate_system (Place) – Coordinate system for axis and position, if none then screen coordinates are used.

close

close(session, models=None)

Experimental API . Close models.

Parameters:

models (list of models) – These models and any submodels are closed. If models is none all models are closed.

cofr

cofr(session, method=None, objects=None, pivot=None, coordinate_system=None, show_pivot=None)

Experimental API . Set center of rotation method to “front center” or “fixed”. For fixed can specify the pivot point as the center of specified displayed objects, or as a 3-tuple of numbers and optionally a model whose coordinate system is used for 3-tuples.

Parameters:
  • method (string) – “front center” or “fixed” specifies how the center of rotation point is defined.

  • objects (Objects) – Set the method to “fixed” and use the center of the bounding box of these objects as the pivot point.

  • pivot (3 floats) – Set the method to “fixed” and used the specified point as center of rotation.

  • coordinate_system (Model) – The pivot argument is given in the coordinate system of this model. If this option is not specified then the pivot is in scene coordinates.

  • show_pivot (bool or 2 floats) – Whether to draw the center of rotation point in the scene as 3 colored axes. If two floats are given, they are axes length and radius of the pivot point indicator and the pivot is shown.

color

color(session, objects, color=None, what=None, target=None, transparency=None, halfbond=None, undo_name='color')

Experimental API . Color atoms, ribbons, surfaces, ….

Parameters:
  • objects (Objects) – Which objects to color.

  • color (Color) – Color can be a standard color name or “byatom”, “byelement”, “byhetero”, “bychain”, “bypolymer”, “byidentity”, “bynucleotide”, “bymodel”.

  • what ('atoms', 'cartoons', 'ribbons', 'surfaces', 'bonds', 'pseudobonds', 'labels', 'models' or None) – What to color. Everything is colored if option is not specified.

  • target (string containing letters 'a', 'b', 'c', 'p', 'r', 's', 'f', 'm') – Alternative to the “what” option for specifying what to color. Characters indicating what to color, a = atoms, c = cartoon, r = cartoon, s = surfaces, b = bonds, p = pseudobonds, f = (filled) rings, m = models Everything except labels and models is colored if no target is specified.

  • transparency (float) – Percent transparency to use. If not specified current transparency is preserved.

  • halfbond (bool) – Whether to color each half of a bond to match the connected atoms. If halfbond is false the bond is given the single color assigned to the bond.

color_cylindrical(session, surfaces, center=None, axis=None, coordinate_system=None, palette=None, range=None, transparency=None, key=False, update=True)

Experimental API . Color surfaces by distance from a cylinder axis to each surface vertex with distances mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

centerCenter

Center point for geometric coloring.

axisAxis

Axis vector for cylinder or height coloring.

coordinate_systemPlace

Transform of center and axis to scene coordinates.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

keybool

Whether to show a color key. Default false.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_electrostatic(session, surfaces, map, palette=None, range=None, key=False, offset=1.4, transparency=None, update=True)

Experimental API . Color surfaces using an interpolated electrostatic potential map value at each surface vertex with values mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

mapVolume

Color specified surfaces by sampling from this density map using palette, range, and offset options.

offsetfloat

Displacement distance along surface normals for sampling map when using map option. Default 0.

transparencyfloat

Percent transparency to use. If not specified then palette transparency values are used.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_gradient(session, surfaces, map=None, palette=None, range=None, key=False, offset=0, transparency=None, update=True)

Experimental API . Color surfaces using an map gradient norm value at each surface vertex with values mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

mapVolume

Color specified surfaces by sampling from this density map using palette, range, and offset options.

offsetfloat

Displacement distance along surface normals for sampling map when using map option. Default 0.

transparencyfloat

Percent transparency to use. If not specified then palette transparency values are used.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_height(session, surfaces, center=None, axis=None, coordinate_system=None, palette=None, range=None, transparency=None, key=False, update=True)

Experimental API . Color surfaces by distance parallel an axis to each surface vertex with distances mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

centerCenter

Center point for geometric coloring.

axisAxis

Axis vector for cylinder or height coloring.

coordinate_systemPlace

Transform of center and axis to scene coordinates.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

keybool

Whether to show a color key. Default false.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_image(session, surfaces, file=None, coords=None, write_colors=None, modulate=False)

Experimental API . Color surfaces using images read from files and specify texture coordinates that define how to map the image onto the surface.

Parameters:
  • surfaces (list of Surface) – Act on these surfaces and their child drawings.

  • file (string) – Path to image file, e.g. PNG or JPEG image. If the value is the string “none” then any texture is removed from the surface.

  • coords ("sphere", "pole", "south", "vertexcolors" or None) – Defines how to map the image axes onto the surface. “sphere” assigns texture coordinates to each surface vertex based on longitude and lattitude. The image x axis is longitude (texture coordinate u), and image y axis is lattitude (texture coordinate v). “pole” has the north pole at the middle of the image and the south pole on a circle touching the image edges. “south” is like pole only centered on the south pole. “vertexcolors” sets unique texture coordinates for each unique vertex color. The corresponding texture image can be written to a file with the write_colors argument. None means no texture coordinates are assigned and uses existing texture coordinates for the model.

  • write_colors (file name) – Write vertex color texture to the specified file name. Only used if coords is specified as “vertexcolors”. This is used to write out a texture image that could for example be used with an exported OBJ surface file that gives texture coordinates. This only works well if each distinct color is a separate disconnected surface piece. If a single connected surface has different vertex colors the blending between two different colors will be wrong in texture space because the vertex to texture coordinate mapping makes no attempt to wrap the texture coordinates onto the surface. Instead each distinct color is simply assigned a unique texture coordinate without regard to the spatial arrangement of colors on the surface.

  • modulate (bool) – Texture colors are multiplied by the surface single color or vertex colors. If the file argument is specified to define a texture and modulate is False, then the surface is set to single color white and vertex color are cleared so the true image colors are shown. If modulate is true then the single color and vertex color are left unchanged.

color_radial(session, surfaces, center=None, coordinate_system=None, palette=None, range=None, transparency=None, key=False, update=True)

Experimental API . Color surfaces by distance from a center point to each surface vertex with distances mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

centerCenter

Center point for geometric coloring.

axisAxis

Axis vector for cylinder or height coloring.

coordinate_systemPlace

Transform of center and axis to scene coordinates.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

keybool

Whether to show a color key. Default false.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_sample(session, surfaces, map, palette=None, range=None, key=False, offset=0, transparency=None, update=True, undo_state=None)

Experimental API . Color surfaces using an interpolated map value at each surface vertex with values mapped to colors by a color palette.

surfaceslist of models

Surfaces to color.

paletteColormap

Color map.

range2 comma-separated floats or “full”

Specifies the range of map values used for sampling from a palette.

mapVolume

Color specified surfaces by sampling from this density map using palette, range, and offset options.

offsetfloat

Displacement distance along surface normals for sampling map when using map option. Default 0.

transparencyfloat

Percent transparency to use. If not specified then palette transparency values are used.

updatebool

Whether to automatically update the surface coloring when the surface shape changes.

color_zone(surface, points, point_colors, distance, sharp_edges=False, far_color=None, auto_update=True)

Experimental API . Color a surface according to the nearest of specified points, with a color associated with each point. Surface vertices are colored if they are within the specified distance of some point. Surface vertices farther away are colored by far_color or retain their original color if no far_color is specified.

surfaceSurface model

Surface to color.

pointsN x 3 array of float

Point positions in scene coordinates.

point_colorsN x 4 array of uint8 RGBA values

RGBA color for each point.

distancefloat

Maximum distance of surface to point for coloring.

sharp_edgesbool

Whether to divide surface triangles so that the boundaries between surface patches near different points show sharp color transitions and the boundary curves are less jagged.

far_colorRGBA 4-tuple 0-255 range or None

Color for surface vertices further than distance from all points

auto_updatebool

Whether to automatically update the surface coloring when the surface shape changes.

coordset

coordset(session, structures, index_range, hold_steady=None, pause_frames=1, loop=1, bounce=False, compute_ss=False)

Experimental API . Change which coordinate set is shown for a structure. Can play through a range of coordinate sets.

Parameters:
  • structures (list of Structure) – List of structures to show as assemblies.

  • index_range (3-tuple with integer or None elements, or just None) – Starting, ending and step coordinate set ids. If starting id is None start with the currently shown coordinate set. If ending id is None treat it as the last coordset. If step id is None use step 1 if start < end else step -1. Otherwise coordinate set is changed from start to end incrementing by step with one step taken per graphics frame. Negative start / end ids are relative to the (one past) the last coordinate set, so -1 refers to the last coordinate set. If index_range is just None, then treated as 1,None,None.

  • hold_steady (Atoms) – Collection of atoms to hold steady while changing coordinate set. The atomic structure is repositioned to minimize change in RMSD of these atoms.

  • pause_frames (integer) – Stay at each coordset for this number of graphics frames. This is to slow down playback. Default 1.

  • loop (integer) – How many times to repeat playing through the coordinates in the specified range.

  • bounce (bool) – Whether to reverse direction instead of jumping to beginning when looping. Default false.

  • compute_ss (bool) – Whether to recompute secondary structure using dssp for every new frame. Default false.

crossfade

crossfade(session, frames=30)

Experimental API . Fade from the current view to the next drawn view. Used in movie recording.

Parameters:

frames (integer) – Linear interpolate between the current and next image over this number of frames.

delete

delete(session, atoms, attached_hyds=True)

Experimental API . Delete atoms.

Parameters:

atoms (Atoms collection) – Delete these atoms. If all atoms of a model are closed then the model is closed.

devel

devel_build(session, path, test=None, debug=False, exit=False)

Experimental API . Build a wheel in for the source code in bundle path.

Parameters:
  • path (string) – Path to folder containing bundle source code or bundle alias.

  • debug (bool) – Create a debug version.

  • exit (bool) – Exit after finishing build.

devel_install(session, path, test=None, user=None, debug=False, exit=False, no_deps=None, editable=False)

Experimental API . Build and install a wheel in for the source code in bundle path.

Parameters:
  • path (string) – Path to folder containing bundle source code or bundle alias.

  • debug (bool) – Create a debug version.

  • no_deps (bool) – Ignore dependencies when installing.

  • exit (bool) – Exit after finishing install.

devel_alias(session, name=None, path=None)

Experimental API . Define an alias for a folder for use in other “devel” commands.

Parameters:
  • name (string) – Alias for bundle path.

  • path (string) – Path to folder containing bundle source code.

devel_unalias(session, name)

Experimental API . Remove a bundle alias.

Parameters:

name (string) – Alias for bundle path.

devel_clean(session, path, exit=False)

Experimental API . Remove build files from the source code in bundle path.

Parameters:

path (string) – Path to folder containing bundle source code or bundle alias.

devel_dump(session, path)

Experimental API . Dump the bundle information for the source code in bundle path.

Parameters:

path (string) – Path to folder containing bundle source code or bundle alias.

device

device_snav(session, enable=None, fly=None, speed=None)

Experimental API . Enable or disable moving models with Space Navigator input device.

Parameters:
  • enable (bool) – Enable (true) or disable (false) use of the Space Navigator device.

  • fly (bool) – Enable flying mode where the Space Navigator motions control the camera, for example pushing forward flies the camera forward. If fly is false, then the device controls the models, pushing forward would push the models away from the camera. In both cases it is actually the camera that moves.

  • speed (float) – Controls device sensitive, how fast the models move for a given device motion. Default 1.0.

vr(session, enable=None, room_position=None, mirror=None, gui=None, center=None, click_range=None, near_clip_distance=None, far_clip_distance=None, multishadow_allowed=False, simplify_graphics=True)

Experimental API . Enable stereo viewing and head motion tracking with virtual reality headsets using SteamVR.

Parameters:
  • enable (bool) – Enable or disable use of an HTC Vive headset or Oculus Rift headset using SteamVR. The device must be connected and powered on to enable it. Graphics will not be updated in the main ChimeraX window because the different rendering rates of the headset and a conventional display will cause stuttering of the headset graphics. Also the Side View panel in the main ChimeraX window should be closed to avoid stuttering.

  • room_position (Place or "report") – Maps physical room coordinates to molecular scene coordinates. Room coordinates have origin at center of room and units are meters.

  • mirror (bool) – Controls whether VR scene is mirrored to the desktop display graphics window. Default true.

  • gui (string) – Name of a tool instance which will be shown as the VR gui panel. If not specified then the VR gui panel consists of all tools docked on the right side of the main window.

  • center (bool) – Whether to center and scale models to fit in room. This is always done the first time VR is started. If vr is turned off and the on it remembers the previous model position unless this options is specified.

  • click_range (float) – How far away hand controller tip can be when clicking an atom or object in room units (meters). Default 0.10.

  • near_clip_distance (float) – Parts of the scene closer than this distance (meters) to the eye are not shown. Default 0.10.

  • far_clip_distance (float) – Parts of the scene farther than this distance (meters) from the eye are not shown. Default 500.

  • multishadow_allowed (bool) – If this option is false and multi-shadow lighting is enabled (ambient occlusion) when vr is enabled, then lighting is switched to simple lighting. If the option is true then no changes to lighting mode are made. Often rendering is not fast enough to support multishadow lighting so this option makes sure it is off so that stuttering does not occur. Default False.

  • simplify_graphics (bool) – Adjust level-of-detail total number of triangles for atoms and bonds to a reduced value when VR is enabled, and restore to default value when VR disabled. This helps maintain full rendering speed in VR. Default true.

distance

distance(session, objects, *, color=None, dashes=None, decimal_places=None, radius=None, symbol=None, signed=False, monitor=True)

Experimental API . Show/report distance between two objects.

echo

Equivalent to the “log text” command.

exit

exit(session)

Experimental API . Quit the program.

fitmap

fitmap(session, atoms_or_map, in_map=None, subtract_maps=None, metric=None, envelope=True, zeros=False, resolution=None, shift=True, rotate=True, symmetric=False, move_whole_molecules=True, search=0, placement='sr', radius=None, cluster_angle=6, cluster_shift=3, asymmetric_unit=True, level_inside=0.1, seed=0, sequence=0, max_steps=2000, grid_step_min=0.01, grid_step_max=0.5, list_fits=None, log_fits=None, each_model=False)

Experimental API . Fit an atomic model or a map in a map using a rigid rotation and translation by locally optimizing correlation. There are four modes: 1) fit all models into map as a single rigid group, 2) fit each model into the map separately, 3) fit each model separately while subtracting others (sequence mode), or 4) use random starting positions when fitting (search mode).

Parameters:
  • atoms_or_map – Atoms or map that will be moved.

  • in_map (Volume) – Target density map to fit into.

  • subtract_maps (Objects) – Subtract these maps or maps for these atoms from the target map before fitting.

  • ----------------------------------------------------------------------------

  • Mode

  • ----------------------------------------------------------------------------

  • each_model (bool) – Whether to fit each model independently or all as one rigid group.

  • sequence (integer) – Fit each model in sequence subtracting other models first for this number of specified fits.

  • search (integer) – Fit using N randomized initial placements and cluster similar results.

  • ----------------------------------------------------------------------------

  • settings (Fitting) –

  • ----------------------------------------------------------------------------

  • metric ('overlap', 'correlation', or 'cam') – Optimization function to use. Overlap is pointwise sum. Cam is correlation about mean (ie. mean value is subtracted from maps before computing correlation).

  • envelope (bool) – Whether to consider fit only within lowest displayed contour level of moving map. If no surface exists then all grid points are used.

  • zeros (bool) – If envelope is false, then the zeros option determines whether grid points of the moving map with zero values are used in the fit. Default false. If envelope is true, this option is ignored and zeros inside the envelope are used.

  • resolution (float) – Resolution for making simulated maps from atomic models. Required when correlation or cam metric is used and atomic models are being fit.

  • shift (bool) – Allow translation when fitting.

  • rotate (bool) – Allow rotation when fitting.

  • symmetric (bool) – Whether to use symmetry of the target map to take account of clashes between copies of the fit models.

  • max_steps (integer) – Maximum number of gradient ascent steps to take

  • grid_step_max (float) – Maximum motion during a fitting step in grid index units.

  • grid_step_min (float) – The fit is considered converged when Motion less than this value (grid index units).

  • ----------------------------------------------------------------------------

  • options (Output) –

  • ----------------------------------------------------------------------------

  • placement ('sr', 's', or 'r') – Whether random placements should include shift and rotation

  • radius (float) – Limits the random placements to within this distance of the starting position.

  • cluster_angle (float) – Rotational difference for a fit to form a new cluster.

  • cluster_shift (float) – Shift difference for a fit to form a new cluster.

  • asymmetric_unit (bool) – List only one symmetrically equivalent fit position if the target map has symmetry.

  • level_inside (float) – Fraction of fit atoms or map that must be inside the target map contour level in order to keep the fit.

  • ----------------------------------------------------------------------------

  • options

  • ----------------------------------------------------------------------------

  • move_whole_molecules (bool) – Move entire molecules, or only the atoms that were specified.

  • list_fits (bool) – Show the fits in a dialog.

  • log_fits (file path) – Write tab separated values giving fit translation and rotation and metrics to a file.

graphics

graphics(session, bg_color=None, background_color=None)

Experimental API . Set graphics parameters. With no options reports the current settings.

Parameters:
  • background_color (Color) – Set the graphics window background color.

  • bg_color (Color) – Synonym for background_color.

help

help(session, topic=None, *, option=None)

Experimental API . Display help

Parameters:

topic (string) – Show documentation for the specified topic. If no topic is specified then the overview is shown. Topics that are command names can be abbreviated.

hide

hide(session, objects=None, what=None, target=None)

Experimental API . Hide specified atoms, bonds or models.

Parameters:
  • objects (Objects or None) – Atoms, bonds or models to hide. If None then all are hidden.

  • what ('atoms', 'bonds', 'pseudobonds', 'pbonds', 'cartoons', 'ribbons', 'models' or None) – What to hide. If None then ‘atoms’ if any atoms specified otherwise ‘models’.

  • target (set of "what" values, or None) – Alternative to the “what” option for specifying what to hide.

info

info(session, models=None, *, return_json=False, save_file=None)

Experimental API . Report state of models, such as whether they are displayed, color, number of children, number of instances, etc.

Parameters:
  • models – A list of models

  • return_json – Whether to return a list of JSON objects.

If return_json is True, the returned JSON will be a list of JSON objects, one per model.

Each object will have at a minimum the following key-value pairs:

Spec:

the atom specifier for this model

Name:

the name of the model

Shown:

whether the model-level display attribute is true

Num triangles:

if the model is a surface of some kind, how many triangles does it have; for non-surface models, this will be 0

Num instances:

how many graphical “instances” of the model are there, so at least 1

Num selected instances:

how many of the graphical instances are selected

For Structure (or AtomicStructure) models, there will be these additional name/value pairs:

num atoms:

the number of atoms

num_bonds:

the number of bonds

num residues:

the number of residues

chains:

a list of chain IDs for polymeric chains in the structure

num coordsets:

the number of coordinate sets in the structure

pseudobond groups:

list of JSON, one per pseudobond subgroup

Pseudobond group objects will have the following name/value pairs:

name:

name of the pseudobond group

num pseudobonds:

number of pseudobonds in the group

For global PseudobondGroup models (i.e. not a submodel of a structure), there will be this additional name/value pair:

num pseudobonds:

number of pseudobonds in the group

For Volume models, there will be additional names: size, step, voxel size, surface levels, image levels, minimum value, maximum value, value type, and num symmetry operators.

info_bounds(session, models=None, *, return_json=False, save_file=None)

Experimental API . Report bounds of displayed parts of models in scene coordinates. If not models are given the bounds for the entire scene is reported.

Parameters:

models – list of models

If ‘return_json’ is True, the JSON returned depends on if ‘models’ is None. If models is None, then the bounds of the scene is returned (null if no bounds), as a list [min, max] where min and max are 3 numbers (xyz). Otherwise, a JSON object is returned where names are model atom specifiers and values are bounds for that model (in the same form as the scene bounds).

info_models(session, atoms=None, type_=None, attribute='name', *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of JSON objects, one per model. Each object will have the following name/value pairs:

spec:

the atom specifier for this model

class:

the Python class of the model

attribute:

the attribute being tested for

present:

whether the attribute is defined in the model instance

value:

the value of the attribute. If ‘present’ is false, this will be null, which could possibly also be the value for some instances where the attribute is present.

info_chains(session, atoms=None, attribute='chain_id', *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of JSON objects, one per chain. Each object will have the following name/value pairs:

spec:

the atom specifier for this chain

sequence:

a string containing the chain sequence

residues:

a list of residue specifiers in the chain; for residues with no structure the “specifier” will be null

attribute:

the attribute being tested for

present:

whether the attribute is defined in the chain instance

value:

the value of the attribute. If ‘present’ is false, this will be null, which could possibly also be the value for some instances where the attribute is present.

info_polymers(session, atoms=None, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of lists, one per polymer. Each list will contain the atom specs that compose the polymer, in polymer order

info_residues(session, atoms=None, attribute='name', *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of JSON objects, one per residue. Each object will have the following name/value pairs:

spec:

the atom specifier for this residue

attribute:

the attribute being tested for

present:

whether the attribute is defined in the residue instance

value:

the value of the attribute. If ‘present’ is false, this will be null, which could possibly also be the value for some instances where the attribute is present.

info_selection(session, level=None, attribute=None, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will correspond to the function appropriate for the ‘level’, namely, but restricted to selected items:

atom/None info_atoms residue info_residues chain info_chains structure info_models (but only Structure/AtomicStructure models) models info_models

info_atomattr(session, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of atom attribute names.

info_atomcolor(session, atoms, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of atom attribute names.

info_bondattr(session, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of bond attribute names.

info_resattr(session, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of residue attribute names.

info_rescolor(session, residues, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a list of atom attribute names.

info_distmat(session, atoms, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a JSON object, with the following name/value pairs:

atoms:

a list of the specifiers for the atoms used when computing the distance matrix

distance matrix:

the “flattened” upper-right triangle of the distance matrix, as per http://stackoverflow.com/questions/13079563/how-does-condensed-distance-matrix-work-pdist

info_path(session, which='all', version='all', what=None, *, return_json=False, save_file=None)

Experimental API . If ‘return_json’ is True, the returned JSON will be a JSON object with one or two names (depending on the arguments given), namely “versioned” and/or “unversioned”. The value(s) will also be JSON objects with one or more names (again, depending on the args) from among: site_config_dir, site_data_dir, user_cache_dir, user_config_dir, user_data_dir, user_log_dir, and/or user_state_dir. The values will be the appropriate directory name.

interfaces

Function found in chimerax.interfaces.cmd

interfaces(session, atoms=None, probe_radius=1.4, area_cutoff=300, interface_residue_area_cutoff=15)

Experimental API . Compute buried solvent accessible surface areas between chains and show a 2-dimensional network graph depicting the contacts.

Parameters:
  • atoms (Atoms) – Which atoms to compute interfaces for.

  • probe_radius (float) – Probe radius uses for buried area calculations. Default 1.4 Angstroms.

  • area_cutoff (float) – Minimum buried area between two chains to consider them as neighbors.

  • interface_residue_area_cutoff (float) – Minimum buried area for a residue to consider it in contact.

ks

ks(session, shortcut=None)

Experimental API . Enable keyboard shortcuts. Keys typed in the graphics window will be interpreted as shortcuts.

Parameters:

shortcut (string) – Keyboard shortcut to execute. If no shortcut is specified switch to shortcut input mode.

label

Function found in chimerax.label.label3d

label(session, objects=None, object_type=None, text=None, offset=None, color=None, bg_color=None, attribute=None, size=None, height=None, default_height=None, default_model_height=None, font=None, on_top=None)

Experimental API . Create atom labels. The belong to a child model named “labels” of the structure.

Parameters:
  • objects (Objects or None) – Create labels on specified atoms, residues, pseudobonds, or bonds. If None then adjust settings of all existing labels.

  • object_type ('atoms', 'residues', 'pseudobonds', 'bonds', 'models') – What type of object to label.

  • text (string or "default") – Displayed text of the label.

  • offset (float 3-tuple or "default") – Offset of label from atom center in screen coordinates in physical units (Angstroms)

  • color ((r,g,b,a) or "auto" or "default") – Color of the label text. If no color is specified black is used on light backgrounds and white is used on dark backgrounds.

  • bg_color ((r,g,b,a) or "none") – Draw rectangular label background in this color, or if “none”, background is transparent.

  • attribute (string) – Attribute name whose value to display as text

  • size (int or "default") – Font size in points (1/72 inch). Default 48.

  • height (float or "fixed") – Text height in scene units. Or if “fixed” use fixed pixel height on screen. Initial value 0.7.

  • default_height (float) – Default height value if not specified. Initial value 0.7.

  • default_model_height (float) – Default height value for model labels. Initial value 10.0.

  • font (string or "default") – Font name. This must be a true type font installed on Mac in /Library/Fonts and is the name of the font file without the “.ttf” suffix. Default “Arial”.

  • on_top (bool) – Whether labels always appear on top of other graphics (cannot be occluded). This is a per-structure attribute. Default True.

label_delete(session, objects=None, object_type=None)

Experimental API . Delete object labels.

Parameters:
  • objects (Objects or None) – Delete labels for specified atoms, residues, pseudobonds or bonds. If None delete all labels.

  • object_type ('atoms', 'residues', 'pseudobonds', 'bonds', 'models') – What type of object label to delete.

lighting

lighting(session, preset=None, direction=None, intensity=None, color=None, fill_direction=None, fill_intensity=None, fill_color=None, ambient_intensity=None, ambient_color=None, depth_cue=None, depth_cue_start=None, depth_cue_end=None, depth_cue_color=None, move_with_camera=None, shadows=None, quality_of_shadows=None, depth_bias=None, multi_shadow=None, ms_map_size=None, ms_depth_bias=None)

Experimental API . Set lighting parameters. There are 2 directional lights, a key light and a fill light, in addition to ambient lighting. The key light can cast a shadow, and shadows cast from multiple uniformly distributed directions can produce ambient shadowing (aka “ambient occlusion”). Parameters that are not specified retain their current value. If no options are specified then the current settings are printed to the log.

Parameters:
  • preset (string) – Names a standard set of lighting parameters. Allowed values are “default”, “simple”, “full”, “soft” and “flat”. Simple is the same as default and has no shadows. Full includes direct and ambient shadows. Soft includes ambient shadows from 64 directions and no direct lighting. Flat has only anbient lighting and no shadows with silhouettes enabled. Specifying a preset only specifies some of the lighting parameters. Specifying other options overrides the preset values.

  • direction (3 floats) – Key light direction as vector. Does not have to have unit length. Points in the direction the light shines. The viewing direction is along -z. Initially is pointing down to the right (1,-1,-1).

  • intensity (float) – Key light intensity. This is a brightness scale factor. Initial value 1.

  • color (Color) – Key light color, initial value RGB = (1,1,1).

  • fill_direction (3 floats) – Fill light direction. Initially is pointing from lower left (-0.2,-0.2,-0.959).

  • fill_intensity (float) – Fill light intensity. Initial value 0.5.

  • fill_color (Color) – Fill light color, initial value RGB = (1,1,1).

  • ambient_intensity (float) – Ambient light intensity. Initial value 0.4.

  • ambient_color (Color) – Ambient color, initial value RGB = (1,1,1).

  • depth_cue (bool) – Whether to dim scene with depth.

  • depth_cue_start (float) – Fraction of distance from near to far clip plane where dimming starts. Initial value 0.5

  • depth_cue_end (float) – Fraction of distance from near to far clip plane where dimming ends. Initial value 1.

  • depth_cue_color (Color) – Color to fade towards, initial value RGB = (0,0,0).

  • move_with_camera (bool) – Whether light directions move with the camera or are fixed in scene coordinates. Initial value true.

  • shadows (bool) – Whether to show shadows. Initial value false.

  • quality_of_shadows (string or int) – Shadows are rendered with a 2 dimensional texture. Pixelated shadow edges result from using small texture sizes. Value can be “coarse” (1024), “normal” (2048), “fine” (4096), “finer” (8192), or an integer value can be specified.

  • depth_bias (float) – To avoid a surface shadowing itself due to numerical rounding errors an bias distance is used. This is a fraction of the scene diameter. Initial value 0.005.

  • multi_shadow (int) – How many directions to use for casting ambient shadows. Value 0 means no ambient shadows. The soft preset uses 64 directions. Initial value 0.

  • ms_map_size (int) – Size of one 2-dimensional texture holding all the ambient shadow maps. Small values give coarser shadows that give a smoother appearance when many shadows ar rendered. Initial value 1024.

  • ms_depth_bias (float) – Depth bias to avoid surface self shadowing for ambient shadows as a fraction of the scene diameter. Because small shadow map sizes are typically used a larger bias is needed than for directional shadows. Initial value 0.01.

log

Function found in chimerax.log.cmd

log(session, thumbnail=False, text=None, html=None, width=100, height=100, warning_dialog=None, error_dialog=None)

Experimental API . Operations on the Log window.

Parameters:
  • text (string) – Text to show in the log.

  • html (bool) – Indicate if the text is HTML text.

  • thumbnail (bool) – Place a thumbnail image of the current graphics in the log.

  • height (int) – Height in pixels of thumbnail image.

  • width (int) – Width in pixels of thumbnail image.

  • warning_dialog (bool) – If true, warnings popup a separate dialog, if false no warning dialog is shown. In either case the warning appears in the log text.

  • error_dialog (bool) – If true, errors popup a separate dialog, if false no error dialog is shown. In either case the errors appears in the log text.

material

material(session, preset=None, reflectivity=None, specular_reflectivity=None, exponent=None, ambient_reflectivity=None, transparent_cast_shadows=None, meshes_cast_shadows=None)

Experimental API . Change surface material properties controlling the reflection of light. Currently all models use the same material properties.

Parameters:
  • preset (string) – Can be “default”, “shiny”, “dull”, or “chimera”. Default sets all material properties to there default values. Shiny sets specular reflectivity to 1. Dull sets specular reflectivity to 0. Chimera sets specular reflectivity and exponent to try to emulate UCSF Chimera.

  • reflectivity (float) – Fraction of directional light reflected diffusely (reflected equally in all directions). Initial value 0.8.

  • specular_reflectivity (float) – Fraction of key light reflected specularly (mirror reflection with some spread given by exponent. Initial value 0.8.

  • exponent (float) – Controls specularly reflected light scaling intensity by a factor of cosine(x) raised to the exponent power, where x is the between the mirror reflection direction and the view direction. Larger values produce smaller specular highlight spots on surfaces. Initial value 30.

  • ambient_reflectivity (float) – Fraction of ambient light reflected. Initial value 0.8.

  • transparent_cast_shadows (bool) – Whether transparent objects cast shadows. If set to true then transparent objects cast a shadows as if the objects are opaque making everything inside appear black. Raytracing would be required to render a partial shadow, and we don’t support that. Initial value is false.

  • meshes_cast_shadows (bool) – Whether mesh style drawings cast shadows. Initial value is false.

measure

measure_buriedarea(session, atoms1, with_atoms2=None, probe_radius=1.4, list_residues=False, cutoff_area=1, color=None, select=False)

Experimental API . Compute buried solvent accessible surface (SAS) area between two sets of atoms. This is the sum of the SAS area of each set of atoms minus the SAS area of the combined sets of atoms, that difference divided by two since each set of atoms has surface at the interface, so the interface area is defined as half the buried area. Atoms not specified in either atom set are ignored when considering where the probe sphere can reach.

Parameters:
  • atoms1 (Atoms) – First set of atoms.

  • with_atoms2 (Atoms) – Second set of atoms – must be disjoint from first set.

  • probe_radius (float) – Radius of the probe sphere.

  • list_residues (bool) – Whether to report a list of contacting residues for each set of atoms.

  • cutoff_area (float) – Per-residue minimum area for listing residues.

  • color (Color or None) – Color contacting residues.

  • select (bool) – Whether to select contacting residues.

measure_convexity(session, surfaces, palette=None, range=None, key=False, smoothing_iterations=5, write_surface_data=None, patches=None)

Experimental API . Compute the convexity at each surface vertex defined as 2*pi minus the cone-angle spanned by the triangles incident at the vertex. The surface vertices are colored based on convexity value.

This definition of convexity is not standard and gives mottled coloring because the values depend strongly on the triangulation. Vertices surrounded by large triangles on a smooth surface will have sharper cone angles then vertices surrounded by small triangles. (Normalizing by vertex triangle areas does not help because the patch about a vertex is often irregular in shape.) To ameliorate this the “smoothing_iterations” option is useful.

Parameters:
  • surface (Surface list) –

  • palette (Colormap) – Default color palette is cyan-gray-maroon.

  • range (2-tuple of float or "full") – Minimum and maximum convexity values corresponding to ends of color palette.

  • key (bool) – Whether to show a color key. Default false.

  • smoothing_iterations (int) – Convexity values are averaged with neighbor vertices connected by an edge. This value specifies how many rounds of smoothing to perform. Default 5.

  • write_surface_data (string) – File path to write a text file containing surface data. One line for each surface vertex gives vertex number (starting at 0), xyz position, normal vector, and (smoothed) convexity value. Vertex lines are followed by surface triangle data, one line per triangle giving triangle number and 3 vertex numbers for the triangle corners. The vertex data and triangle data begin with comment lines starting with the “#” character. If multiple surfaces are specified the vertex/triangle data sections for each surface are appended to the file.

  • patches (float) – Instead of coloring by convexity value, color each connected patch with convexity above the specified value a unique color.

measure_length(session, bonds)

Experimental API . Compute sum of length of bonds.

measure_sasa(session, atoms=None, probe_radius=1.4, sum=None, set_attribute=True)

Experimental API . Compute solvent accessible surface area.

Parameters:
  • atoms (Atoms) – A probe sphere is rolled over these atoms ignoring collisions with any other atoms.

  • probe_radius (float) – Radius of the probe sphere.

  • sum (Atoms) – Sum the accessible areas per atom only over these atoms.

  • set_attribute (bool) – Whether to set atom.area and residue.area values.

mlp

Function found in chimerax.mlp.mlp

mlp(session, atoms=None, method='fauchere', spacing=1.0, max_distance=5.0, nexp=3.0, color=True, palette=None, range=None, transparency=None, surfaces=[], map=False, key=False)

Experimental API . Display Molecular Lipophilic Potential for a single model.

Parameters:
  • atoms (Atoms) – Color surfaces for these atoms using MLP map. Only amino acid residues are used.

  • method ('dubost','fauchere','brasseur','buckingham','type5') – Distance dependent function to use for calculation

  • spacing (float) – Grid spacing, default 1 Angstrom.

  • max_distance (float) – Maximum distance from atom to sum lipophilicity. Default 5 Angstroms.

  • nexp (float) – The buckingham method uses this numerical exponent.

  • color (bool) – Whether to color molecular surfaces. They are created if they don’t yet exist.

  • palette (Colormap) – Color palette for coloring surfaces. Default is lipophilicity colormap (orange lipophilic, blue lipophobic).

  • range (2-tuple of float) – Range of lipophilicity values defining ends of color map. Default is -20,20

  • transparency (float) – Percent transparency to use. If not specified then palette transparency values used.

  • surfaces (list of Surface models) – If the color options is true then these surfaces are colored instead of computing surfaces.

  • map (bool) – Whether to open a volume model of lipophilicity values

  • key (bool) – Whether to show a color key

molmap

molmap(session, atoms, resolution, grid_spacing=None, edge_padding=None, on_grid=None, cutoff_range=5, sigma_factor=0.22507907903927651, balls=False, symmetry=None, center=None, axis=None, coordinate_system=None, display_threshold=0.95, model_id=None, replace=True, show_dialog=True, open_model=True)

Experimental API . Create a density map by placing Gaussians centered on atoms.

Parameters:
  • atoms (Atoms) –

  • resolution (float) –

  • grid_spacing (float) – Default is 1/3 resolution.

  • edge_padding (float) – Default is 3 times resolution.

  • cutoff_range (float) – In standard deviations.

  • sigma_factor (float) – Scale factor equal to standard deviation / resolution, default 1/(pi*sqrt(2)).

  • balls (bool) – Use balls instead of Gaussians

  • symmetry (Symmetry object or None.) – Apply symmetry operations to atoms

  • center (Center object or None) – Center of symmetry.

  • axis (Axis object or None) – Axis of symmetry.

  • coordinate_system (Place) – Coordinate system of symmetry.

  • display_threshold (float) – Initial contour level as fraction of total density, default 0.95.

  • model_id (list of integers) –

  • replace (bool) – Default true

  • show_dialog (bool, not supported) –

morph

Function defined in chimerax.morph.morph

morph(session, structures, frames=50, wrap=False, rate='linear', method='corkscrew', cartesian=False, same=False, core_fraction=0.5, min_hinge_spacing=6, hide_models=True, play=True, slider=True, color_segments=False, color_core=None)

Experimental API . Morph between atomic models using Yale Morph Server algorithm.

Parameters:
  • structures (list of Structure) – Configurations to morph

  • frames (int) – Number of frames for each morph segment. One less than this value is new configurations are inserted between every pair of structures given.

  • wrap (bool) – If true then morph continues from last structure to first. This is the same as if the first structure is appended to structures to morph.

  • rate ('linear', 'ramp down', 'ramp up' or 'sinusoidal') – The rate of morphing from one state to the next.

  • method ('corkscrew', 'linear') – How hinged groups of atoms are morphed.

  • cartesian (bool) – Whether to interpolate x,y,z atom coordinates or use internal coordinates which preserve bond lengths.

  • same (bool) – Whether to match atoms with same chain id, same residue number and same atom name. Default false.

  • core_fraction (float) – Fraction of residues of each chain that align best used to define core and non-core residues which are then split into contiguous residues stretches where the chain crosses between the two residue sets. Default 0.5.

  • min_hinge_spacing (int) – Minimum number of consecutive residues when splitting chains into rigidly moving segments at boundaries between core and non-core residues. Default 6.

  • hide_models (bool) – Whether to hide the input models after morph model is created. Default true.

  • play (bool) – Whether to play the morph. Default true.

  • slider (bool) – Whether to show a slider to play through the morph. Default true.

  • color_segments (bool) – Whether to color the residues for each rigid segment with a unique color. This is to see how the morph algorithm divided the structure into segments. For morphing a sequence of 3 or more structures only the residues segments for the morph between the first two in the sequence is shown. Segments are recomputed for each consecutive pair in the sequence. Default false.

  • color_core (Color or None) – Color the core residues the specified color. This is to understand what residues the algorithm calculates to be the core.

move

move(session, axis, distance=None, frames=None, coordinate_system=None, models=None, atoms=None)

Experimental API . Shift the scene. Actually the camera is shifted and the models stay fixed unless the models option is specified in which case the model coordinate systems are moved, or if atoms is specifed the atom coordinates are moved.

Parameters:
  • axis (Axis) – Defines the axis in scene coordinates to shift along.

  • distance (float) – Distance to shift in scene units.

  • frames (integer) – Repeat the shift for N frames.

  • coordinate_system (Place) – The coordinate system for the axis. If no coordinate system is specified then scene coordinates are used.

  • models (list of Models) – Move the coordinate systems of these models. Camera is not moved.

  • atoms (Atoms) – Change the coordinates of these atoms. Camera is not moved.

movie

Functions defined in chimerax.movie.moviecmd

movie_record(session, directory=None, pattern=None, format=None, size=None, supersample=1, transparent_background=False, limit=90000)

Experimental API . Start recording a movie.

Parameters:
  • directory (string) – A temporary directory for saving image files before the movie is encoded. If a directory is specified, it must already exist – it will not be created. If no directory is specified a temporary system directory is created.

  • pattern (string) – File name including a “*” character that is substituted with the frame number when saving images.

  • format (string) – Image file format (default ppm) for saving frames. Possible values ppm, png, jpeg. ppm is fastest but takes the most disk space because it is not compressed.

  • size (2 int) – Width and height in pixels of movie.

  • supersample (int) – Amount of supersampling when saving individual image frames.

  • transparent_background (bool) – Whether to save images with transparent background. Default false. Only the PNG image format supports this. None of the movie encoding formats support transparent background so this option is only useful to get the individual PNG image frames.

  • limit (int) – Maximum number of frames to save. This is a safe guard so that the entire computer disk storage is not filled with images if a movie recording is never stopped.

movie_encode(session, output=None, format=None, quality=None, qscale=None, bitrate=None, framerate=25, round_trip=False, reset_mode='clear', wait=False, verbose=False)

Experimental API . Enode images captured with movie record command creating a movie file. This uses the standalone video encoding program ffmpeg which is included with ChimeraX.

Parameters:
  • output (list of strings) – Filenames of movie output files. By specifying multiple files, different video encoding formats can be made.

  • format (string) – Format of video file to write. If not specified, the file suffix determines the format. Use of a .mp4 file suffix and h264 format is by far the best choice. Allowed formats (file suffix) are: h264 (.mp4), mov (.mov), avi (.avi), wmv (.wmv).

  • quality (string) – Quality of video, higher quality results in larger file size. Qualities are “highest”, “higher”, “high”, “good”, “medium”, “fair”, “low”. Default “good”. This overrides the qscale and bitrate options.

  • qscale (int) – Quality scale parameter used by some video codecs. This overrides the bitrate option.

  • bitrate (int) – Target bit rate for video encoding in Kbits/second.

  • framerate (int) – Frames per second that video should playback at in a video player.

  • round_trip (bool) – If true, the images are played forward and than backward so movie ends where it began. This is used for making movies that loop without a jump between the last frame and first frame.

  • reset_mode (string) – Whether to keep or delete the image files that were captured after the video files is made. Values are “clear”, “keep” or “none”. Default “clear” means the image files are deleted.

  • wait (bool) – Whether to wait until movie encoding is finished before the command returns. Default false means the command can return before the video encoding is complete.

movie_crossfade(session, frames=25)

Experimental API . Linear interpolate between the current graphics image and the next image over a specified number of frames.

movie_duplicate(session, frames=25)

Experimental API . Repeat the current image frame a specified number of frames so that the video does not change during playback.

movie_stop(session)

Experimental API . Stop recording video frames. Using the movie encode command also stops recording.

movie_abort(session)

Experimental API . Stop movie recording and delete any recorded frames.

movie_reset(session, reset_mode='clear')

Experimental API . Clear images saved with movie record.

movie_ignore(session, ignore=True)

Experimental API . Ignore subsequent movie commands except for the movie ignore command. This can be used to run a movie recording script without recording the movie.

movie_status(session)

Experimental API . Report recording status such as number of frames saved to the log.

movie_formats(session)

Experimental API . Report the available video formats to the log.

mseries

mseries(session, models, pause_frames=10, loop=1, step=1)

Experimental API . Display series of models one after another.

Parameters:
  • models (list of Model) – Sequence of models to show.

  • pause_frames (int) – Number of frames to show each model. Default 10.

  • loop (integer) – How many times to repeat playing through the models. Default 1.

  • step (integer) – Show every Nth model with N given by step, default 1.

mseries_slider(session, models, pause_frames=10, step=1, movie_framerate=25, title=None, name='Model')

Experimental API . Show slider to play through (i.e. display) a series of models.

Parameters:
  • models (list of Model) – Sequence of models to show.

  • pause_frames (int) – Number of frames to show each model. Default 10.

  • step (integer) – Show every Nth model with N given by step, default 1.

  • movie_framerate (float) – Frames per second used when playing back a movie recorded with the record button.

  • title (string) – Title shown at the top of the slider pane.

open

Function defined in chimerax.open_command.manager and called via session.open_command.open_data(…)

class OpenManager(session, name)

Manager for open command

open_data(path, *, in_file_history=False, **kw)

Experimental API . Given a file path and possibly format-specific keywords, return a (models, status message) tuple. The models will not have been opened in the session.

The format name can be provided with the ‘format’ keyword if the filename suffix of the path does not correspond to those for the desired format.

Since open_data() cannot know if you intend to add the returned models to the session later, by default it does not put them in the file history. If you do intend to add them to the session and want them in the file history then specify in_file_history=True.

The fact that the models have not been opened in the session can be an advantage if the models are essentially temporary or if you need to make modifications to the models before adding them to the session. In the former case, you will have to explicitly destroy the models after you are done with them by calling their destroy() method. You add models to a session by calling session.models.add(models).

perframe

perframe(session, command, frames=None, interval=1, format=None, zero_pad_width=None, ranges=None, show_commands=False)

Experimental API . Execute specified command each frame, typically used during movie recording.

Parameters:
  • command (string) – The command to be run each frame, optionally containing “$1” which will be replaced by the frame number starting at 0.

  • frames (int) – Number of frames to execute the specified command.

  • interval (int) – Run the command only every Kth frame.

  • format (string) – Printf style format (e.g. %d, %.3f) for substituting value in for $1.

  • zero_pad_width (int) – Field width in characters used when substituting $1 left padded with zeros.

  • ranges (list of tuples of 2 or 3 int) – start,end[,step] integer or float range of values to substitute for $1 instead of frame number.

  • show_commands (bool) – Whether to echo commands to log.

pwd

pwd(session)

Experimental API . Report the current directory to the log.

rainbow

rainbow(session, objects, level='residues', target=None, transparency=None, palette=None)

Experimental API . Color residues or chains by sequence using a color map. Arguments are the same as for the color command.

rename

rename(session, models, name=None, id=None)

Experimental API . Rename a model. Might extend this command in the future to rename chains, residues, atoms…

Parameters:
  • models (list of models) –

  • name (string) –

  • id (tuple of integers) –

resfit

resfit(session, atoms, map=None, residue_range=(-2, 1), motion_frames=50, pause_frames=50, movie_framerate=2)

Experimental API . Display fit of each residue in a density map.

Parameters:
  • atoms (Atoms) – Atoms from one chain or part of a chain.

  • map (Volume) – Density map to show near each residue.

roll

roll(session, axis=<chimerax.core.commands.Axis object>, angle=1, frames='forever', rock=None, wobble=None, wobble_aspect=0.3, center=None, coordinate_system=None, models=None, atoms=None)

Experimental API . Rotate the scene. Same as the turn command with infinite frames argument and angle step 1 degree.

Parameters:
  • axis (Axis) – Defines the axis to rotate about.

  • angle (float) – Rotation angle in degrees.

  • frames (integer) – Repeat the rotation for N frames, typically used in recording movies.

  • rock (integer) – Repeat the rotation reversing the direction every N/2 frames. The first reversal occurs at N/4 frames so that the rocking motion is centered at the current orientation.

  • wobble (integer) – Like rock only move in a figure 8 pattern.

  • wobble_aspect (float) – Ratio of wobble angle amplitude to rocking angle amplitude. Default 0.3.

  • center (Center) – Specifies the center of rotation. If not specified, then the current center of rotation is used.

  • coordinate_system (Place) – The coordinate system for the axis and optional center point. If no coordinate system is specified then scene coordinates are used.

  • models (list of Models) – Move the coordinate systems of these models. Camera is not moved.

  • atoms (Atoms) – Change the coordinates of these atoms. Camera is not moved.

run

run(session, text, *, log=True, downgrade_errors=False, return_json=False, return_list=False)

Experimental API . execute a textual command

Parameters:
  • text (string) – The text of the command to execute.

  • log (bool) – Print the command text to the reply log.

  • downgrade_errors (bool) – True if errors in the command should be logged as informational.

  • return_json (bool) – If True, underlying commands that themselves support a ‘return_json’ keyword should return a JSONResult object.

  • return_list (bool) – True if a list should be returned even if only one command is executed

save

Function defined in chimerax.save_command.manager and called via session.save_command.save_data(…)

class SaveManager(session, name)

Manager for save command

save_data(path, **kw)

Experimental API . Given a file path and possibly format-specific keywords, save a data file based on the current session.

The format name can be provided with the ‘format’ keyword if the filename suffix of the path does not correspond to those for the desired format.

select

select(session, objects=None, residues=False, minimum_length=None, maximum_length=None, sequence=None)

Experimental API . Select specified objects.

Parameters:
  • objects (Objects) – Replace the current selection with the specified objects (typically atoms). If no objects are specified then everything is selected.

  • residues (bool) – Extend atoms that are selected to containing residues if true (default false).

  • minimum_length (float or None) – Exclude pseudobonds shorter than the specified length. If this option is specified all non-pseudobond objects are also excluded.

  • maximum_length (float or None) – Exclude pseudobonds longer than the specified length. If this option is specified all non-pseudobond objects are also excluded.

  • sequence (string or None) – Regular expression of sequence to match. Will be automatically upcased.

set

set(session, bg_color=None, silhouettes=None, silhouette_width=None, silhouette_color=None, silhouette_depth_jump=None, selection_color=None, selection_width=None, subdivision=None, max_frame_rate=None)

Experimental API . Set global parameters. With no options reports the current settings.

Parameters:
  • bg_color (Color) – Set the graphics window background color.

  • silhouettes (bool) – Enable or disable silhouette edges (black lines drawn at boundaries of objects where the depth of the scene jumps.

  • silhouette_width (float) – Width in pixels of silhouette edges. Minimum width is 1 pixel.

  • silhouette_color (Color) – Color of silhouette edges.

  • silhouette_depth_jump (float) – Fraction of scene depth giving minimum depth change to draw a silhouette edge. Default 0.03.

  • selection_color (Color) – Color to use when outlining selected objects. Initially green.

  • selection_width (float) – Width in pixels of the selection outline. Initially 1 (or 2 for high DPI screens).

  • subdivision (float) – Controls the rendering quality of spheres and cylinders for drawing atoms and bonds. Default value is 1, higher values give smoother spheres and cylinders.

  • max_frame_rate (float) – Maximum frames per second to render graphics. The default frame rate is 60 frames per second. A slower rate is sometimes useful when making movies to preview at the slower movie playback rate.

show

show(session, objects=None, what=None, target=None, only=False)

Experimental API . Show specified atoms, bonds or models.

Parameters:
  • objects (Objects or None) – Atoms, bonds or models to show. If None then all are shown. Objects that are already shown remain shown.

  • what ('atoms', 'bonds', 'pseudobonds', 'pbonds', 'cartoons', 'ribbons', 'surfaces', 'models' or None) – What to show. If None then ‘atoms’ if any atoms specified otherwise ‘models’.

  • target (set of "what" values, or None) – Alternative to the “what” option for specifying what to show.

  • only (bool) – Show only the specified atoms/bonds/residues in each specified molecule. If what is models then hide models that are not specified.

size

size(session, objects=None, atom_radius=None, stick_radius=None, pseudobond_radius=None, ball_scale=None, verbose=True)

Experimental API . Set the sizes of atom and bonds.

Parameters:
  • objects (Objects) – Change the size of these atoms, bonds and pseudobonds. If not specified then all are changed.

  • atom_radius (float, (bool, float) or "default") – New radius value for atoms. The optional boolean is whether the float is a delta.

  • stick_radius (float or (bool, float)) – New radius value for bonds shown in stick style. The optional boolean is whether the float is a delta.

  • pseudobond_radius (float or (bool, float)) – New radius value for pseudobonds. The optional boolean is whether the float is a delta.

  • ball_scale (float or (bool, float)) – Multiplier times atom radius for determining atom size in ball style (default 0.3). The optional boolean is whether the float is a delta.

smoothlines

smoothlines(session, models, step_factor=0.1, iterations=10, replace=False)

Experimental API . Smooth surface models consisting of lines. Each vertex is moved the fraction step_factor towards the average position of it and its connected neighbors. This is repeated for the specified number of iterations. A new model is created unless the replace option is given in which case the current model is changed.

Parameters:
  • models (list Surface) – The surfaces must consist of line segments.

  • step_factor (float) – Fraction of distance to move each vertex toward average of itself and connected neighbors. Default 0.1

  • iterations (integer) – Number of times to repeat smoothing. Default 10.

  • replace (bool) – Whether to replace the lines in the existing model, or make a new model.

split

split(session, structures=None, chains=None, ligands=False, connected=False, atoms=None)

Experimental API . Partition atoms into separate structures. If only the first argument is given then those structures are split into a separate structure for each chain. If chains, ligands, connected, or atoms keywords are given then additional partitioning into smaller subsets is performed.

Parameters:
  • Structures (Structures or None) – Structures to split. If no structures specified then all are used.

  • chains (bool) – Split each chain into into a separate atomic structure.

  • ligands (bool) – Split each connected ligand into a separate atomic structure.

  • connected (bool) – Split each connected subset of atoms into a separate atomic structure.

  • atoms (list of Atoms) – Split specified atoms into separate atomic structures. This option can be specified multiple times.

stop

stop(session)

Experimental API . Stop a motion initiated with turn, roll or move with the frames argument.

struts

struts(session, atoms, length=7.0, loop=30.0, radius=0.6, color=None, fatten_ribbon=True, replace=True, name=None, model_id=None)

Experimental API . Create fake bonds between atoms of a structure in order to strengthen it for 3d printing.

Parameters:
  • atoms (Atoms) – Set of atoms to use as strut end-points.

  • length (float) – The maximum length of a strut. Default 7.0.

  • loop (float) – Add struts between atoms when their through-bond distance from each other is greater than this loop distance. Default 30.

  • radius (float) – Radius for drawing the strut cylinders. Default 0.6.

  • color (Color) – Make the struts this color. Default gray.

  • fatten_ribbon (bool) – Increase ribbon thickness to make it stronger for printing. Default true.

  • replace (bool) – Whether to replace or keep previously calculated struts.

  • name (string) – Name for the strut model.

  • model_id (tuple of integers) – Model id number for strut model.

struts_delete(session, atoms=None, reset_ribbon=True)

Experimental API . Delete struts between the specified atoms.

style

style(session, objects=None, atom_style=None, dashes=None, ring_fill=None)

Experimental API . Set the atom and bond display styles.

Parameters:
  • objects (Objects) – Change the style of these atoms, bonds and pseudobonds. If not specified then all atoms are changed.

  • atom_style ("sphere", "ball" or "stick") – Controls how atoms and bonds are depicted.

  • dashes (int) – Optional number of dashes shown for pseudobonds.

  • ring_fill (Optional "thick", "thin", or "off".) –

surface

surface(session, atoms=None, enclose=None, include=None, probe_radius=None, grid_spacing=None, resolution=None, level=None, color=None, transparency=None, visible_patches=None, sharp_boundaries=None, nthread=None, replace=True, update=True)

Experimental API . Compute and display solvent excluded molecular surfaces.

Parameters:
  • atoms (Atoms) – Atoms controlling which surface patch is shown. Surfaces are computed for each chain these atoms belong to and patches of these surfaces near the specifed atoms are shown. Solvent, ligands and ions are excluded from each chain surface.

  • enclose (Atoms) – Make a surface enclosing exactly these specified atoms excluding solvent, ligands and ions

  • include (Atoms) – Solvent, ligands or ions to include in the surface.

  • probe_radius (float) – Radius of probe sphere rolled over atoms to produce surface. Only used for solvent excluded surfaces. Default is 1.4 Angstroms.

  • grid_spacing (float) – Surface is computed on 3-dimensional grid with this spacing between grid points along each axis.

  • resolution (float) – Specifying a resolution value (Angstroms) causes the surface calculation to use a contour surface of a 3-d grid of a sum of Gaussians one centered at each atom instead of a solvent excluded surface. See the molmap command for details. A resolution of 0 computes an SES surface.

  • level (float) – Contour level for Gaussian surface in atomic number units. Each Gaussian has height scaled by the atom atomic number.

  • color (Color) – Colors surfaces using this color.

  • transparency (float) – Percentage transparency for surfaces.

  • visible_patches (int) – Maximum number of connected surface pieces per chain to show.

  • sharp_boundaries (bool) – Make the surface triangulation have edges exactly between atoms so per-atom surface colors and surface patches have smoother edges.

  • nthread (int) – Number of CPU threads to use in computing surfaces.

  • replace (bool) – Whether to replace an existing surface for the same atoms or make a copy.

  • update (bool) – Whether to automatically recompute the surface when atom positions change. Default True.

surface_close(session, objects=None)

Experimental API . Close molecular surfaces.

Parameters:

objects (Objects) – Close specified molecular surfaces and surfaces for specified atoms.

surface_hide_patches(session, objects=None)

Experimental API . Hide patches of existing surfaces for specified atoms.

Parameters:

objects (Objects) – Hide atom patches for specified molecular surfaces or for specified atoms.

surface_show_patches(session, objects=None)

Experimental API . Show surface patches for atoms of existing surfaces.

Parameters:

objects (Objects) – Show atom patches for existing specified molecular surfaces or for specified atoms.

surface_style(session, surfaces, style)

Experimental API . Show surface patches for atoms of existing surfaces.

Parameters:
  • surfaces (Model list) –

  • style ("mesh", "dot" or "solid") –

surface_cap(session, enable=None, offset=None, subdivision=None, mesh=None)

Experimental API . Control whether clipping shows surface caps covering the hole produced by the clip plane.

Parameters:
  • enable (bool) – Caps are current enabled or disabled for all models, not on a per-model basis.

  • offset (float) – Offset of clipping cap from plane in physical units. Some positive offset is needed or the clip plane hides the cap. Default 0.01.

  • subdivision (float) – How small to make the triangles that compose the cap. Smaller triangles give finer appearance with per-vertex coloring. Default 1.0. Value of 0 means no subdivision and the triangles are long and skinny with one triangle spanning from edge to edge of the cap. Higher values give smaller triangles, for example a value of 2 gives triangles twice as small a value of 1. A value of 1 makes triangles with edges that are about the length of the edge lengths on the perimeter of the cap which are usually comparable to the size of the triangles of the surface that is being clipped.

  • mesh (bool) – Whether mesh style surfaces show caps. Default False.

surface_dust(session, surfaces, metric='size', size=5, update=True)

Experimental API . Hide connected surface patchs smaller than a specified size.

Parameters:
  • surfaces (Models list) – Surface models to act on.

  • metric (One of 'size', 'area', 'volume', 'size rank', 'area rank', 'volume rank') – Use this size metric. Rank metrics hide patches smaller than the N largest.

  • size (float) – Hide patches smaller than this size.

  • update (bool) – Whether to update dust hiding when surface shape changes.

surface_undust(session, surfaces)

Experimental API . Redisplay the entire surface on which surface_dust() was used.

surface_zone(session, surfaces, near_atoms=None, distance=2, max_components=None, bond_point_spacing=None, update=True)

Experimental API . Hide parts of a surface beyond a given distance from specified atoms.

Parameters:
  • surfaces (Model list) – Surface models to act on.

  • near_atoms (Atoms) – Display only surface triangles that have all vertices within a specified distance of at least one of these atoms.

  • distance (float) – Maximum distance from atoms.

  • max_components (integer) – Show at most this number of connected surface patches, hiding the smaller ones. The limit applies for each surface model.

  • bond_point_spacing (float) – Include points along bonds between the given atoms at this spacing.

  • update (bool) – Whether to recompute the zone when the surface geometry changes.

surface_unzone(session, surfaces)

Experimental API . Redisplay the entire surface on which surface_zone() was used.

sym

sym(session, structures, symmetry=None, center=None, axis=None, coordinate_system=None, contact=None, range=None, assembly=None, copies=None, new_model=None, surface_only=False, resolution=None, grid_spacing=None, add_mmcif_assembly=False)

Experimental API . Show molecular assemblies of molecular models defined in mmCIF files. These can be subassemblies or symmetrical copies with individual chains placed according to matrices specified in the mmCIF file.

Parameters:
  • structures (list of AtomicStructure) – List of structures to show as assemblies.

  • symmetry (cli.Symmetry) – Desired symmetry to display

  • center (cli.Center) – Center of symmetry. Default 0,0,0.

  • axis (Axis) – Axis of symmetry. Default z.

  • coordinate_system (Place) – Transform mapping coordinates for center and axis arguments to scene coordinates.

  • contact (float) – Only include copies where some atom in the copy is within the contact distance of the original structures. Only used when the symmetry option is specified.

  • range (float) – Only include copies where center of the bounding box of the copy is within range of the center of the original structures. Only used when the symmetry option is specified.

  • assembly (string) – The name of assembly in the mmCIF file. If this parameter is None then the names of available assemblies are printed in log.

  • copies (bool) – Whether to make copies of the molecule chains. If copies are not made then graphical instances of the original molecule are used. Copies are needed to give different colors or styles to each copy. When copies are made a new model with submodels for each copy are created. The default is copies true for multimers with 12 or fewer copies and false for larger multimers.

  • new_model (bool) – Copy the structure to create the assembly. Default is True if an assembly is specified and false if the symmetry option is given. If the copies option is true then new_model is automatically true. If copies is false and new_model is true then one copy of the structure for each set of position matrices is used, and additional copies use graphical instances. If copies is false and new_model is false then instances of the original structure is used. If there is more than one set of position matrices, then copies are required and an error message is given.

  • surface_only (bool) – Instead of showing instances of the molecule, show instances of surfaces of each chain. The chain surfaces are computed if they do not already exist. It is an error to request surfaces only and to request copies.

  • resolution (float) – Resolution for computing surfaces when surface_only is true.

  • grid_spacing (float) – Grid spacing for computing surfaces when surface_only is true.

  • add_mmcif_assembly (bool) – Whether to add mmCIF metadata defining this assembly

time

time(session, command)

Experimental API . Time a command.

toolshed

toolshed_list(session, bundle_type='installed', full=False, outdated=False, newest=True)

Experimental API . List installed bundles in the log.

Parameters:

bundle_type (string) – Types are “installed”, “available”, or “all”

toolshed_reload(session, reload_type='installed')

Experimental API . Rebuild the bundle metadata cache using information from currently installed bundle.

toolshed_install(session, bundle_names, user_only=True, reinstall=None, version=None, no_deps=None)

Experimental API . Install a bundle.

Parameters:
  • bundle_names (sequence of bundle name or wheel filename) –

  • user_only (bool) – Install for this user only, or install for all users.

  • no_deps (bool) – Don’t install any dependencies.

  • version (string) –

toolshed_uninstall(session, bundle_names, force_remove=False)

Experimental API . Uninstall an installed bundle.

Parameters:
  • bundle_names (sequence of bundle names) –

  • force_remove (boolean) –

toolshed_url(session, url=None, wait=False)

Experimental API . Show or set toolshed URL

Parameters:

url (string) –

transparency

transparency(session, objects, percent, what=None, target=None)

Experimental API . Set transparency of atoms, ribbons, surfaces, ….

Parameters:
  • objects (Objects or None) – Which objects to set transparency.

  • percent (float) – Percent transparent from 0 completely opaque, to 100 completely transparent.

  • target (string) – Characters indicating what to make transparent: a = atoms, b = bonds, p = pseudobonds, c = cartoon, r = cartoon, s = surfaces, A = all

turn

turn(session, axis=<chimerax.core.commands.Axis object>, angle=90, frames=None, rock=None, wobble=None, wobble_aspect=0.3, center=None, coordinate_system=None, models=None, atoms=None)

Experimental API . Rotate the scene. Actually the camera is rotated about the scene center of rotation unless the models argument is specified in which case the model coordinate systems are moved, or if atoms is specifed the atom coordinates are moved.

Parameters:
  • axis (Axis) – Defines the axis to rotate about.

  • angle (float) – Rotation angle about axis in degrees.

  • frames ("forever" or an integer) – Repeat the rotation for N frames, typically used in recording movies.

  • rock (integer) – Rotate +/- angle/2 degrees repeating, one cycle every specified number of frames. The rocking steps are small at the ends of the rock, using sine modulation. If the frames option is not given the rocking continues until the stop command is run.

  • wobble (integer) – Like rock only move in a figure 8 pattern.

  • wobble_aspect (float) – Ratio of wobble angle amplitude to rocking angle amplitude. Default 0.3.

  • center (Center) – Specifies the center of rotation. If not specified, then the current center of rotation is used.

  • coordinate_system (Place) – The coordinate system for the axis and optional center point. If no coordinate system is specified then scene coordinates are used.

  • models (list of Models) – Move the coordinate systems of these models. Camera is not moved.

  • atoms (Atoms) – Change the coordinates of these atoms. Camera is not moved.

ui

ui_autostart(session, do_start, tool_name)

Experimental API . Control whether a tool is launched at ChimeraX startup

ui_dockable(session, dockable, tool_name)

Experimental API . Control whether a tool’s windows are dockable

mousemode(session, left_mode=None, middle_mode=None, right_mode=None, wheel_mode=None, pause_mode=None, alt=None, command=None, control=None, shift=None)

Experimental API . Set or list mouse modes. If no options given lists mouse modes.

Parameters:
  • left_mode (mode) – Bind the left mouse button to mouse mode.

  • middle_mode (mode) – Bind the middle mouse button to mouse mode.

  • right_mode (mode) – Bind the right mouse button to mouse mode.

  • wheel_mode (mode) – Bind the mouse wheel to mouse mode.

  • pause_mode (mode) – Bind mouse hover to mouse mode.

ui_tool_show(session, tool_name, _show=True)

Experimental API . Show a tool, or start one if none is running.

Parameters:

tool_name (string) –

ui_tool_hide(session, tool_name, _show=True)

Experimental API . Hide tool.

Parameters:

tool_name (string) –

view

view(session, objects=None, frames=None, clip=True, cofr=True, orient=False, zalign=None, in_front_of=None, pad=0.05, need_undo=True)

Experimental API . Move camera so the displayed models fill the graphics window. Also camera and model positions can be saved and restored. Adjust camera to view all models if objects is None.

Parameters:
  • objects (Objects) – Move camera so the bounding box of specified objects fills the window.

  • frames (int) – Interpolate to the desired view over the specified number of frames.

  • clip (bool) – Turn on clip planes in front and behind objects.

  • cofr (bool) – Set center of rotation to center of objects.

  • orient (bool) – Specifying the orient keyword moves the camera view point to look down the scene z axis with the x-axis horizontal and y-axis vertical.

  • zalign (Objects) – Rotate view point so two specified atoms are aligned along the view axis with the first atom in front. Exactly two atoms must be specified. Alternatively an AxisModel or a PlaneModel can be specified, in which case the axis or plane normal will be aligned.

  • in_front_of (Atoms) – Used only with zalign option. If specified the geometric center of the zalign atoms and the geometric center of the in_front_of atoms are aligned perpendicular to the screen.

  • pad (float) – When making objects fit in window use a window size reduced by this fraction. Default value is 0.05. Pad is ignored when restoring named views.

  • need_undo (bool) – Whether to create undo action

view_delete(session, name)

Experimental API . Delete named saved view.

Parameters:

name (string) – Name of the view. “all” deletes all named views.

view_initial(session, models=None)

Experimental API . Set models to initial positions.

Parameters:

models (Models) – Set model positions to no rotation, no shift.

view_list(session)

Experimental API . Print the named camera views in the log.

The names are links and clicking them show the corresponding view.

view_matrix(session, camera=None, models=None, coordinate_system=None)

Experimental API . Set model and camera positions. With no options positions are reported for the camera and all models. Positions are specified as 12-numbers, the rows of a 3-row, 4-column matrix where the first 3 columns are a rotation matrix and the last column is a translation applied after the rotation.

Parameters:
  • camera (Place) – Set the camera position.

  • models (list of (Model, Place)) – Set model positions.

  • coordinate_system (Place) – Treat camera and model positions relative to this coordinate system. If none, then positions are in scene coordinates.

view_name(session, name)

Experimental API . Save current view as given name.

Parameters:

name (string) – Name the current camera view and model positions so they can be shown later with the “show” option.

volume

volume(session, volumes=None, style=None, change=None, show=None, hide=None, toggle=None, close=None, level=None, rms_level=None, sd_level=None, enclose_volume=None, fast_enclose_volume=None, color=None, brightness=None, transparency=None, appearance=None, name_appearance=None, name_forget=None, step=None, region=None, name_region=None, expand_single_plane=None, origin=None, origin_index=None, voxel_size=None, planes=None, dump_header=None, pickable=None, symmetry=None, center=None, center_index=None, axis=None, coordinate_system=None, data_cache_size=None, show_on_open=None, voxel_limit_for_open=None, show_plane=None, voxel_limit_for_plane=None, initial_colors=None, show_outline_box=None, outline_box_rgb=None, outline_box_linewidth=None, limit_voxel_count=None, voxel_limit=None, color_mode=None, colormap_on_gpu=None, colormap_size=None, colormap_extend_left=None, colormap_extend_right=None, backing_color=None, blend_on_gpu=None, projection_mode=None, plane_spacing=None, full_region_on_gpu=None, bt_correction=None, minimal_texture_memory=None, maximum_intensity_projection=None, linear_interpolation=None, dim_transparency=None, dim_transparent_voxels=None, line_thickness=None, smooth_lines=None, mesh_lighting=None, two_sided_lighting=None, flip_normals=None, subdivide_surface=None, subdivision_levels=None, surface_smoothing=None, smoothing_iterations=None, smoothing_factor=None, square_mesh=None, cap_faces=None, box_faces=None, orthoplanes=None, position_planes=None, tilted_slab=None, tilted_slab_axis=None, tilted_slab_spacing=None, tilted_slab_offset=None, tilted_slab_plane_count=None, image_mode=None, calculate_surfaces=None)

Experimental API . Control the display of density maps.

Parameters:
  • volumes – list of maps

  • style – “surface”, “mesh”, or “image”

  • change – “surface” or “image” Determines if level, color, brightness, transparency options apply to surface style or image style. If this option is not specified then the currently shown style is used.

  • show – bool

  • hide – bool

  • toggle – bool

  • close – “surface” or “image”

  • level – sequence of 1 or 2 floats In image style 2 floats are used the first being a density level and second 0-1 brightness value.

  • enclose_volume – float

  • fast_enclose_volume – float

  • color – Color

  • brightness – float

  • transparency – float

  • step – sequence of 3 integers

  • region – sequence of 6 integers 3 minimum grid indices and 3 maximum grid indices for x,y,z axes.

  • name_region – string

  • expand_single_plane – bool

  • origin – sequence of 3 floats

  • origin_index – sequence of 3 floats

  • voxel_size – sequence of 3 floats

  • planes – tuple of (axis, start, end, increment, depth), last 3 are optional

Symmetry assignment options

Parameters:
  • symmetry – string

  • center – string Parsed as 3 comma-separated floats, or an atom specifier

  • center_index – sequence of 3 floats

  • axis – sequence of 3 floats

  • coordinate_system – Place Coordinate system for axis and center symmetry options

Global options

Parameters:
  • data_cache_size – float In Mbytes

  • show_on_open – bool

  • voxel_limit_for_open – float

  • show_plane – bool

  • voxel_limit_for_plane – float

Rendering options

Parameters:
  • show_outline_box – bool

  • outline_box_rgb – Color

  • outline_box_linewidth – float

  • limit_voxel_count – bool Auto-adjust step size.

  • voxel_limit – float (Mvoxels)

  • color_mode – string Image rendering pixel formats: ‘auto4’, ‘auto8’, ‘auto12’, ‘auto16’, ‘opaque4’, ‘opaque8’, ‘opaque12’, ‘opaque16’, ‘rgba4’, ‘rgba8’, ‘rgba12’, ‘rgba16’, ‘rgb4’, ‘rgb8’, ‘rgb12’, ‘rgb16’, ‘la4’, ‘la8’, ‘la12’, ‘la16’, ‘l4’, ‘l8’, ‘l12’, ‘l16’

  • colormap_on_gpu – bool Whether colormapping is done on gpu or cpu for image rendering.

  • colormap_size – integer Size of colormap to use for image rendering.

  • backing_color – Color or None Draw this color behind transparent image data if different from the background color.

  • blend_on_gpu – bool Whether image blending is done on gpu or cpu.

  • projection_mode – string One of ‘auto’, ‘2d-xyz’, ‘2d-x’, ‘2d-y’, ‘2d-z’, ‘3d’

  • plane_spacing – “min”, “max”, “mean” or float Spacing between planes when using 3d projection mode. “min”, “max”, “mean” use minimum, maximum or average grid spacing along x,y,z axes.

  • full_region_on_gpu – bool Whether to cache data on GPU for fast cropping.

  • bt_correction – bool Brightness and transparency view angle correction for image rendering mode.

  • minimal_texture_memory – bool Reduce graphics memory use for image rendering at the expense of rendering speed.

  • maximum_intensity_projection – bool

  • linear_interpolation – bool Interpolate gray levels in image style rendering.

  • dim_transparency – bool Makes transparent surfaces dimmer

  • dim_transparent_voxels – bool For image rendering.

  • line_thickness – float

  • smooth_lines – bool

  • mesh_lighting – bool

  • two_sided_lighting – bool

  • flip_normals – bool

  • subdivide_surface – bool

  • subdivision_levels – integer

  • surface_smoothing – bool

  • smoothing_iterations – integer

  • smoothing_factor – float

  • square_mesh – bool

  • cap_faces – bool

  • box_faces – bool

  • orthoplanes – One of ‘xyz’, ‘xy’, ‘xz’, ‘yz’, ‘off’

  • position_planes – sequence of 3 integers Intersection grid point of orthoplanes display

  • tilted_slab – bool

  • tilted_slab_axis – sequence of 3 floats

  • tilted_slab_offset – float

  • tilted_slab_spacing – float

  • tilted_slab_plane_count – int

  • image_mode – ‘full region’, ‘orthoplanes’, ‘box faces’, or ‘tilted slab’

  • calculate_surfaces – bool Whether to calculate surfaces immediately instead of waiting until they are drawn.

volume_add(session, volumes, on_grid=None, bounding_grid=None, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, in_place=False, scale_factors=None, model_id=None, hide_maps=True)

Experimental API . Add maps.

volume_bin(session, volumes, subregion='all', step=1, bin_size=(2, 2, 2), model_id=None)

Experimental API . Reduce map by averaging over rectangular bins.

volume_boxes(session, volumes, centers, size=0, isize=None, use_marker_size=False, subregion='all', step=1, model_id=None)

Experimental API . Extract boxes centered at marker positions.

volume_copy(session, volumes, value_type=None, subregion='all', step=1, model_id=None)

Experimental API . Copy a map or map subregion.

volume_cover(session, volumes, atom_box=None, pad=5.0, box=None, x=None, y=None, z=None, f_box=None, fx=None, fy=None, fz=None, i_box=None, ix=None, iy=None, iz=None, use_symmetry=True, cell_size=None, step=(1, 1, 1), model_id=None)

Experimental API . Extend a map using symmetry to cover a specified region.

volume_erase(session, volumes, center, radius, coordinate_system=None, outside=False, value=0)

Experimental API . Erase a volume inside or outside a sphere.

volume_falloff(session, volumes, iterations=10, in_place=False, subregion='all', step=1, model_id=None)

Experimental API . Smooth edges of a masked map.

volume_flatten(session, volumes, method='multiplyLinear', fitregion=None, subregion='all', step=1, model_id=None)

Experimental API . Make map background flat.

volume_flip(session, volumes, axis='z', subregion='all', step=1, in_place=False, model_id=None)

Experimental API . Flip a map axis reversing the hand.

volume_fourier(session, volumes, subregion='all', step=1, model_id=None, phase=False)

Experimental API . Fourier transform a map

volume_gaussian(session, volumes, s_dev=(1.0, 1.0, 1.0), bfactor=None, subregion='all', step=1, value_type=None, invert=False, model_id=None)

Experimental API . Smooth maps by Gaussian convolution.

volume_laplacian(session, volumes, subregion='all', step=1, model_id=None)

Experimental API . Detect map edges with Laplacian filter.

volume_local_correlation(session, volumes, window_size=5, subtract_mean=False, model_id=None)

Experimental API . Compute correlation between two maps over a sliding window.

mask(session, volumes, surfaces, axis=None, full_map=False, extend=0, pad=0, slab=None, sandwich=True, invert_mask=False, fill_overlap=False, model_id=None)

Experimental API . Create a new volume where values outside specified surfaces are set to zero.

volume_maximum(session, volumes, on_grid=None, bounding_grid=None, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, in_place=False, scale_factors=None, model_id=None, hide_maps=True)

Experimental API . Pointwise maximum of maps.

volume_median(session, volumes, bin_size=(3, 3, 3), iterations=1, subregion='all', step=1, model_id=None)

Experimental API . Replace map values with median of neighboring values.

volume_minimum(session, volumes, on_grid=None, bounding_grid=None, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, in_place=False, scale_factors=None, model_id=None, hide_maps=True)

Experimental API . Pointwise minimum of maps.

volume_morph(session, volumes, frames=25, start=0, play_step=0.04, play_direction=1, play_range=None, slider=True, add_mode=False, constant_volume=False, scale_factors=None, hide_original_maps=True, interpolate_colors=True, subregion='all', step=1, model_id=None)

Experimental API . Linearly interpolate pointwise between maps.

volume_multiply(session, volumes, on_grid=None, bounding_grid=None, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, in_place=False, scale_factors=None, model_id=None, hide_maps=True)

Experimental API . Pointwise multiply maps.

volume_new(session, name='new', size=(100, 100, 100), grid_spacing=(1.0, 1.0, 1.0), origin=(0.0, 0.0, 0.0), cell_angles=(90, 90, 90), value_type=None, model_id=None)

Experimental API . Create a new volume with specified bounds filled with zeros.

volume_octant(session, volumes, center=None, i_center=None, subregion='all', step=1, in_place=False, fill_value=0, model_id=None)

Experimental API . Extract an octant from a map.

ones_mask(session, surfaces, on_grid=None, spacing=None, border=0, axis=None, extend=0, pad=0, full_map=True, slab=None, sandwich=True, invert_mask=False, fill_overlap=False, value_type=None, model_id=None)

Experimental API . Create a volume which has value 1 inside surfaces and 0 outside.

volume_permute_axes(session, volumes, axis_order='xyz', subregion='all', step=1, model_id=None)

Experimental API . Permute map axes.

volume_resample(session, volumes, on_grid=None, bounding_grid=False, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, model_id=None, hide_maps=True)

Experimental API . Interoplate a map on a new grid.

volume_ridges(session, volumes, level=None, subregion='all', step=1, model_id=None)

Experimental API . Find ridges in a map.

volume_scale(session, volumes, shift=0, factor=1, sd=None, rms=None, value_type=None, subregion='all', step=1, model_id=None)

Experimental API . Scale, shift and convert number type of map values.

split_volume_by_color_zone(volume)

Experimental API . Create new volumes for each color zoned region of a specified volume.

volume_subtract(session, volumes, on_grid=None, bounding_grid=False, subregion='all', step=1, grid_subregion='all', grid_step=1, spacing=None, value_type=None, in_place=False, scale_factors=None, min_rms=False, model_id=None, hide_maps=True, open_model=True)

Experimental API . Subtract two maps.

volume_threshold(session, volumes, minimum=None, set=None, maximum=None, set_maximum=None, subregion='all', step=1, model_id=None)

Experimental API . Set map values below or above a threshold to a constant.

volume_tile(session, volumes, axis='z', pstep=1, trim=0, columns=None, rows=None, fill_order='ulh', subregion='shown', step=1, model_id=None)

Experimental API . Concatenate maps along an axis.

volume_unbend(session, volumes, path, yaxis=None, xsize=None, ysize=None, grid_spacing=None, subregion='all', step=1, model_id=None)

Experimental API . Unbend a map near a smooth splined path.

volume_unroll(session, volumes, inner_radius=None, outer_radius=None, length=None, grid_spacing=None, axis=None, center=None, coordinate_system=None, subregion='all', step=(1, 1, 1), model_id=None)

Experimental API . Flatten a cylindrical shell within a map.

volume_unzone(session, volumes=None)

Experimental API . Stop restricting volume surface display to a zone.

volume_zone(session, volumes, near_atoms, range=3, bond_point_spacing=None, minimal_bounds=False, new_map=False, invert=False, subregion='all', step=1, model_id=None)

Experimental API . Mask a map keeping only parts close to specified atoms.

vseries

class SeriesArg(name=None, url=None, html_name=None)

Bases: AtomSpecArg

classmethod parse(text, session)

Experimental API . Parse text and return an atomspec parse tree

vseries_align(session, series, enclose_volume=None, fast_enclose_volume=None)

Experimental API . Align each frame of a map series to the preceeding frame.

vseries_measure(session, series, output=None, centroids=True, color=None, radius=None)

Experimental API . Report centroid motion of a map series.

vseries_play(session, series, direction='forward', loop=False, max_frame_rate=None, pause_frames=0, jump_to=None, range=None, start_time=None, normalize=False, markers=None, preceding_marker_frames=0, following_marker_frames=0, color_range=None, cache_frames=1)

Experimental API . Show a sequence of maps from a volume series.

vseries_save(session, series, path, subregion=None, step=None, value_type=None, threshold=None, zero_mean=False, scale_factor=None, match_scale=None, enclose_volume=None, fast_enclose_volume=None, normalize_level=None, align=False, on_grid=None, mask=None, final_value_type=None, compress=False)

Experimental API . Process the frames of a map series and save the result to a a file. Processing can normalize, align, mask and change the numeric value type of maps.

vseries_slider(session, series)

Experimental API . Display a graphical user interface slider to play through frames of a map series.

vseries_stop(session, series)

Experimental API . Stop playing a map series.

wait

wait(session, frames=None)

Experimental API . Wait before proceeding to the next command. Used in movie recording scripts.

Parameters:

frames (integer) – Wait until this many frames have been rendered before executing the next command in a command script.

windowsize

window_size(session, width=None, height=None)

Experimental API . Report or set graphics window size in pixels.

zoom

zoom(session, factor=None, frames=None, pixel_size=None)

Experimental API . Move the camera toward or away from the center of rotation to make the objects appear bigger by a specified factor.

Parameters:
  • factor (float) – Factor by which to change apparent object size.

  • frames (integer) – Perform the specified zoom over N frames.

  • pixel_size (float or None) – Zoom so that the pixel size in physical units (Angstroms) is this value. For perspective camera modes the pixel size is set at the center of rotation depth. If factor is also given then it multiplies pixel size.