When working on complex molecular scenes in SAMSON, efficiently managing rendering styles can make a big difference. Whether you’re switching between molecular representations, preparing figures, or comparing visualizations for various states of a molecular system, render presets help you save and reuse visual configurations across sessions.
However, when you accumulate a lot of custom render presets, it becomes harder to keep track of them or quickly find exactly what you’re looking for. This blog post walks through how to efficiently filter and manipulate render preset nodes in SAMSON using the Node Specification Language (NSL), focusing especially on the name and selected attributes.
🤔 The common pain
If you’ve ever asked yourself:
- “Which of my render presets are currently selected?”
- “Do I already have a render preset for ‘Ligand A’?”
- “How can I automate the filtering of my presets using patterns?”
Then understanding render preset attribute filtering in NSL can save you time and prevent errors when managing visual details of your models.
🔍 Attribute Space: renderPreset (rp)
Render preset attributes are defined in the renderPreset attribute space, with short name rp. This means you can use expressions like rp.n "Ligand" or rp.selected to target only render preset nodes, not all nodes.
Filtering by name
The name attribute (short name n) lets you search for render presets by their name. You can use string patterns too. For instance:
|
1 |
rp.n "Ligand A" |
This expression selects the render preset node named Ligand A.
|
1 |
rp.n "L*" |
This uses a wildcard to match any render preset name starting with L — a handy way to quickly apply visual filters or tweaks to many similar presets.
Filtering by selection
You can check whether a render preset is currently selected using:
|
1 |
rp.selected |
This returns all selected render preset nodes available in the scene. Conversely:
|
1 |
not rp.selected |
filters only the ones that aren’t currently selected.
Example scenarios
Suppose you have a collection of presets for different components of a protein-ligand complex:
- Ligand A
- Ligand B
- Backbone
- Surface
To focus on presets related to ligands, use:
|
1 |
rp.n "Ligand*" |
To modify only the currently selected ones, add a logical conjunction:
|
1 |
rp.n "Ligand*" and rp.selected |
Why this matters
Over time, as your projects grow more detailed, it’s easy to lose track of custom visuals. Relying only on manual inspection can introduce inconsistencies and slowdowns. By leveraging NSL queries like the ones above, users can streamline their process when preparing images for publications, performing presentations, or debugging issues in structural visualization.
Learn more
To deepen your knowledge of render preset attributes and explore other filtering capabilities like selectionFlag, visit the official documentation page: https://documentation.samson-connect.net/users/latest/nsl/renderPreset/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download the platform at https://www.samson-connect.net.
