Selection Aliases¶
Overview¶
codemol provides user-friendly aliases for common selection expressions. When you type protein in a command, it resolves to polymer.protein before reaching the rendering engine.
Built-in Aliases¶
| Alias | Resolves To | Description |
|---|---|---|
protein |
polymer.protein |
Protein chains |
ligand |
organic |
Small-molecule ligands |
solvent |
solvent |
Water molecules |
metals |
metals |
Metal ions |
backbone |
backbone |
Backbone atoms (N, CA, C, O) |
sidechain |
sidechain |
Side-chain atoms |
ions |
inorganic |
Inorganic ions |
nucleic |
polymer.nucleic |
Nucleic acid chains |
How Resolution Works¶
The resolve() function in selection_aliases.py handles alias expansion:
resolve("protein") # → "polymer.protein"
resolve("chain A") # → "chain A" (not an alias, passes through)
resolve("ligand") # → "organic"
Resolution happens inside dispatch(), after argument fitting but before scoping:
graph LR
A[User arg: protein] --> B[resolve]
B --> C[polymer.protein]
C --> D[scope]
D --> E["model 1AKE and (polymer.protein)"]
User Overrides with /set¶
Users can override built-in aliases or create new ones using /config set:
/config set alias protein "polymer.protein and not resn ACE NME"
/config set alias active_site "resi 45-60 and chain A"
Overrides persist in ~/.codemol/config.json and take priority over built-in aliases.