Quickly Target Node Groups in SAMSON with the Node Specification Language

When working with large and complex molecular systems in SAMSON, finding and interacting with specific elements can become time-consuming. Imagine trying to select just the ligands, or isolate a set of residues from a cluster of chains, without accidentally selecting undesired portions of your structure. This is where the Node Specification Language (NSL) in SAMSON becomes a true time-saver.

In this blog post, we explore how to leverage Node Group attributes within NSL to streamline selection tasks. For molecular modelers who often group structures—like domains, chains, or designed assemblies—into node groups, efficiently targeting these nodes is crucial for operations like analysis, measurement, or export.

Node Groups: A Useful Abstraction

Node groups help organize molecular models in SAMSON by allowing you to group multiple nodes—like atoms, residues, or entire molecules—under a single logical entity. This is helpful for applying transformations, visibility toggles, selections, and even scripting operations.

But having hundreds of node groups in a large system means you’ll often want a precise way to filter and act on just the relevant ones. That’s exactly what node group attributes in NSL enable.

Understanding the Attribute Space: ng

All node group attributes live under the nodeGroup attribute space, with a short name alias: ng. Here’s a quick guide to the three key attributes you can use:

  • name: Matches node groups by name using quoted strings or wildcards.

    Examples:

    • ng.n "A": Matches node groups named exactly “A”
    • ng.n "L*": Matches node groups starting with “L”
  • selected: Returns node groups that are currently selected. No short name is available for this.

    Examples:

    • ng.selected: Matches all selected node groups
    • not ng.selected: Matches unselected node groups
  • selectionFlag (sf): A deeper property used in scripting or when dynamically marking node groups for more advanced workflows.

    Examples:

    • ng.sf: Matches node groups with the selection flag set to true
    • ng.sf false: Matches node groups with the selection flag set to false

When is this Useful?

Here are a few situations where these filters can save time:

  • Bulk visibility: Quickly select all node groups starting with “Ligand” and hide them with a single click.
  • Focused editing: Target only unselected node groups that contain a certain keyword (like “enzyme”) using ng.n "*enzyme*" and not ng.selected.
  • Script automation: Use ng.sf in batch scripts to mark groups for export or analysis.

And since node group attributes inherit from general node attributes, those familiar with NSL’s base attributes will find it natural to integrate node group filtering into their workflows.

Important Tips

  • Use double quotes around strings in the name attribute.
  • The selected attribute does not support a short name.
  • Use wildcards (*) in names for flexible filtering.

By mastering this small yet powerful subset of the Node Specification Language, you’ll be able to target the right group of nodes faster, with fewer clicks and more automation.

📘 Learn more in the official documentation.

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

Comments are closed.