Taming Label Clutter: Find the Right Molecular Labels with NSL

Labels can make a molecular scene easier to read—until they overlap, disappear from view, or become hard to distinguish by name. When you need to inspect labels systematically, clicking through the scene one at a time can be tedious. SAMSON’s Node Specification Language (NSL) offers a more targeted approach: query label nodes by attributes such as name, visibility, and selection state.

Start with the label namespace

The label attribute space matches only label nodes. Its short name is la, so label queries begin with that prefix. For example, la.n "A" uses the label’s inherited name attribute, while la.v uses its visible attribute.

This scope is useful when a scene contains many kinds of nodes. Instead of searching among all nodes, you can focus the query on labels and use the attributes that matter for your current task.

Search by label name

If you know a label’s name, the name attribute is a natural starting point. The documentation gives these examples:

  • la.n "A"
  • la.n "L*"

Use a name query when you want to narrow your attention to labels with a recognizable name. The reference shows the quoted string form and includes an asterisk in one example; consult the NSL examples page for broader expression guidance before relying on particular matching behavior.

Check what is visible—or hidden

When labels are difficult to find in a crowded view, visibility-related attributes can help you inspect their state. The label reference lists visible (short name v) and hidden (short name h). It shows these expressions:

  • la.v and not la.v
  • la.h and not la.h

These are useful starting points for distinguishing visible from non-visible labels, or hidden from non-hidden labels. The two attributes are both available in the label attribute space; use the attribute that matches the question you are asking rather than assuming they are interchangeable.

Keep selection attributes distinct

The reference also lists selected and selectionFlag. For labels, selected does not have the short name s; the page shows la.selected and not la.selected. The selectionFlag attribute has the short name sf, with examples la.sf false and la.sf.

Because these are listed as separate attributes, keep their names explicit while building a query. That small habit makes expressions easier to read later and reduces the chance of confusing a node’s selected state with its selection flag.

A practical way to approach label searches

When a label seems missing or hard to locate, work through a short checklist:

  1. Confirm that you are querying labels with the la prefix.
  2. Try the label’s name with la.n and a quoted string.
  3. Inspect visibility using la.v or not la.v.
  4. If relevant, check hidden state with la.h or not la.h.
  5. Use la.selected or the la.sf selection-flag form when investigating selection-related state.

This approach turns an ambiguous visual problem—“Where did that label go?”—into a series of specific questions about label nodes and their attributes. It also gives you compact expressions you can reuse when troubleshooting a scene.

For the complete attribute table and inheritance details, see the SAMSON label attributes reference.

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

Comments are closed.