When working on complex molecular models, clarity is everything. Labels—whether for atoms, residues, or regions of interest—help molecular modelers keep track of critical information. But as models grow in size and complexity, managing these labels efficiently becomes crucial. That’s where SAMSON’s Node Specification Language (NSL) comes in.
This post dives into the label attribute space in NSL, showing how you can rapidly find and filter label nodes using simple attribute-based queries. If you’ve ever struggled to isolate specific labels or wondered how to quickly find visible or hidden ones, this post is for you.
Why filter label nodes?
Typical use cases include:
- Hiding or showing only certain labels for better visual focus
- Finding labels that match a naming pattern (e.g., those starting with “L”)
- Identifying labels that are selected or visible
- Refining searches using visibility and selection flags for scripting or automation
The la attribute space
In NSL, label attributes are queried using the la prefix, which stands for label attribute space. Here’s a breakdown of the most useful attributes available:
| Attribute | Shortcut | Values | Examples |
|---|---|---|---|
hidden |
h |
true, false |
la.h, not la.h |
name |
n |
Strings in quotes | la.n "A", la.n "L*" |
selected |
No shortcut | true, false |
la.selected, not la.selected |
selectionFlag |
sf |
true, false |
la.sf, la.sf false |
visibilityFlag |
vf |
true, false |
la.vf, la.vf false |
visible |
v |
true, false |
la.v, not la.v |
Real-world examples
1. Find all visible labels:
la.v
2. Select labels that start with “L”:
la.n "L*"
3. Find labels that are hidden but still matched by the visibility flag (useful for toggling state):
la.h and la.vf
4. Identify labels that are not selected:
not la.selected
A note on inheritance
These label attributes inherit from the broader node attribute space, so the behavior is consistent with what you’d expect from how other node types behave in NSL. This makes it easier to transition from general node filtering to label-specific queries without learning a new syntax.
Being efficient with NSL
When models get crowded, a well-crafted query can save a lot of manual clicking and mislabeling. Whether you’re scripting label visibility changes or preparing figures for publication, understanding NSL’s label attributes turns repetitive bottlenecks into simple one-liners.
To learn more, visit the full documentation page on Label Attributes in NSL.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
