Quickly Select Visible or Hidden Nodes in SAMSON Using NSL

When working with complex molecular systems in SAMSON, it’s common to deal with hundreds or thousands of elements arranged hierarchically. Molecules include atoms, bonds, residues, and more. To model or visualize at large scale, molecular designers often hide or isolate components by toggling their visibility.

But what if you need to quickly find all visible atoms in a system—across the full hierarchy? Or what if you want to reselect only the hidden parts of the model to review how they were grouped? Manually clicking through descendants in the document view can be incredibly time-consuming (and error-prone). Fortunately, NSL—the Node Specification Language in SAMSON—offers precise tools to solve this exact pain.

What is a visible node?

A node is considered visible in SAMSON if both its own visibility flag is true and the visibility flags of all its ancestors are also true. Conversely, if any ancestor node is hidden, its children will appear hidden too—even if their own visibility flags are set to true. This makes hierarchy-aware selection tools incredibly valuable.

Introducing NSL-based visibility filtering

SAMSON’s NSL provides powerful attribute selectors to manage visibility:

  • node.visible or shorthand n.v – selects nodes that are effectively visible (they and their ancestors are all visible)
  • not node.visible or shorthand not n.v – selects nodes hidden through any visibility flag
  • node.visibilityFlag or n.vf – checks the node’s own visibility flag (regardless of its ancestors)

Examples

1. Select all effectively visible atoms:

n.t a in n.v

This selects only atoms whose visibility flag is true and whose ancestors are all visible.

2. Hide everything currently visible:

Use n.v to select visible nodes, then apply the hide command (e.g., via the right-click menu or a script).

3. Select hidden residues:

n.t r in not n.v

If you’re reviewing a complex structure and want to bring back hidden residue chunks, this approach helps you isolate what’s currently excluded from view.

4. Find nodes hidden due to ancestors only:

This requires a combination of tests, e.g., selecting nodes with n.vf true but not n.v.

n.vf true in not n.v

This pattern locates nodes that are hidden due to visibility flags of their parents or grandparents.

Beyond visibility: integrating with categories

Let’s say you’re working on a protein-ligand complex and want to analyze only ligand atoms that are currently visible:

n.t a in n.v in n.c lig

This recursive style helps refine very specific views, a feature that becomes essential when dealing with large-scale dynamics or visual clarity in webinars and reports.

When to use visibility filters

  • To clean up visual clutter before rendering
  • To programmatically manipulate hidden content
  • To verify selections before running scripts or commands
  • To benchmark visibility-based performance optimizations

Learn More

Check out the full reference section on visibility-related NSL filtering in the official documentation here: https://documentation.samson-connect.net/users/latest/nsl/node/

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

Comments are closed.