In molecular modeling, visual clarity is crucial. Whether you’re preparing a presentation, inspecting a specific interaction site, or cleaning up a complex workspace, you often need to hide or reveal certain parts of your model without affecting the underlying data. With SAMSON’s Node Specification Language (NSL), managing what you see — and what you don’t — becomes precise and efficient.
This post focuses on the visibility-related attributes specifically defined for visual model nodes in SAMSON. These include: visible (vm.v), visibilityFlag (vm.vf), and hidden (vm.h).
Why visibility control matters
Large molecular systems, such as entire proteins with ligands or solvent environments, quickly get visually cluttered. Instead of manually selecting parts of the model through the graphical interface, NSL allows you to write simple expressions to show only what’s important for the task at hand.
NSL visibility attributes explained
visible(vm.v): This attribute indicates whether the visual model node is currently visible. You can explicitly usevm.vto match visible visual models andnot vm.vto find hidden ones.visibilityFlag(vm.vf): This is a flag that can be set to determine visibility. Usevm.vfin your expressions to match nodes with the visibility flag set totrueorfalse.hidden(vm.h): This is a direct condition for checking if a node is hidden. You can also usenot vm.hto find nodes that are not hidden.
These attributes open up highly specific visibility control. For example:
|
1 |
vm.vf false |
This returns all visual model nodes whose visibility flag is set to false, which means they are not set to be shown.
|
1 |
not vm.v |
This returns all the visual models that are currently hidden, regardless of why they’re hidden. Helpful when reviewing what’s currently off-screen.
|
1 |
vm.h |
This expression matches all hidden models based on their hidden property. It’s useful for checking nodes that have been manually hidden.
When to use each
If you’re actively managing what parts of a structure to show for your visualization or publication, use the visible and hidden attributes for immediate control. The visibilityFlag is helpful when scripting or automating visualization workflows where visibility is toggled based on certain conditions.
Quick tip 💡
You can chain these NSL expressions with logical operators. For example, to show all custom-named parts (e.g. labels beginning with ‘L’) that are currently hidden, use:
|
1 |
vm.n "L*" and vm.h |
NSL expressions can be used with Selectors, Python scripts, or directly in the SAMSON interface via the Search bar, making this a powerful method for cleaning up views in just seconds.
To learn more about managing visual models and their attributes using NSL, check out the official documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
