ChimeraX docs icon

Command: alias

Usage:
alias name [ wordlist ]

Usage:
alias list [ internal ]

Usage:
alias delete ( name | all )

Usage:
alias usage name [ synopsis usage-description-string ] [ url help-URL ] [ 1ドル argument-name[:description] ] [ 2ドル argument-name[:description] ] ...

The alias command defines a new command name as the specified wordlist, which could be a composite of other commands. That is, wordlist may contain multiple commands separated by semicolons. Subsequent uses of name as a command (at the beginning of a line, following a semicolon, or as a command argument of perframe) will be replaced with wordlist. Aliases are saved in sessions. It may be useful to create aliases automatically at ChimeraX startup by including alias commands in the Startup preferences. For assigning a name to a selection or target specification, see the name command instead. See also: buttonpanel, functionkey, runscript, custom presets

Within wordlist, 1ドル, 2ドル, 3ドル ... may be used to indicate the first, second, third ... arguments of name. In addition, $$ indicates $ itself, and $* indicates the rest of the line, which allows for variable numbers of arguments. For example, ribbon is aliased to cartoon $*, allowing any of the following to work:

ribbon
ribbon #1/A
ribbon #4 suppress false
A string that contains spaces can be designated as a single argument by enclosing it in single or double quotation marks. The quotation marks will be omitted when the alias is expanded. For example,
alias ribcolor color 1ドル 2ドル targ c
ribcolor '/a & helix' 'dodger blue'
is equivalent to
color /a & helix dodger blue targ c

An example of multiple commands, in this case without arguments:

alias reset view orient; view initial

The definition of a pre-existing alias can be shown with alias name.

The command alias list lists the current user-defined aliases in the Log, whereas alias list internal lists the built-in aliases.

The command alias delete can be used to “forget” a specific alias or all aliases.

[back to top: alias]

Optional Sections

An optional section can be specified with $[ and $] in the definition of the alias. Optional sections cannot be nested. Example:

alias myzone zone clear; zone 1ドル $[residueDistance 2ドル$] $[label 3ドル$]; view 1ドル:<8 clip false
myzone /A:12
myzone /A:12 6.5
myzone /A:12 6.5 false
--but not--
myzone /A:12 false

A single optional section may contain multiple arguments, but all of them must be supplied for that part of the command to take effect:

alias myzone zone clear; zone 1ドル $[residueDistance 2ドル label 3ドル$]; view 1ドル:<8 clip false
--the following two will work as expected--
myzone /A:12
myzone /A:12 6.5 false
--the following will be accepted, but all optional values ignored!!--
myzone /A:12 6.5
myzone /A:12 false

Note that the zone command is somewhat unusual in that the default distance cutoff is “sticky” within a session (resets to the value most recently used).

[back to top: alias]

Usage Information for Aliases

Usage: alias usage name [ synopsis usage-description-string ] [ url help-URL ] [ 1ドル argument-name[:description] ] [ 2ドル argument-name[:description] ] ... [ 9ドル argument-name[:description] ] [ $* rest-of-line-name[:description] ]

The command alias usage sets what information will be shown by the usage command for the specified alias, or by usage aliases for all user-defined aliases. The synopsis option allows supplying a short description. The url option specifies a help page for the alias. The additional options allow assigning names and descriptions for arguments 1,ドル 2,ドル etc. Strings containing spaces should be enclosed in quotation marks. Example:

alias turtle open 1ドル
usage turtle

... gives default usage information in the Log:
turtle 1ドル
— alias of "open 1ドル"
1ドル: a text string

Changing this information and trying usage again:
alias usage turtle synopsis "open a PDB structure" 1ドル "pdbId:a protein databank identifier"
usage turtle

... now shows the updated information in the Log:
turtle pdbId
— open a PDB structure
pdbId: a protein databank identifier

UCSF Resource for Biocomputing, Visualization, and Informatics / August 2025

AltStyle によって変換されたページ (->オリジナル) /