When working with complex molecular systems in SAMSON, visual clarity quickly becomes essential. If you’ve ever found yourself buried in overlapping visual representations—atom spheres, bonds, surfaces—and just wanted to declutter your view without deleting anything, this post is for you.
In this article, we’ll look at how to select and filter render preset nodes using nsl (Node Specification Language) in SAMSON. This allows you to manage your scene efficiently by querying and manipulating visual presets, such as displaying only certain styles or hiding unused ones.
What Are Render Preset Nodes?
Render presets in SAMSON define how nodes (e.g., molecules, atoms) are visually represented—be it as sticks, spheres, surfaces, or other styles. These presets are stored in dedicated renderPreset nodes. If you want to interact with or filter these visual styles programmatically, SAMSON provides an attribute space called rp in NSL.
Common Problem: Scene Clutter
Imagine you’re examining a protein-ligand complex. Over time, multiple render presets accumulate: cartoon-style backbones, Van der Waals surfaces, transparent meshes, and various selection lenses. Your scene becomes overloaded, making it harder to focus. You want a quick way to disable or isolate visual styles without going through each one manually.
Solution: Querying with NSL
The render preset attribute space lets you write simple queries to find just what you need. Here are the main attributes you can use:
- Name (
n): Filter presets by name (can include wildcards). - Selected: Check if a preset is currently selected in the UI.
- Selection Flag (
sf): Use for custom selection logic, often to track temporary selections.
Here are some practical examples:
|
1 2 3 4 5 6 7 8 9 |
// Find all render presets with name starting in 'L' rp.n "L*" // Find all render presets that are currently selected rp.selected // Exclude any render presets that have the selection flag set not rp.sf |
Use Case: Hide Only Specific Render Styles
Let’s say you applied multiple surface visualizations labeled with names like “LigandSurface”, “WaterSurface”, and “EnvSurface”. You want to remove only those with names beginning with “Water”. You can do:
|
1 2 |
rp.n "Water*" |
Then, you can act on the filtered list (e.g., hide, disable, remove) without disturbing the rest of the scene.
Use Case: Clean Up Unused Selections
If you’ve run through several selection lenses or visual tests and want to remove all temporary selections marked by the selection flag, this quick query helps:
|
1 |
rp.sf true |
Combine it with logical operators to chain filters and build complex queries suited to your workflow.
Conclusion
Mastering this subset of NSL makes a significant difference when working with dense or dynamic molecular environments. It frees you from manual toggling and allows you to tailor your visualization with precision.
To explore more about render preset queries in SAMSON, head over to the full 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 SAMSON at https://www.samson-connect.net.
