Effortlessly Select Nodes with SAMSON’s Node Specification Language (NSL)

Molecular modelers often face the challenge of efficiently selecting specific structures—ligands, receptors, atoms, residues, or even specific categories of nodes—within complex molecular designs. If you’ve ever struggled to single out precisely the nodes you need in a vast network of molecular data, SAMSON’s Node Specification Language (NSL) offers a powerful and flexible solution.

In this post, we’ll introduce SAMSON’s NSL and explore its capabilities for search-driven node selection and filtering. With practical examples and tips for beginners, you’ll learn how to use NSL to make your molecular workflows faster and more efficient.

What is NSL?

The Node Specification Language (NSL) in SAMSON allows users to define precise conditions for selecting nodes based on their attributes. From filtering hydrogen atoms to specifying proximity-based selections, NSL is a versatile tool that empowers you to handle even the most complex selection scenarios.

NSL expressions can be used in two main contexts in SAMSON:

  • Select > Find: Use search queries to pinpoint and select specific nodes. For example, locate all ligands or all residues of a certain type with ease.
  • Document View Filter: Interactively filter nodes by entering NSL expressions, directly refining your molecular model’s visibility.

First Steps with NSL

For those new to NSL, starting with simple expressions can help you get comfortable with its syntax. Try these sample expressions:

  • node.type residue: Select all residue nodes.
  • C or H: Select all carbon and hydrogen atoms.
  • "CA" within 5A of S: Select nodes named “CA” within 5 angstroms of any sulfur atom.
  • node.category ligand, receptor: Select nodes classified as ligands or receptors.

Why NSL Is Powerful for Molecular Modelers

NSL’s strength lies in its flexibility, supporting advanced query structures such as:

  • Proximity Operators: For example, residue.id 20:40 beyond 5A of atom.symbol S selects residues with IDs from 20-40 that are beyond 5 angstroms of any sulfur atom.
  • Logical Operators: These allow for combination queries like n.t r and not r.t ALA, selecting all non-alanine residues.
  • Wildcards and Regular Expressions: For matching names, you can use glob syntax (e.g., "ALA*") or more advanced regular expressions (e.g., re"[A-Z]{3}" to match three-letter residue names).

Interactive AI Assistance

To make NSL even more accessible, SAMSON includes an AI Assistant feature. This tool can generate NSL expressions tailored to your active document. Simply click the Ask AI Ask AI button in the selection input or Document View filter to leverage the AI Assistant for smart, context-aware queries.

Example Use Case

Imagine you’re analyzing a protein-ligand interaction and need to identify all residues within 5 angstroms of a ligand. Using the NSL expression residue within 5A of node.category ligand, you can quickly specify and visualize the key residues involved in the interaction. This saves significant time compared to manual selection and ensures accuracy.

Learn More

SAMSON’s NSL is packed with additional features, including specification by attributes, topological proximity operators, and length or mass unit filtering. To take your mastery of NSL further, visit the official documentation page. Here, you’ll find detailed examples and explanations to empower your molecular modeling workflows.

SAMSON and all SAMSON Extensions are free for non-commercial use. Learn more and download SAMSON from SAMSON Connect.

Comments are closed.