Quickly Select Molecules by Properties in SAMSON Using NSL

If you’ve ever managed large molecular systems, you know how time-consuming it can be to manually identify and select specific molecules based on their features. Whether you’re isolating potential drug candidates, preparing a molecular visualization, or analyzing a biomolecular complex, being able to quickly filter molecules based on attributes such as the number of atoms, charges, or visibility can save you hours.

Fortunately, the Node Specification Language (NSL) in SAMSON allows for powerful, text-based search and selection of molecular nodes. The molecule attribute space in NSL (short name: mol) provides a rich set of properties for selecting molecules based on structural, visual, or user-defined characteristics—all without digging through menus or manually inspecting models.

Why this matters 🧪

Imagine you’re dealing with a large simulation that includes thousands of molecules. You want to quickly isolate all molecules that:

  • Have more than 100 atoms
  • Contain between 10 and 20 carbon atoms
  • Are currently selected or visible

This is now as simple as typing:

Done. No scripting necessary. Let’s dig into the attributes that make this possible.

Key Filters You Should Know

Structural Filters

Inherited from the structuralGroup space, these filters let you query fundamental molecular components:

  • mol.nat: Number of atoms (e.g. mol.nat > 500)
  • mol.nC, mol.nH, mol.nN, mol.nO, mol.nS: Number of specific atoms
  • mol.fc: Formal charge (e.g. mol.fc > 1)
  • mol.pc: Partial charge (e.g. mol.pc 1.5:2.0)
  • mol.ncga: Number of coarse-grained atoms

Molecule-Specific Filters

  • mol.nc: Number of chains (e.g. mol.nc 2:4)
  • mol.nr: Number of residues (e.g. mol.nr > 130)
  • mol.ns: Number of segments
  • mol.nsg: Number of structural groups

Visual and Interactive Filters

These come in very handy when creating visualizations or ensuring certain molecules are displayed or selected:

  • mol.v: Is visible
  • mol.h: Is hidden (e.g. not mol.h)
  • mol.selected: Is selected
  • mol.hm: Has material
  • mol.om: Owns material
  • mol.sf, mol.vf: Selection / visibility flags

Name-Based Filters

Filter molecules by name using wildcard expressions:

This matches any molecule whose name begins with “Ligand”.

Combine Filters for Maximum Control 🔍

The true power of NSL comes when you combine multiple filters using logical operators:

This line selects all visible molecules with more than 200 atoms and a positive formal charge.

Try It Yourself

Open SAMSON, use the NSL field, and start typing your queries. Once you get used to the short names, filtering molecules becomes a 3-second task instead of a 3-minute one.

To explore the full list of available molecule properties in NSL, see the full documentation here.

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

Comments are closed.