How to Efficiently Select Node Groups in SAMSON Using NSL

When working with complex molecular systems in SAMSON, the ability to efficiently select specific parts of your model—especially node groups—is essential for organizing your workspace, automating repetitive tasks, or applying transformations and analyses only where intended.

This post focuses on a particularly useful but sometimes overlooked feature in SAMSON: node group attributes in the Node Specification Language (NSL). If you’ve found selection in large systems cumbersome or time-consuming, this will help you streamline your workflow.

What Are Node Groups?

Node groups in SAMSON are containers that can hold other nodes (such as atoms, molecules, or other groups). This makes them ideal for structuring models hierarchically. When working with selections, being able to target node groups efficiently is useful, especially when dealing with large assemblies or repeated structures.

Using NSL to Select Node Groups

nodeGroup is a dedicated attribute space for querying node group nodes in NSL. Its short name is ng. You can filter node groups by their names, selection states, or custom flags. These attributes are inherited from general node properties but are applied specifically to node groups:

Attribute Name Short Name Possible Values Usage Examples
name n Strings in quotes ng.n "GroupA"
ng.n "L*"
selected true, false ng.selected
not ng.selected
selectionFlag sf true, false ng.sf
ng.sf false

When Would You Use This?

  • Quickly isolate groups: If you’ve labeled or named your node groups in a consistent way (e.g., Chains A, B, C), you can instantly retrieve them with ng.n "ChainA" or wildcard patterns like ng.n "Chain*".
  • Clean scripting: If you’re writing scripts to operate on selected items, integrating NSL with Node Specification makes sure you only apply functions to the intended subgroups.
  • State-based filtering: Easily toggle selection-based visibility or apply modifications only to selected/unselected groups using ng.selected and ng.sf.

Tips

Although ng.selected lets you test the current selection status, there is no short alias like s for it—so be sure to write out the full name.

These tools become especially helpful when working on complex protein-ligand complexes, supramolecular assemblies, or any project where organization matters. Efficient selection reduces clicks, saves time, and improves reproducibility.

To explore all available attributes and see more examples, check out the official documentation page: https://documentation.samson-connect.net/users/latest/nsl/nodeGroup/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get it at https://www.samson-connect.net

Comments are closed.