From “LYS” to the Right Residues: A More Reliable Selection Workflow

Few things interrupt molecular modeling like selecting what looks like the right region—then discovering the selection includes far more than intended. In a molecular document, names and structures form a hierarchy: a residue can have backbone and side-chain nodes beneath it. A broad text filter may match those child nodes too, leaving you with a selection that is technically valid but awkward to inspect, edit, or use in a downstream step.

Here’s a practical way to make selections more precise in SAMSON, check what you actually selected, and keep useful regions close at hand.

Start with the distinction between filtering and selecting

In the Document view, the Filter nodes… box can filter by a name string or by a Node Specification Language (NSL) expression. Typing a value narrows the displayed nodes; it does not immediately select them. Press Enter to select the nodes that match.

This distinction is useful when exploring a document: the filter helps you find candidates, while the selection is the set of nodes on which selection-based actions will operate. Before moving on, check the selection summary at the bottom of the Document view. You can also inspect selected nodes in the Inspector.

Filtering nodes in the Document View

Why a name search can select too much

Suppose you type LYS to find lysine residues. A string filter works against node names, so it can match not only the residues but also their backbone and side-chain nodes when those names contain “LYS.” In the example described in the documentation, searching this way selects 15 nodes even though there are only 5 LYS residues.

When you need the residue nodes themselves, use an NSL expression that specifies the node property rather than relying on a name match: residue.type LYS. The shorter form is r.t LYS. Enter the expression in the Document view filter and press Enter. This is a small change in the query, but it makes the intent explicit: select residues whose type is LYS.

Selecting nodes with a Node Specification Language expression

Choose the selection level before clicking

For viewport selection, the selection filter controls the node level at which the selection editor operates. For example, with the filter set to Residues, clicking an atom in the viewport selects at the residue level. With Atoms, Select all selects atoms; with Any node, it selects all selectable nodes in the document.

This setting matters when a click seems to select “too much” or when Select all returns a different kind of selection than expected. Check the filter in the viewport’s top-right corner before using the rectangle or point selection tools. For a rectangle selection, the deep-selection preference also determines whether nodes hidden behind other nodes can be selected; deep selection may take longer on large systems.

Selection filter menu in the viewport

Keep reusable queries and selections separate

If you often need the same kind of selection, save the NSL expression as a custom selection filter. Open Select > Find (or use Ctrl/Cmd + F), enter the expression, click Save, and give the filter a name. For instance, r.t LYS or r.t HIS can be saved as “LYS and HIS residues.” A saved filter is useful when you want to repeat a rule-based search.

If instead you want to return quickly to particular nodes you have already selected, use a Quick Group. Assign the current selection with Shift plus a number, then press that number to switch to the group’s selection. Double-pressing the number zooms to that group. Quick Groups are temporary and can be redefined; up to 10 are available. Think of a saved filter as a reusable search rule, and a Quick Group as a convenient way to revisit a chosen selection.

For a more durable named group, SAMSON can also save a selection as a group in the document. Groups reference nodes rather than containing them, so if referenced nodes are deleted, selecting the group selects only the nodes that still exist.

A quick checklist

  • Use a name string for quick discovery, but check whether it matches child nodes too.
  • Use an NSL property expression, such as r.t LYS, when you need a specific node type.
  • Press Enter after filtering to make the selection.
  • Check the selection summary and the viewport selection filter before acting.
  • Save recurring query rules as filters; use Quick Groups to revisit selections during a session.

For the full selection guide, see Selecting in SAMSON.

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

Comments are closed.