When working on large molecular models, it becomes increasingly important to manage visibility efficiently. You might be focused on just one part of the structure — a ligand binding site, a water shell, or a specific chain. But if hidden objects keep getting in the way, or if some nodes mysteriously disappear from view, it can slow you down 🧪📉.
The Node Specification Language (NSL) in SAMSON offers you powerful, readable tools to control and query node visibility at scale. In this blog post, we’ll explore how to find what is visible or not in your scene by using specific attributes: visible, hidden, and visibilityFlag.
What’s causing visibility issues?
There are several reasons why nodes might not be showing up in your document:
- Their own visibility flag might be set to
false - The visibility flag of one of their parent nodes is
false - They’ve been manually hidden during previous operations
This hierarchical behavior can make it tricky to debug visibility problems, especially in complex molecular assemblies.
Discovering hidden nodes
Use the hidden attribute (n.h) to select all nodes that are currently hidden, regardless of how that happens within the node hierarchy. For example:
|
1 |
n.h |
This expression selects nodes hidden either directly or because one of their ancestors is hidden.
Finding visible nodes
To identify all visible nodes (nodes with a true visibility flag and visible ancestors), use:
|
1 |
n.v |
This can help you isolate the parts of the system you’re currently seeing.
Investigating the visibility flag
Sometimes, you want to check individual flags regardless of the entire visibility chain. That’s what visibilityFlag (n.vf) is for:
|
1 |
n.vf false |
This identifies nodes whose own visibility flag is false, even if their ancestors are visible. It’s perfect for debugging scenes where a specific atom or bond doesn’t show up but you’re unsure why.
Combining queries
Thanks to NSL’s readable syntax, combining queries is straightforward. For example:
|
1 |
n.vf false and not n.h |
This expression finds nodes that have their visibility flag turned off but are still visible through ancestor settings — quite useful for cleaning things up.
A practical example
Let’s say you want to find all hidden atoms in a ligand:
|
1 |
n.t a in n.c lig and n.h |
This expression selects atoms (n.t a) in the ligand category (n.c lig) that are currently hidden (n.h).
A helpful tip
Nodes can also be selected or locked, which might interact with visibility. If you’re using selection tools, combine NSL queries to avoid confusion. You can even use saved queries to automate visibility cleanup in repeated workflows.
Managing visibility effectively can save time and make your modeling experience smoother. Whether you’re working on large proteins, assemblies, or detailed atom-level simulations, understanding visibility attributes in NSL gives you precision control over your molecular view.
Learn more at the official documentation page.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
