Finding the Right Molecules: Filtering by Attribute in SAMSON NSL

When working with large and complex molecular systems, one of the common challenges is isolating the subset of molecules you actually want to focus on. For example, you might want to visualize only visible molecules, work with compounds that contain more than 100 atoms, or discard coarse-grained molecules from your selection. Doing this manually can be time-consuming. Fortunately, the Node Specification Language (NSL) in SAMSON provides a flexible way to filter molecules based on a wide variety of attributes.

This blog post explores how to use NSL filters, specifically with the mol attribute space, to quickly find just the molecules you’re looking for.

Why Filtering Matters

As molecular systems grow in scale and complexity—think biomolecular complexes or large polymer systems—you end up with hundreds or thousands of molecules. In these situations, GUI-based selection becomes inefficient, and precise, scriptable filtering becomes essential.

Using NSL expressions in SAMSON, it’s possible to match molecules with precise attribute combinations and reduce cognitive load during modeling and analysis.

The mol Attribute Space

To filter molecules specifically, NSL uses the molecule or mol attribute space. This allows you to write targeted expressions like:

  • mol.visible – matches visible molecules
  • not mol.hidden – same as above, expressed differently
  • mol.nat > 100 – molecules with more than 100 atoms
  • mol.pc 1.5:2.0 – molecules whose partial charge lies in a range

Common Filtering Scenarios

Here are a few practical selection cases that chemists and modelers frequently encounter:

Hide All Invisible or Coarse-Grained Molecules

This matches molecules that are either invisible or use coarse-grained atoms. You can hide or delete them to declutter your workspace.

Select Molecules with More Than One Chain

Great when working with multimeric proteins or supramolecular complexes.

Filter by Residue Count

Useful for selecting medium-sized proteins or filtering out large ones.

Isolate Small Organic Molecules

Helps when distinguishing ligands from large biopolymers.

Quick Reference Table

Some useful attributes from the mol space:

Attribute Short Name Purpose
numberOfAtoms nat Atom count
partialCharge pc Total partial charge
numberOfChains nc Number of chains
numberOfResidues nr Residue count
visible v Visibility status
numberOfCarbons nC Carbon atom count

Combining Conditions

You can build compound filters using logical operators like and, or, and not. For example:

This matches small, visible molecules.

Tip: Use wildcards when filtering by name: mol.n "Ligand*" matches molecules whose names start with “Ligand”.

Wrapping Up

Mastering molecule attribute filtering within SAMSON’s NSL can drastically streamline your modeling workflow. Whether your aim is to isolate ligands, remove clutter, or verify charge balance, the mol attribute space offers the flexibility required for a wide range of scientific tasks.

To dive deeper into available molecule attributes and see more examples, view the official molecule attribute documentation.

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

Comments are closed.