Filtering Molecules by Attributes in SAMSON: A Practical Guide

If you’ve ever imported a molecular system in SAMSON and found yourself overwhelmed by the amount of molecular data—whether you’re working on a drug discovery project, designing nanostructures, or analyzing macromolecular interactions—you probably wished you could filter and isolate only the molecules you need.

Good news: you can. Using the Node Specification Language (NSL), researchers can define specific molecule attributes to select only relevant molecules. This blog post will walk you through targeted molecule selection using key attributes—helping reduce clutter and focus on what matters most in your system.

Why attribute-based filtering is useful

Imagine importing a large biomolecular system that includes water molecules, ions, peptide chains, and ligands. You’re interested only in chains with a significant number of residues or perhaps molecules containing sulfur atoms. Manually selecting them is tedious—and error-prone. Using NSL, however, you can define filters in seconds, for example:

  • Find all molecules with more than 200 atoms
  • Select only visible molecules with more than 2 chains
  • Exclude small solvent molecules (e.g., fewer than 10 carbons)

How to filter with attributes

To filter molecules in SAMSON, you can use NSL expressions prefixed by the molecule or mol keyword. Each molecule attribute allows you to define whether a molecule should be included based on its numerical or boolean properties.

Examples of molecule attributes

Attribute Short name Filter Syntax Use Case
numberOfAtoms nat mol.nat > 200 Select large molecules
numberOfCarbons nC mol.nC 10:20 Select mid-sized organics
numberOfChains nc mol.nc > 1 Select multi-chain proteins
visible v mol.v Keep only visible molecules

Combining multiple filters

You can compose multiple constraints using logical expressions. For example:

This selects visible molecules with more than 200 atoms and fewer than 40 carbon atoms.

Tips for effective filtering

  • Speed up selections: Instantly isolate the relevant parts of a complex structure for visualization or analysis.
  • Combine visibility and material flags: Use mol.v and mol.hm to pick out molecules that are both visible and have rendering materials.
  • Range queries: Use colon syntax (e.g., mol.nC 10:20) to select based on range values.

Making your selections actionable

After applying filters in the SAMSON Selection window or search bar using NSL queries, you can:

  • Hide or delete the rest
  • Apply force field assignments
  • Run simulations or structural analysis only on selected components

In summary, selecting molecules based on structural or visibility attributes in SAMSON using NSL can make your modeling workflows cleaner, faster, and more focused. This small investment in composition rules pays off every time you load a complex scene.

To learn more, visit the full documentation page on Molecule attributes in NSL.

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

Comments are closed.