Making smarter selections with node group attributes in SAMSON

For molecular modelers working with large systems—be it proteins, materials, or supramolecular complexes—managing selections efficiently can significantly improve productivity and reduce errors. In SAMSON, the Node Specification Language (NSL) introduces a powerful way to target specific parts of your model through attributes. Today, we’ll focus on a particularly useful subset: node group attributes.

Node groups, commonly used to organize molecular structures, can be filtered and manipulated using attributes in the nodeGroup (ng) attribute space. If you’ve ever struggled with selecting the right components in a complex model, or wanted an easier way to automate selections for groups of nodes (e.g., chains, fragments, or domains), then this feature is designed for you.

Why node group attributes matter

Say you have a biomolecular system containing hundreds of chains and subcomponents, and you want to isolate just a few groups with specific names or selection states. Rather than resorting to manual clicking or writing extra scripts, you can use NSL expressions to capture exactly what you need based on the following key attributes:

  • name (ng.n): Targets node group names via string matching. You can include wildcards!
    Example: ng.n "Protein*" selects all groups whose names start with “Protein”.
  • selected: Filters based on whether the node group is currently selected.
    Example: ng.selected returns all selected node groups.
  • selectionFlag (ng.sf): Captures the internal selection flag—often useful in NSL expressions.

    Example: ng.sf false finds groups that aren’t flagged as selected internally.

These attributes are especially handy when building automation pipelines or selection routines. For example, when preparing systems for simulation, you may wish to apply certain operations (such as charge assignment or force field mapping) only to node groups named a certain way or those that are not currently selected. Rather than manually checking each group, your NSL expressions can handle this for you.

Example use cases

  • Selecting all node groups starting with “Ligand”: ng.n "Ligand*"
  • Inverting your current selection: not ng.selected
  • Cleaning up non-selected groups: use ng.selected to keep relevant ones and discard others

Shortcuts that help

Each attribute can be accessed using a shorter alias where available. For instance, name is available via n, so you could write ng.n "ChainA" instead of the full attribute name. Note, however, that selected doesn’t have a short alias for node groups, helping avoid abbreviations that might cause confusion.

Tip: When used inside SAMSON’s Find Editor, these expressions provide immediate feedback. This makes it easier to try your filters live and combine multiple attributes as logical expressions.

Conclusion

Whether you’re preparing a model for simulation or building tools on top of SAMSON, knowing how to leverage node group attributes can save time and reduce complexity. It’s a practical technique that captures the informative power of SAMSON’s NSL with very readable syntax.

To learn more, visit the full documentation page: https://documentation.samson-connect.net/users/latest/nsl/nodeGroup/

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

Comments are closed.