Make sense of molecular visualizations by filtering visible nodes in SAMSON

If you’ve ever worked on a large molecular system, you know how cluttered the visual scene can become. Whether you’re analyzing docking results, molecular dynamics trajectories, or assembling molecular systems, excessive visual complexity often slows down interpretation and leads to errors.

This post describes a simple yet effective solution: filtering visual elements using node presentation attributes in SAMSON’s Node Specification Language (NSL). We’ll focus on how to control which presentation nodes are visible—and therefore rendered on screen—by leveraging the pr attribute space.

Why filter visible nodes?

In large models, disambiguating between structure and style matters. Structural nodes represent physical entities (atoms, molecules, etc.), while presentation nodes represent how those entities are rendered (e.g., as ribbons, surfaces, or sticks). Being able to selectively hide or show presentations helps reduce noise and focus on exactly what matters.

The visible and hidden attributes

NSL introduces a subset of attributes specific to presentation nodes, like visible (v) and hidden (h). These can be used to filter displayed elements. For example, to select all presentation nodes that are visible:

To filter out all visible presentations—to work only with hidden ones—you can write:

And for even finer control, use presentation.hidden:

Focusing on parts of the visual scene

You might only want to show surfaces labeled ‘A’, for example. To do that, combine the name attribute with visibility:

This matches visible presentation nodes named “A”. If you have used consistent naming conventions in your presentation nodes, this becomes a powerful filtering tool.

What’s the difference between visible and visibilityFlag?

The attribute visible describes whether the node is effectively visible in the viewport, taking into account all flags and parent nodes. In contrast, visibilityFlag (vf) only reflects whether the specific node’s visibility is toggled on.

So pr.vf false means the node’s own visibility is turned off, but it might still be visible through inheritance or scene settings. To ensure something is not shown, always check pr.v false instead.

Use case: decluttering complex assemblies

Working on a large protein-ligand system with hundreds of atoms and multiple representations? Try selecting only visible ribbon diagrams:

Or, to hide all surfaces temporarily for clarity:

Then hit the Delete key if you want to remove them entirely.

Making multi-representation editing easier

Sometimes, you want to remove or isolate only the visual presentations instead of the structural nodes. The pr attribute space makes that easy. Combining visibility checks with naming filters means you can surgically edit complex views without stressing over layer hierarchy.

To learn more about all available presentation attributes and how to use them, check out the full SAMSON NSL documentation.

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

Comments are closed.