ChimeraX Command Line Interface (CLI)
Discover the capabilities of ChimeraX’s Command Line Interface (CLI) for seamless control of its numerous functions. Gain proficiency in accessing the CLI, browsing through command history, and harnessing the flexible “open” command for handling both local and online data. Learn what target specification commands are and become proficient in crafting command files to streamline your operations.
Learning Objectives
At the end of this lesson, you should be able to:
- Effectively use ChimeraX’s Command Line Interface (CLI) to interact with its features
- Navigate the command history
- Retrieve data from local files and online sources using the open command
- Specify targets
- Create command files for streamlined and automated ChimeraX workflows
1. ChimeraX Command Line Interface
Similar to its forerunner, ChimeraX offers an extensive array of commands to manage virtually every aspect of its features. ChimeraX commands are entered and executed through the Command Line Interface (CLI), which can be found at the bottom of the user interface, just above the status bar. The CLI is readily accessible within ChimeraX’s default user interface. If the CLI is not visible, you can make it appear by navigating to Tools -> Command Line Interface and clicking on it.
The CLI requires focus for entering ChimeraX commands, as keystrokes won’t register when it’s not in focus. Clicking inside the CLI will shift the focus to it. You’ll know the CLI is ready to accept commands when you see a blinking line. Additionally, the CLI can automatically extract file paths from dragged and dropped files or folders, which is particularly useful when commands involve file or folder paths.
2. ChimeraX Command History
The downward pointing arrow at the rightmost edge of the CLI can be used to review previously run commands. This also provides a link to the Command History dialog box. Here, you can select and rerun the previously run commands. You can also save the command history to a file. By default, ChimeraX stores the last 500 commands in the history. You can modify the number of commands stored in the history with the Command History dialog box.
The command history can also be accessed via the keyboard shortcuts.
- Ctrl+p – go back to the previous command
- Ctrl+n – go to the next command
- Shift+Ctrl+p – go back to the previous command of the same type (for example, from the current select command to the previous select command)
- Shift+Ctrl+n – go to the next command of the same type
- Ctrl+u – erase command-line contents
- Ctrl+k – erase from the cursor position to the end of the line
The keyboard’s up arrow and down arrow keys can also be used to navigate the command history. Similarly, the Shift+up arrow key combination can be used instead of the Shift+Ctrl+p key combination.
3. ChimeraX Open Command
The ChimeraX open command has diverse functions. It allows you to access local files and retrieve molecular structures and other data from various online sources. When used with a URL, the ChimeraX open command displays the web content within its built-in browser.
Local files can be opened by specifying the absolute or relative path of the file.
For example, if my current working directory is C:\Users\lochana\Desktop and if I wish to open the 3ic4.pdb file located in my Downloads folder, I can either run open ..\Downloads\3ic4.pdb
or open C:\Users\lochana\Downloads\3ic4.pdb
You can find your current working directory by entering the command, pwd
which stands for print working directory. When this command is executed, the current working directory is printed to your log panel.
The data fetched from online sources are stored locally in ~\Downloads\ChimeraX where ~ indicates the user’s home directory. The downloaded files are organized in various subfolders identified by the source of the data. For example, .pdb and .cif files downloaded from the protein data bank (PDB) are stored in the PDB subfolder.
When fetching from online sources, a compound or an entry can be specified with a source:identifier combination. The sources can be databases or web services. As ChimeraX uses PDB as its default, obtaining a structure from it will only necessitate the identifier. For example, open 1hwi
will download and open the mmCIF version of the pdb file 1hwi. If you wish to download the .pdb file instead, the file format can be specified as a command line argument.
open 1hwi format pdb
For other sources, the name of the source can be prefixed with a colon or used with the command line parameter from.
The following code will retrieve the 3D chemical structures of two small molecules from the PubChem database. The compound IDs (called CIDs) are used for fetching data. The files downloaded from the PubChem database are in SDF format.
open pubchem:368
open 345 from pubchem
Protein sequences and functional information can be obtained from databases such as UniProt. The following command retrieves the sequence of a bovine insulin protein (UniProt ID P01317).
open uniprot:p01317
4. ChimeraX Target Specification Commands
Most ChimeraX commands involve atomic models or their parts called targets. The commands that specify targets are known as target specification commands.
ChimeraX offers six different methods for specifying a target:
- Hierarchical specifiers - Things related to structural hierarchy such as model number, chain ID, residue name or number, and atom name
- Built-in classifications - Built-in classifiers that can identify current selection (sel), all protein atoms (protein), all helices (helix), etc.
- User-defined targets - Names (with name command) assigned to user-defined selections
- Attributes - Properties with names and values. These properties may be associated with atomic models, chains, resides, or atoms.
- Zones - Atomic models, residues, or atoms within or beyond some distance of a reference set of atoms
- Any combination of the previous five
The target specification commands in ChimeraX are not compatible with Chimera, and likewise, target specifications from Chimera will not function in ChimeraX.
5. ChimeraX Command Files
ChimeraX command files, denoted by the .cxc file extension, are simple plain text files that contain the same commands one can input into the CLI. When you open such a file in ChimeraX, it promptly executes the commands, while displaying them in the Log panel. Echoing the commands to the Log panel can be prevented by setting the log to false (log false) in the command file.
If you need to apply the same set of commands to multiple data files systematically, you can utilize the open command with the foreach option.
open myscript.cxc foreach ~/data/*.cif
In these command files, you can include comments designated by lines that start with # or in-line text following a semicolon (;), which are ignored during execution.
Blank lines are also permitted.
To maintain clarity and avoid potential conflicts with future commands, it’s advisable to use complete command names rather than truncated versions.
Multiple commands can be combined into a single line using semicolons. This provides a way to execute multiple actions simultaneously or to suppress the display of intermediate states.
The order of execution is determined by the order of the commands in the script. Therefore, ensuring the correct order is crucial.
The wait command is employed to control whether actions run concurrently or sequentially. It ensures the completion of a multi-frame action before initiation of the next command in a script.
6. Final Thoughts
In conclusion, mastering ChimeraX’s Command Line Interface (CLI) empowers you to effortlessly navigate its rich functionalities. You’ve learned to effectively engage with the CLI, explore command history, and leverage the versatile “open” command for local and online data manipulation. By understanding target specification commands, you can precisely pinpoint elements in your models.
Additionally, command files offer a streamlined approach for automating workflows, enhancing efficiency in handling multiple data files. Remember to use comments, semicolons, and the “wait” command judiciously for clear and sequential execution. Armed with these skills, you’re ready to unleash the full potential of ChimeraX for your molecular modeling endeavors. Happy exploring!
Related Posts
An Introduction to ChimeraX User Interface
Welcome to our blog post on ChimeraX User Interface. ChimeraX is a powerful molecular visualization and analysis software widely used by researchers in the field of structural biology.
Read moreAn Introduction to Molecular Graphics
Explore the captivating world of molecular graphics, where science meets art to unravel the secrets of molecules. From the early days of wooden models to the digital age, this journey delves into the history, diverse visualization techniques, and the intricate representations of atoms, proteins, surfaces, and nucleic acids.
Read moreChimeraX Matchmaker
Dive into the world of “Matchmaker”, an essential ChimeraX extension for protein structure-function research. This blog post unveils its intricacies, guiding you through both its fundamentals and advanced features.
Read more