Quickly Filter and Select Molecular Render Presets with NSL

In structural biology and molecular modeling, visual clarity often makes the difference between insight and confusion. SAMSON’s Node Specification Language (NSL) helps users customize and interrogate large molecular systems, including locating and working with specific render presets. But for many users, filtering and selecting these render presets precisely can be unintuitive, especially when dealing with large hierarchies of visual representation nodes.

Render presets in SAMSON control visualization styles—changing how molecules are depicted (e.g., cartoons, spheres, surfaces). When your project includes dozens or hundreds of presets, you need a fast way to identify which ones are active, which are selected, or which follow a particular naming pattern. That’s exactly where NSL comes in, and this blog post walks you through how to use it effectively to manage render presets.

What is the renderPreset attribute space?

In NSL, renderPreset (short name: rp) refers specifically to nodes representing render presets. You can use NSL expressions to filter these presets based on their name, selection status, or a selection flag.

Use Case: Selecting All Visible Cartoon Representations

Suppose you’re working on a protein visualization that includes multiple render presets: cartoons for protein backbones, sticks for ligands, and surfaces for pockets. If you want to select only the cartoon representation nodes whose names start with “L”, you can use:

This expression filters for all render presets whose name starts with “L”.

Quickly Identifying Selected Presets

The selected attribute lets you query whether a render preset is currently selected. To list all selected render presets, simply use:

And to filter only those that are not selected:

Using the Selection Flag

The selectionFlag behaves like a user-defined tag to save selections independently of the current selection. This is helpful if you need to define a persistent visual group. To query nodes with the selection flag set:

And to find those that don’t have it:

Why It Matters

When working on large systems, it’s easy to lose track of your render setup. Maybe someone handed you a SAMSON file filled with techniques layered over each atom or residue. Instead of clicking node by node, you can use these NSL commands to find what matters in seconds.

For example, to fully understand why a particular visualization is causing rendering lag, quickly filter all selected or flagged presets and audit them. Or, when cleaning up for a presentation, flag the key presets with selectionFlag and hide the rest.

This capability may seem small, but if you’re adjusting render settings frequently—e.g., switching between publication mode and exploratory mode—it becomes a major quality-of-life feature.

To learn more about how to specify render preset attributes using NSL, see the full documentation here: https://documentation.samson-connect.net/users/latest/nsl/renderPreset/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.