When analyzing or designing complex molecular systems in SAMSON, molecular modelers often need to select specific sets of entities—whether that’s to analyze a protein region, assign visualization properties, or apply an operation just to a subset of the system. However, when those entities are node groups (like groups of atoms, residues, or higher-level structures), selecting them efficiently without manually browsing large systems can be a challenge. Fortunately, the Node Specification Language (NSL) in SAMSON provides a helpful solution: attribute-based selection.
In this post, we’ll explore how to use node group attributes to efficiently specify and select groups of nodes using NSL expressions. This is particularly helpful when you’re working with large systems and need to use meaningful, reusable queries that automate selection.
What are node group attributes?
NSL lets you select nodes using predefined attribute spaces. For node groups, these attributes belong to the nodeGroup attribute space (short name: ng). This space applies specifically to node group nodes and allows you to filter them using structural or selection-based properties.
Here are the key node group attributes and how they can be used:
| Attribute | Short name | Examples |
|---|---|---|
name |
n |
ng.n "A"ng.n "L*" |
selected |
(no short name) | ng.selectednot ng.selected |
selectionFlag |
sf |
ng.sfng.sf false |
Use case example: selecting node groups by name
If you’re modeling a protein with different chains or segments grouped into separate node groups, naming conventions can make selection easier. For instance, to select all node groups with names starting with “L”, use:
|
1 |
ng.n "L*" |
This is especially powerful when naming conventions match logical or spatial groupings (like a ligand, a domain of interest, or structure modules).
Filtering based on selection state
Both selected and selectionFlag give you flexible control over whether a node group is selected or has been tagged for selection. For example, to find all node groups that are currently not selected, try:
|
1 |
not ng.selected |
Or, to work only with groups that were previously captured using selection flags but are not currently selected:
|
1 |
ng.sf true and not ng.selected |
Common misconception: ‘selected’ vs ‘selectionFlag’
It’s easy to confuse these two. The selected attribute reflects the current selection state, whereas selectionFlag is often used by operations that mark nodes without actually selecting them. This is useful when creating filters or group definitions programmatically.
Why this matters
When working with systems that contain hundreds or thousands of node groups, these attribute filters can save a huge amount of time. Relying on name patterns, selection flags, and logical combinations of attributes avoids mouse-heavy selection methods and reduces human error.
To learn more about node group attributes and other NSL features, visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
