The save command saves an image, ChimeraX session, map (volume data), atomic coordinates, sequences, or other data to filename, which can be a pathname including the directory location. The pathname can be absolute or relative to the current working directory as reported by pwd. The working directory can be changed with cd. Giving the word browse instead of a filename opens a file browser window for choosing it interactively. Files can also be saved with menu File... Save or Toolbar icon . See also: open, log, Writing mmCIF Files in ChimeraX
An initial image, session, or map keyword before the filename is optional if the file type is specified with either the filename suffix or the format option. Some file types have no preceding keyword and must be specified with the filename suffix or the format option. If the format is specified separately, the appropriate suffix will be added to filename.
Sessions and images include all contents, but for other file types, the models option can be used to specify which model(s) to save. There may be several additional options, depending on the file type:
The command save formats lists the possible output formats in the Log.
|initial keyword||format-name||filename suffix||description|
(default for save image)
|.png||Portable Network Graphics|
|Tagged Image File Format|
|Joint Photographic Experts Group|
|gif||.gif||Graphics Interchange Format|
(may contain multiple models)
|dsn6||.brix||BRIX density map|
|mrc||.mrc||MRC density map|
(see Save PDB)
|pseudobonds||.pb||list of atom pairs to connect with
(see the selectedOnly option)
(see Save Mol2)
(includes a subset of mmCIF data types, see details)
|markers||.cmm||markers and links
(analogous to atoms and bonds)
|gltf||.glb||3D objects, GL Transmission Format
(see glTF options)
|stl||.stl||3D objects, STereoLithography|
(geometric and texture vertices, vertex normals, faces; no colors)
|x3d||.x3d||3D objects, X3D|
|biopolymer sequence or sequence alignment,
|biopolymer sequence or sequence alignment,
|pir||.pir, .ali||biopolymer sequence or sequence alignment,
Usage: save [ image ] filename [ format format-name ] [[ width w ][ height h ] | pixelSize p ] [ supersample N ] [ quality M ] [ transparentBackground true | false ]
Images generally have the same contents as the graphics window, but are rendered offscreen. See also: windowsize, view, making images, making movies,
[ width w ][ height h ] | pixelSize p
Image pixel dimensions can be specified directly with width and height, or relative to the physical dimensions of the view in the window with pixelSize. If none of these are given, the image will have the same pixel dimensions as the graphics window. If only width or height is specified, the other will be set according to the window aspect ratio; if both are specified but the image aspect ratio is not the same as the window aspect ratio, the image contents will differ from what is shown in the window. With the pixelSize option, the image contents will be the same as what is shown in the window, but image pixel dimensions will be chosen to give pixels of size p in Å. With perspective, the pixel size varies with depth, but pixelSize sets the value at half-depth (the midpoint along the line of sight). For example, if at half-depth the graphics window encloses a 400-Å by 300-Å rectangle, pixelSize 0.4 specifies image pixel dimensions of 1000 by 750.
Supersampling refers to initially generating an image at a higher resolution than requested and then sampling it down to the final size. This gives a smoother (less pixelated) appearance of lines and boundaries in the final image. The degree of supersampling N defaults to 3, meaning that the initial image will be 3 times larger in each dimension, with 9 times as many pixels, as the final result. A value of 1 corresponds to no supersampling. See also: set subdivision
The quality M applies to JPEG format only, with values in the range 0–100 (default 95).
transparentBackground true | false
Whether to include opacity values (alpha) in an output PNG or TIFF file. With background transparency, the background will be completely invisible in the saved images. This facilitates combining the image with different backgrounds in image-editing applications. (Note: TIFF images with background transparency may not be interpreted correctly by Adobe Photoshop.)
Usage: save [ session ] filename [ format format-name ] [ includeMaps true | false ]
A ChimeraX session file encodes most aspects of a modeling session in ChimeraX, including atomic and other models, sequences, camera views, coloring, display styles, lighting, labels (2D and 3D), selections, selection highlighting color and width, attributes, custom colors, custom button panels, aliases, and defined targets. Saving and later opening a session file restores the session and allows resuming work in ChimeraX. A common use is to store setups for figures and movies. Whether to restore the graphics window size when opening a session file is set in the Window preferences or can be specified with the open command resizeWindow option. See also: ChimeraX command files
Sessions are saved in a ChimeraX-specific format not read by other programs. Maps generated on the fly (rather than read from a file) are always included if present, but the includeMaps option indicates whether maps read from pre-existing files should also be included. The default is false, as maps can be very large. If the maps are not included, the session file will still include the locations of the corresponding map files and open them automatically upon session restore, or if they are not found, prompt the user for their current locations.
Usage: save [ map ] filename [ baseIndex M ] [ format format-name ] [ models model-spec ] [ step N | Nx,Ny,Nz ] [ region all | name | i1,j1,k1,i2,j2,k2 ] [ maskZone true | false ] [ append true | false ] [ compress true | false ] [ chunkShapes order ]
Various formats are available for saving maps (volume data). MRC files written by ChimeraX are in the MRC 2000 format. Older MRC-reading programs or programs expecting CCP4 format will read such files successfully but may not align the data correctly with other data sets. Only the Chimera map format can accommodate multiple data sets in a single file. Multiple data sets can be written to multiple files by including a %d integer format specification in filename:
save #2,3,7 data%d.mrc
save #2,3,7 data%03d.mrc
The first example would generate the files data1.mrc, data2.mrc, and data3.mrc, while the second would instead use names like data001.mrc. Successive integers starting with baseIndex M (default 1) will be used in the new names regardless of the volume model numbers. If the format specification is incorrect, filename will be interpreted as the name of a single file.
Volume model(s) to save; can be omitted if only one volume model is open.
step N | Nx,Ny,Nz
Whether to use the full resolution of the data (step size 1, default) or a specified subsample (step size > 1). Step sizes must be integers. A step size of 1 indicates all data points, 2 indicates every other data point, 3 every third point, etc. If a single number is supplied, it is used along all three axes; if three numbers are supplied (separated by commas but not spaces), they are used along the X, Y, and Z axes, respectively.
region all | name | i1,j1,k1,i2,j2,k2
Whether to write the full extents of the data (all, default) or a specified subregion. A subregion can be specified by name (previously assigned with volume) or by grid indices i1–i2 along the X axis, j1–j2 along the Y axis, and k1–k2 along the Z axis. Grid indices must be integers separated by commas but not spaces. If the region option is not supplied, the currently displayed subregion will be written. In this context, a zone is not considered a subregion.
maskZone true | false
If zoning is in effect (see surface zone), whether to write out data for a region enclosing the zone, with values outside the zone set to zero. See also: volume zone
If Chimera map format is saved:
Compression is most useful for volume masks (values 0/1), as other data sets tend to be noisy and compress very little, if at all. Layout affects the efficiency of later reading the data, primarily a concern for very large data sets (hundreds of Mb). The chunkShapes order can be one or more of the following, separated by commas but not spaces:
Usage: save filename [ format pdb ] [ models model-spec ] [ relModel model-spec ] [ selectedOnly true | false ] [ displayedOnly true | false ] [ allCoordsets true | false ] [ pqr true | false ] [ serialNumbering amber | h36 ]
Atomic coordinates can be saved in PDB format. The filename can include [NAME] and/or [ID] to indicate substitution with model name and/or model number, respectively, as needed to save multiple atomic models to multiple files with a single command. See also: getcrd
Write only the specified models, otherwise all atomic models.
Write coordinates relative to the original coordinates of the specified model. Otherwise, coordinates will be written relative to the scene (same as the original coordinates of each model unless it was moved separately). Saving a model relative to another is useful for preserving their spatial relationship without having to save copies of both models. For example, if model 2 has been matched or docked to model 1 (such as with matchmaker, align, or fitmap), saving model 2 relative to model 1 results in them being matched or docked in the same way when the original model 1 file and the new model 2 file (saved relative to 1) are opened.
selectedOnly true | false
Whether to include only the selected atoms when saving a PDB file, or only the selected pseudobonds when saving a pseudobond file.
displayedOnly true | false
Whether to include only the displayed atoms. Note that cartoon display does not imply atomic display, and conversely, backbone atoms may be displayed but suppressed by cartoon.
allCoordsets true | false
Whether to save all frames (coordinate sets) of a trajectory or just the frame that is currently displayed (default). Saving all frames produces a multi-model PDB file.
pqr true | false
Whether to generate PQR format instead of standard PDB. In PQR format, atomic partial charge (Q) and radius (R) fields follow the X,Y,Z atomic coordinates.
serialNumbering amber | h36
How to accommodate structures so large that the numbering fields in standard PDB format would overflow (output for smaller structures is not affected):
- amber handles atomic models with > 99,999 atoms by “stealing” a column to the left of the atom numbering field in standard PDB format
- h36 (default) handles atomic models with > 99,999 atoms (up to 87,440,031) and/or > 9999 residues in a chain (up to 2,436,111) by incorporating alphabetical characters (details...)
Usage: save filename [ format mol2 ] [ models model-spec ] [ relModel model-spec ] [ combineModels true | false ] [ atoms atom-spec ] [ skipAtoms atom-spec ] [ anchor atom-spec ] [ sybylHydNaming true | false ] [ resNum true | false ] [ gaffType true | false ]
Atomic coordinates can be saved in Sybyl Mol2 format, with options:
Write only the specified models, otherwise all atomic models (except as restricted with atoms and/or skipAtoms).
Write coordinates relative to the original coordinates of the specified model (same as described above for PDB).
combineModels true | false
Whether to write multiple models into one combined @MOLECULE section. If false (default), separate @MOLECULE sections will be used for different models.
Write only the specified atoms.
Skip (omit) the specified atoms.
Write the specified atoms into the @SET section of the file.
sybylHydNaming true | false
If true (default), hydrogen names will be of the form HG21 instead of 1HG2.
resNum true | false
Whether to append residue number to reside name, giving substructure names of the form ALA85 instead of ALA (default false).
gaffType true | false
Whether to write GAFF atom types instead of Sybyl atom types. GAFF types are not yet computed, so this should be kept false.
Usage: save filename [ format fasta | pir ] [ alignment alignment-id ]
Only the contents of a single Sequence Viewer window can be saved to a file at a time. When more than sequence window is present, the alignment option is needed to specify the window of interest, using the alignment-id shown in the title bar of the window. Example:
save example.pir alignment 1.A
Usage: save filename [ format gltf ] [ center x,y,z ] [ size s ] [ shortVertexIndices true | false ] [ floatColors true | false ] [ preserveTransparency true | false ]
Several options apply only to saving GL Transmission Format (.glb):
Origin coordinates for the exported objects.
Bounding size for the exported objects. The coordinates are scaled so that the longest edge of the bounding box becomes the specified size.
shortVertexIndices true | false
Whether vertex indices in the exported file must fit within 16 bits (0-65535).
floatColors true | false
Whether to use floating-point color values.
preserveTransparency true | false
Whether to include any transparency of the objects.