Finding the Chains That Matter: Using NSL to Filter Molecular Chains by Attributes

Molecular modelers often need to extract specific chains from complex molecular systems—chains with a particular number of residues, chains that are visible, chains that follow a naming convention, and more. Manually browsing through large biomolecular structures to find the right chains isn’t just time-consuming—it also introduces human error.

The Node Specification Language (NSL) in SAMSON allows you to define precise criteria for selecting molecular chains, using powerful yet readable query expressions. In this blog post, we’ll explore how to filter molecular chains using their attributes through the chain attribute space of NSL. Whether you’re analyzing protein structures, building coarse-grained models, or preparing visualizations, these filters can significantly streamline your workflow.

What Is the chain Attribute Space?

The chain attribute space in NSL, accessible through the short name c, targets only chain nodes. This means any query you construct using these attributes will apply exclusively to chains, avoiding unintended results.

There are three types of chain attributes:

  • Attributes inherited from more general nodes
  • Attributes inherited from structural groups
  • Attributes specific to chains

Common Filtering Scenarios

Here are some realistic examples of how you might want to extract chains using NSL queries:

1. Chains by Name

To find chains with a specific name or that follow a pattern:

The second query selects chains whose names start with “L”—useful for comparing ligand chains across chains.

2. Chains with Specific Number of Residues

This is especially useful when filtering backbone chains versus shorter peptide chains in a simulation structure.

3. Filtering by Visibility

Want to focus only on what’s currently visible in your scene to simplify selection? These queries help apply colors, simulations, or material updates just to the relevant parts.

4. Filter by Atom Content

Use these to distinguish highly carbonated ligands from polar chains, or for selecting coarse-grained chains (in combination with c.ncga).

5. Selecting by Chain ID

Chain IDs often reference biological chains (e.g., A, B, C transformed into integers). These filters are direct and efficient.

Combining Multiple Filters

NSL lets you combine multiple conditions using and, or, and not. Example:

This query selects all chains with more than 100 residues that are visible—very helpful when preparing selective visualizations or exporting subsets.

Small Syntax, Big Impact

The NSL syntax is compact but expressive, letting you build precise queries with minimal typing. It saves time and adds confidence that your selections match your scientific goals.

For a complete list of chain attributes and detailed examples, visit the official SAMSON documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.

Comments are closed.