It can be frustrating: You import or build a molecular system in SAMSON, and some parts seem to be disappearing, can’t be selected, or just don’t respond the way you expect. In many cases, this comes down to node visibility or selection states.
This blog post walks you through how node visibility works in SAMSON, and more importantly, how you can use the Node Specification Language (NSL) to quickly select and work with visible parts of your model. If you’re spending too much time manually searching through the data graph to find what is active or hidden — this small but powerful NSL trick can save you time and reduce confusion.
Why visibility matters
Molecular systems can have thousands of elements — atoms, residues, structural models, visual representations, and more. Not all of them are always shown. For example, some visual models might only apply to selected parts, and others might be disabled or inherited from ancestors that are hidden. Working with a clean selection of what is actually visible prevents accidental changes and focuses your work.
In SAMSON, node visibility is handled through two attributes:
node.visibilityFlag(short name:n.vf): directly indicates if a node should be visible.node.visible(short name:n.v): indicates whether the node — and all of its ancestors — are effectively visible.
Selecting visible nodes with NSL
If you want to work only with the nodes currently visible in the viewer, the NSL expression you need is:
|
1 |
n.v |
This selects all visible nodes — meaning any node that is not hidden by a false visibility flag, either on itself or one of its ancestors.
You can combine this with other NSL filters. For example:
n.t a in n.v: select all visible atomsa.s O in n.v: select only visible oxygen atomsn.v and n.c lig: select only visible ligands
This can be especially helpful when preparing analyses, applying materials, or exporting a clean subset of your system.
Seeing hidden nodes
If you’re wondering what parts are currently hidden — maybe something disappeared and you don’t remember why — you can use:
|
1 |
not n.v |
This will match all nodes that are invisible, either because they themselves have a false visibility flag or because they are under a hidden ancestor.
Another useful check is to narrow in on visibility flags:
n.vf false: nodes that have their own visibility flag set to false
These expressions let you debug your models more easily — identify unintended node hiding, and adjust visibility from the Data Graph or with scripts.
Useful tip: hidden vs visibilityFlag
Don’t confuse node.hidden (n.h) with node.visibilityFlag (n.vf). The former considers parental inheritance (i.e., a node with n.vf true may still be hidden if its parent is hidden), while the latter checks only the node’s own flag.
Wrapping up
Understanding how visibility works in SAMSON — and being able to query it quickly — helps molecular modelers streamline their workflow. Fewer selection mistakes, clearer models, and more confidence in what you’re actually seeing.
To explore more attributes and selection tricks, check out the full SAMSON NSL documentation page here: NSL Node Documentation
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
