Quickly Select Specific Node Groups with NSL in SAMSON

Managing and editing complex molecular models often requires selecting and organizing multiple node groups—whether you’re structuring a pathway, setting up a simulation, or preparing visualizations. But if you’ve ever found yourself manually clicking through chains of groups to isolate just a few, you know how time-consuming that can be. This is where NSL (Node Specification Language) in SAMSON can save you time, especially through the use of node group-specific attributes.

What Are Node Groups in SAMSON?

In SAMSON, a node group is a container used to group other nodes, such as atoms, molecules, or even other groups. By using NSL, a user can write concise expressions to directly target specific node groups based on their attributes.

Why This Matters

As molecular models grow in size and complexity, precise selection becomes tedious without robust query tools. With NSL’s node group attributes, you can target groups based on their name, selection status, or a selection flag parameter—making batch operations like renaming, coloring, transforming, or exporting a lot easier.

Getting Started: Attribute Namespace ng

To specify attributes that apply to node groups specifically, use the ng namespace in your NSL queries. For instance, ng.n "MyGroup" finds any group named MyGroup.

1. name Attribute

This attribute is inherited from the general node.name attribute space and allows you to select groups with a given name or using wildcard matches.

  • ng.n "GroupA" – select node group named “GroupA”
  • ng.n "L*" – select all groups whose names start with L

2. selected Attribute

This boolean attribute reflects whether a node group is currently selected.

  • ng.selected – selects all node groups that are selected
  • not ng.selected – selects all groups that are not selected

3. selectionFlag Attribute

This is another boolean value that indicates a flagged selection state. It’s useful for tagging groups for temporary or conditional operations.

  • ng.sf false – selects all node groups with selectionFlag set to false
  • ng.sf – shorthand for ng.sf true

Common Workflow Example

Here’s a simple example. Suppose you want to rotate all node groups beginning with “Lig” that are not currently selected. Your NSL query would look like:

Select them with this query, and then apply the transformation or visualization step you need. This enables incredibly precise control without having to visually inspect each node group.

Final Tip: Combine with Other NSL Attributes

Because NSL is composable, you can also combine node group attributes with other node-level selections—filtering within groups or across structural hierarchies. Becoming familiar with just a few attributes like ng.n, ng.selected, and ng.sf can quickly improve how you manage your projects in SAMSON.

To learn more and see the full documentation, visit the official SAMSON documentation page.

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

Comments are closed.