How to Precisely Select Structures with NSL in SAMSON

Selecting specific molecular components can often feel overwhelming when working on large macromolecular complexes. You might be looking to isolate only atoms in ligands, or visualize hydrogens within water molecules. Knowing how to express those search criteria accurately can save you a lot of manual effort.

That’s where SAMSON’s Node Specification Language (NSL) shines. Today, we’ll focus on a part of NSL that directly addresses this challenge: node attributes and categories. These allow you to construct expressive, yet succinct, queries to select atoms, residues, visual models, and more — based on their properties and relationships.

Targeting the Right Nodes with Categories and Types

Let’s say you want to select all ligand atoms. The expression is simple:

Or its short form:

This tells SAMSON: find all nodes of type atom that belong to nodes of category ligand. The key idea here is readability and reusability. This logic can just as easily be expanded to atoms in any structural group, such as lipids or glycans.

Level Up: Combine Categories for Powerful Selections

For example, to select all atoms in either glycans or lipids:

This even works for nested structures. You could find all hydrogens in lipids, using:

This compact language allows you to express complex queries in a direct and semantic way.

Use Short Names for Speed, Full Names for Readability

Most attributes have convenient short names. For instance, node.visible becomes n.v, and node.lockedFlag becomes n.lf. Mixing full and short versions is perfectly valid:

This allows users at different familiarity levels to adopt the notation comfortably.

Visual Model Categories for Display Control

Ever wanted to select only elements shown in a particular rendering style? NSL supports this by allowing categories like vanDerWaals (vdw) or licorice (lic):

Use this to highlight specific styles or to clean up your visualization by hiding selected models.

Quick Recap of Useful Attribute/Category Combos

  • n.om: nodes that own material
  • n.hm: nodes that have material inherited or owned
  • n.h: hidden nodes
  • n.sf true: nodes with selection flag set to true
  • n.n "L*": nodes with names starting with “L”

Why This Matters

Whether you’re preparing visualizations, exporting selections, or applying materials, fast and accurate filtered selection is key. NSL’s attribute system saves you from dozens of clicks and lets you focus on the actual science.

Ready to try this out on your own data? Browse the full NSL node attribute documentation to learn about every option available.

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

Comments are closed.