Working with complex molecular systems in SAMSON can often lead to a visual overload: hundreds or even thousands of elements, each with its own properties, behavior, and labels. While labels are tremendously helpful for identification, analysis, or presentations, they can also clutter your view when not managed properly. This is especially true when working on publication figures or instructional materials, where clarity is key.
Fortunately, the Node Specification Language (NSL) in SAMSON provides fine-grained control over label visibility through a set of attributes. In this post, we’ll explore how you can use NSL’s label attribute space (short name: la) to show or hide labels efficiently and keep your scene view organized.
What You Can Control
Labels in NSL inherit several useful properties from nodes, including:
hidden(short name:h): whether the label is hidden.visible(short name:v): whether the label is visible in the scene.visibilityFlag(short name:vf): the internal flag responsible for visibility control.
These properties can be used independently or together to customize what’s displayed at any given time.
Basic Examples
To improve clarity or focus in your system, you might use expressions like:
la.v– selects all labels that are currently visible.not la.v– selects all labels that are not visible.la.vf false– selects all labels with the visibility flag set to false.la.h– selects all labels that are hidden.
Want to hide a label named “L1”? Try:
|
1 |
la.n "L1" and la.vf false |
This query selects labels named “L1” that are already invisible. You could combine this with commands or scripts in SAMSON to toggle states dynamically during modeling steps.
Use Cases in Real Workflows
Here are typical scenarios where label visibility attributes improve workflow efficiency:
- Presentation refinement: Show only labels of key atoms for a clean visual when preparing a slide.
- Script automation: Use NSL expressions in scripts to batch-hide all labels at the start of a session, and selectively enable just a few later.
- Data validation: Visually scan molecules by toggling labels on/off to ensure the right nodes are correctly named or selected.
Common Pitfalls
- Confusing
visiblewithhidden:la.vandla.hare often toggled independently. An element can be hidden but still have the visibility flag set to true, depending on context. - Short name usage: While many attributes have short names (like
vforvisible),selecteddoes not provide a short-name alias in the label space. Use its full name:la.selected.
Conclusion
Understanding how label visibility attributes work can significantly clean up your working space and help you stay focused on the structures that matter during different project phases.
To take a deeper look at the available label attributes and their use, visit the official NSL label documentation: https://documentation.samson-connect.net/users/latest/nsl/label/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net
