When you’re working with complex molecular systems in SAMSON, quickly finding and editing specific parts of your model can be challenging — especially when your structure involves large biomolecules, molecular assemblies, or nested node groups.
Fortunately, SAMSON’s Node Specification Language (NSL) offers powerful mechanisms to search and operate on specific nodes. In this post, we focus on one underrated but useful subset of NSL: node group attributes.
What Are Node Groups?
In SAMSON, node groups are used to organize nodes — such as molecules, structures, annotations — into meaningful groupings. These can be nested and structured logically within your document. Sometimes, you may want to apply an operation only to specific node groups, and this is where filtering based on node group attributes becomes very handy.
Introducing the ng
Attribute Space
The ng
attribute space (short for nodeGroup
) allows you to target only node groups using NSL queries. Whether you want to isolate a group named “A” or check which node groups are currently selected, the ng
attribute space gives you the tools to do this precisely.
Examples of Use
Here are some example queries using ng
attributes:
ng.n "A"
— Selects node groups with the name exactly equal to “A”.ng.n "L*"
— Uses wildcard matching to select node groups with names starting with “L”.ng.selected
— Targets only those node groups that are currently selected.not ng.selected
— Targets node groups that are not selected, perfect for exclusion operations.ng.sf false
— Selects node groups for which the selection flag is explicitly false.
Why This Matters
Imagine you’re preparing a molecular animation or configuring an analysis that only applies to a subset of your structure. You don’t want to spend time manually clicking through the interface to find the right groups. Instead, by using NSL with the ng
attribute space, you can automate the process of filtering node groups based on names or selection state.
Even more useful, this approach integrates smoothly with scripts and custom interactions, enabling reproducible workflows.
Limitations and Notes
- The
selected
attribute here is inherited from the genericnode
space, but the short names
is not supported for node groups. You must useng.selected
fully spelled out. - Attribute values like names must be surrounded by quotes, and wildcards are supported for pattern matching.
These subtle details can make your work with complex systems much faster and more manageable.
To learn more, visit the official node group attributes documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at https://www.samson-connect.net.