A clearer way to filter node groups with NSL in SAMSON

In structural modeling projects, distinguishing specific parts of complex systems can often be labor-intensive. Molecular modelers frequently need to filter or classify different parts of their system—such as ligands, water molecules, or fragments—based on attributes or naming conventions. SAMSON’s Node Specification Language (NSL) helps tackle this challenge with precision.

One feature that can improve your workflow is the ability to use node group attributes for fine-grained selection control. These attributes allow users to define queries that match entire node groups rather than individual nodes, enabling operations on higher-level structural entities.

Reducing selection complexity with node group attributes

When you’re modeling large assemblies—proteins, protein-ligand complexes, or nanoparticles—it’s important to be able to work with hierarchical structural information. SAMSON uses “node groups” to group nodes (like atoms or molecules) together. NSL lets you query these groups easily using the nodeGroup attribute space, abbreviated as ng.

This helps when you want to:

  • Select ligands based on name pattern
  • Filter out unselected groups
  • Apply operations only to matching node groups

Here’s a breakdown of the key attributes for node groups, defined in the ng attribute space:

1. ng.n – Filter by group name

The name attribute matches node group names. This is especially useful when your node groups are labeled meaningfully—for example, by molecule name or residue label.

You can match exact names or use wildcard characters. For example:

This gives you expressive power to select all node groups whose names start with L.

2. ng.selected – Match based on whether a group is selected

This attribute tells whether a node group is currently selected. It’s useful when combining manual selection with a script:

You can also exclude selected groups with:

Note: Unlike its counterpart in the node attribute space, this one does not have a short form like s.

3. ng.sf – Use the selection flag

This attribute corresponds to a selectionFlag parameter used to control whether a group is flagged in selection operations.

This is particularly effective for toggling visibility or grouping behavior programmatically.

How this improves your workflow

Rather than selecting atoms or bonds one by one or writing complex logic across different node types, you can now build simple filters that apply directly to node groups. This means faster isolation of ligands, water boxes, cofactors, membranes, and more—all without writing custom scripts or manually digging through the Structure View.

Here’s an example use case: suppose you’ve loaded a molecular complex and want to automatically isolate all ligands whose names begin with “L” and that are not currently selected. You’d simply use:

You can then act on that selection—hide it, export it, or prepare it for calculations. This makes NSL a functional and time-saving tool, especially for users handling many systems or working with high-throughput modeling workflows.

To learn more, you can consult the documentation page on node group attributes in NSL.

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

Comments are closed.