When juggling multiple structures, annotations, and visual states in a molecular project, keeping track of what’s selected and what’s not can quickly become a point of friction. For modelers who use notes to mark hypotheses, highlight anomalies, or trace ideas across a molecular system’s evolution, it becomes vital to filter and act on those notes efficiently. This is where the selected attribute in SAMSON’s Node Specification Language (NSL) can offer a practical advantage.
If you’re using notes but find yourself manually deciphering what you’ve marked—wading through dozens of non-relevant entries—it might be time to automate your view. Let’s dive into how the nt.selected attribute can help you do just that.
Filtering Only the Notes You Need
The selected attribute, when applied in the note attribute space (nt), allows you to target specifically the notes that are currently selected in your scene. This can unlock smarter ways to filter, analyze, or apply modifications to subsets of your annotations.
To find only selected notes in your model, simply use:
|
1 |
nt.selected |
This expression filters note nodes that are currently selected. Conversely, if you’re trying to find the notes you haven’t selected, use:
|
1 |
not nt.selected |
Why This Matters
Let’s say you’re visualizing a protein complex and have annotated several regions of interest using notes – maybe to track potential allosteric sites, pKa variation zones, or functional motifs. As your project progresses, your list of notes can grow to tens or hundreds. Performing batch operations like toggling visibility, changing names, or just visually inspecting subsets becomes arduous.
Now imagine you only want to export or hide the notes associated with your active analysis session. Instead of scanning line by line, nt.selected lets you isolate them instantly. Combine this ease with other attributes (like nt.visible or nt.name) and you’re no longer pushing pixels — you’re navigating insight-rich annotations with precision.
Behind the Scenes: A Little Nuance
Unlike other inherited attributes (e.g., nt.name or nt.hidden), selected in the note attribute space doesn’t have a short name. While in other cases you might use nt.h for hidden or nt.n for name, for nt.selected you need to write the full term. This design encourages clarity when dealing with selection-based queries, especially in larger scripting batches.
Combining with Other Filters
You can make very expressive queries with this attribute. For instance:
|
1 |
nt.selected and nt.v |
This expression gives you only the visible and selected notes — useful when you’re preparing snapshots or rendering a figure for publication and want full control over annotations.
|
1 |
nt.selected and nt.name "Binding Site*" |
This targets selected notes whose names start with “Binding Site” — a simple way to zero in on thematically grouped observations.
Conclusion
Learning to use nt.selected empowers you to manage your note annotations as programmable objects. Whether you’re preparing models for presentations or simply organizing your thoughts, this attribute can help convert selection patterns into clarity. To learn more about all note attributes in NSL, visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.
