Find the residues that matter: practical filtering with SAMSON NSL

A molecular structure can contain thousands of residues, and the one you need may be defined by more than its name. Perhaps you want to inspect only lysines, locate residues in beta strands, or find residues with a particular formal charge. Clicking through a structure one residue at a time is slow—and it is easy to miss candidates.

SAMSON’s Node Specification Language (NSL) lets you describe residue-level criteria with compact queries. Residue attributes use the residue space, shortened to res or r. The examples below show how to turn common modeling questions into searchable expressions.

Start with residue identity

When you know which amino acid types matter, use the type attribute. For example, r.t LYS matches lysines, while r.t LYS, PRO matches lysines and prolines. This is useful for quickly finding residues you may want to inspect in a binding site, mutation plan, or sequence-to-structure comparison.

Residue type is not the same as residue name. The inherited name attribute matches the residue’s name as a string; the type attribute uses recognized residue codes such as ALA, HIS, and VAL. For standard-name checks, r.srn matches residues with standard PDB residue names, and r.nsrn matches those without them.

Filter by structure, not just identity

For questions about protein shape, use secondaryStructure. The query r.ss h finds residues in alpha helices; r.ss a, b finds residues in alpha helices or beta sheets. The aliases make queries shorter, but the full names—such as helix and strand—are also supported.

To find residues at the ends of chains, try r.ter. To check for a complete amino-acid backbone, use r.caab. These attributes can help narrow a structure inspection to residues whose structural context is relevant. The backbone query is about completeness; it does not, by itself, identify a particular amino acid type.

Distinguish two kinds of charge

Charge is a common source of confusion because NSL exposes different concepts. r.c neg selects amino-acid residues with a negatively charged side chain; r.c neu, pos selects residues with neutral or positively charged side chains. These are categorical side-chain classifications.

By contrast, r.fc refers to a residue’s total formal charge and accepts integer comparisons or ranges—for example, r.fc > 1 or r.fc 6:8. If the question is about side-chain chemistry, use r.c; if it is about the formal charge value, use r.fc. They answer different questions.

Use ranges for numeric properties

Numeric attributes let you focus on a measured or counted property instead of a named residue. For example, r.nat < 1000 filters by atom count, and r.nC 10:20 filters by carbon count. Partial charge can be queried with expressions such as r.pc > 1.5. For amino-acid hydrophobicity, r.hydrophobicity < 0 selects values below zero.

Sequence numbering is another practical filter: r.id == 42 matches residue number 42, while r.id 1:10, 20:30 covers two number ranges. This can be handy when a paper, model, or analysis refers to residue positions. Keep in mind that sequence numbering is the structure ID, so it may not always correspond directly to a sequence position in another file or reference.

A small workflow for clearer queries

  1. Write down what you mean: residue identity, structural location, side-chain category, or a numeric measurement.

  2. Choose the corresponding attribute rather than relying on a similar-sounding one—for example, side-chain charge versus total formal charge.

  3. Try a focused query, then broaden or refine the criteria as needed. When selecting atoms inside matching residues, NSL also supports expressions such as n.t a in r.aa for atoms in amino-acid residues, or "CA" in r.t VAL for alpha carbons in valines.

Residue attributes include inherited node and structural-group properties as well as residue-specific properties. That means the same residue query space can cover visibility, selection state, atom counts, residue type, and structural features. For the full attribute list and syntax details, see the SAMSON residue attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.