A ligand-contact selection sounds simple: choose everything within a few angstroms. In practice, that first selection can mix together receptor atoms, waters, hydrogens, and whole residues. The result may be too broad to interpret—or may hide the distinction you actually care about, such as direct contacts versus water-mediated ones.
In SAMSON, Node Specification Language (NSL) lets you build these selections by combining a target, a structural context, and a distance condition. The examples below show a practical way to move from a broad neighborhood to a more focused analysis.
Start with the question, not just the cutoff
First decide what should be selected. Are you looking for ligand atoms, receptor atoms, or residues? Those are different targets, even when they are defined using the same distance.
(n.t a in n.c lig) w 2A of n.c recselects ligand atoms within 2 Å of the receptor. It is useful for spotting very tight contacts.(n.t a in n.c rec) w 5A of n.c ligselects receptor atoms within 5 Å of the ligand.(n.t r w 5A of n.c lig)selects residues near the ligand, rather than only the atoms that make the closest approaches.
This distinction matters when you compare or communicate results: a residue-level selection helps identify which parts of the protein surround a ligand, while an atom-level selection is more specific about the contact geometry.
Build the selection in layers
A useful pattern is to define the population first, then add the distance condition. For example, n.c rec identifies the receptor context, and n.c lig identifies the ligand context. The expression (n.t a in n.c rec) w 5A of n.c lig can be read as: select atoms, restrict them to the receptor, and keep those within 5 Å of the ligand.
Adding filters lets you make the selection more relevant to a specific question. To focus on non-hydrogen ligand atoms for contact analysis, use (n.t a in n.c lig) and not a.s H. To inspect receptor backbone nitrogen atoms near the ligand, use (a.s N in n.t bb) w 3A of n.c lig. These expressions keep the distance cutoff tied to a clearly defined chemical or structural subset.
Separate direct contacts from water involvement
Water can complicate a simple contact list. A water molecule close to a ligand is not automatically a bridge between ligand and receptor. To look for water oxygens within 3 Å of both, use:
(a.s O in n.c wat) and (n.t a w 3A of n.c rec) and (n.t a w 3A of n.c lig)
The first part restricts the selection to oxygen atoms in water. The remaining conditions require proximity to both receptor and ligand. This makes the question more precise than selecting all waters near the ligand with n.c wat w 4A of n.c lig, which is useful for finding nearby waters but does not, by itself, identify bridges.
Use exclusions deliberately
NSL also supports selections that combine an inner neighborhood with an exclusion zone. For example, (n.t r w 12A of n.c lig) and (n.t r b 7A of n.c lig) describes residues within 12 Å but beyond 7 Å, a way to examine a pocket rim rather than the closest shell. Similarly, the example (n.t a in n.c lig) b 6A of n.c rec selects ligand atoms beyond 6 Å from the receptor.
When exclusions are involved, check that the selected object is still the one you intend. An atom-level distance expression and a residue-level distance expression answer different questions, even if they use the same numerical cutoff.
A quick selection checklist
- Choose the output level: atoms, residues, or another structural group.
- Set the relevant context, such as receptor, ligand, or water.
- Choose a distance that matches the question, rather than reusing one automatically.
- Add chemical filters—such as element or backbone identity—only when they clarify the analysis.
- For “between” or “not contacting” questions, state both the inclusion and exclusion conditions explicitly.
This approach helps turn a broad proximity query into a selection that is easier to interpret and reproduce. For more NSL patterns, see the NSL examples documentation.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
