Filtering molecular folders by atom types and counts in SAMSON

Working with large molecular systems often means dealing with folders that contain thousands—or even hundreds of thousands—of atoms. Extracting meaningful subsets of these data, such as finding folders with specific numbers of atoms, carbons, hydrogens, or residues, can quickly become challenging. If you’re a molecular modeler who frequently organizes structures in SAMSON, there’s an efficient way to filter and query folders precisely and reproducibly using the Node Specification Language (NSL).

In this post, we’ll explore how to use folder-specific attributes in NSL to filter molecular folders based on atom counts and chemical composition. This can significantly simplify navigation in complex projects and speed up the selection process.

Why filter molecular folders?

Imagine you’re simulating interactions in a protein-ligand system and you want to isolate only the folders that include structures with more than 100 atoms and fewer than 10 carbons. Or perhaps you’re interested in identifying folders that contain more than one chain or a specific range of residues. These are typical tasks in structural modeling, and repetitive manual filtering takes time.

SAMSON’s NSL gives you precise control over these queries. Here’s how.

Available filtering attributes

Each folder in SAMSON can be queried using these NSL attributes. They accept integer values and ranges, allowing you to target folders quickly:

  • f.nat — Number of atoms
  • f.nC — Number of Carbon atoms
  • f.nH — Number of Hydrogen atoms
  • f.nN — Number of Nitrogen atoms
  • f.nO — Number of Oxygen atoms
  • f.nS — Number of Sulfur atoms
  • f.nc — Number of chains
  • f.nr — Number of residues
  • f.ns — Number of segments
  • f.nm — Number of molecules

Example use cases

Here are a few practical NSL expressions you can try in SAMSON:

  • f.nat > 100 — Folders containing structures with more than 100 atoms
  • f.nC < 10 — Folders with fewer than 10 Carbon atoms
  • f.nr 100:130 — Folders with residue counts between 100 and 130
  • f.nm 2:4 — Folders containing between 2 and 4 molecules
  • f.nN > 5 and f.nO > 5 — Folders with more than 5 Nitrogen and Oxygen atoms

One of the powerful features is the ability to combine these attributes logically, making the filtering as specific as needed.

Tips for efficient folder querying

  • Use short names like f.nH instead of folder.numberOfHydrogens for brevity.
  • Use ranges (e.g., f.nat 100:200) to capture variability in molecular data.
  • Combine filters with and or not to fine-tune your selection.

This feature is especially useful when working with datasets such as libraries of ligands, ensembles of structural models, or any project structured around folders containing different entities. Instead of browsing folder by folder, NSL lets you work at scale.

To learn more about all available folder attributes, visit the full documentation: https://documentation.samson-connect.net/users/latest/nsl/folder/

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

Comments are closed.