Stop hunting residue by residue: build precise selections with NSL

When a molecular structure contains hundreds or thousands of residues, finding the right ones by clicking through the model can become tedious—and it is easy to overlook a residue or select the wrong part of a structure. SAMSON’s Node Specification Language (NSL) offers a more reproducible approach: describe the residues you want using properties such as residue type, secondary structure, charge, sequence number, or backbone completeness.

Residue queries use the residue attribute space. Its short forms are res and r, so the examples below use the compact r form. You can use the longer attribute names when they make a query easier to read.

Start with a residue identity

If you know the three-letter residue code, filter by type. For example, r.t HIS matches histidines, while r.t LYS, PRO matches lysines and prolines. This is useful when a residue’s identity matters more than where it appears in the structure.

You can also use a residue query to identify a particular named atom within a residue type. The documented expression "CA" in r.t VAL matches alpha carbons, by name, in valines. That can be helpful when you need a specific atom from a known residue class rather than every atom in those residues.

Use structural context to narrow the search

Residue type alone may return more matches than you need. The secondaryStructure attribute, abbreviated r.ss, lets you describe a structural category: r.ss h selects residues in alpha helices, and r.ss a, b matches alpha-helical and beta-strand residues. The accepted aliases include helix for alpha and strand for beta; loop regions can be queried with r.ss loop.

For a backbone-quality check, r.caab refers to completeAminoAcidBackbone. It matches residues with complete amino-acid backbones. This gives you a direct way to identify residues by that documented structural property instead of relying on visual inspection alone.

Find residues by chemistry

NSL includes residue-level classifications that can help when the chemical category is more useful than the residue name. For amino-acid side-chain charge, use r.c: r.c neg matches residues with negative side-chain charge, while r.c neu, pos matches neutral or positively charged side chains. For polarity, r.p polar matches residues with polar side chains, and r.p acidic, basic matches residues with acidic or basic side chains.

These classifications are not the same as the total formal charge. If you need residues by formal charge, use r.fc; for example, r.fc 6:8 matches residues with formal charge between 6 and 8. For atom counts, inherited structural-group attributes include r.nat for number of atoms and r.nC, r.nH, r.nN, r.nO, and r.nS for counts of particular elements.

Make sequence-number searches explicit

When you already know a residue’s structure ID, r.id queries its residue sequence number. For instance, r.id == 42 matches residue number 42, and r.id 1:10, 20:30 matches the documented ranges. This can make a targeted inspection repeatable: keep the expression, then use it again rather than rebuilding the selection manually.

A practical way to work

Begin with the property that matters most: type, secondary structure, charge, or sequence number. Check whether the result is too broad, then refine the description using another relevant attribute. Keep in mind that the page distinguishes properties tied to the current residue or structure from properties that depend only on residue type. For example, sequence number and secondary structure describe structural context, while classifications such as amino-acid status, charge, polarity, and pKa values are listed as type-dependent.

NSL turns a selection into a readable description of what you are looking for. That makes it easier to inspect a structure systematically, revisit the same selection, and share the selection logic with a collaborator.

See the residue attribute reference to learn more.

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

Comments are closed.