Find the Label, Not the Noise: A Practical NSL Guide

When a molecular scene gets busy, labels can be easy to overlook—or accidentally include when you meant to work with other nodes. A focused Node Specification Language (NSL) query gives you a way to describe which labels you want to find, using properties such as name, visibility, and selection state.

The key is to start in the right attribute space. Label attributes live in label, abbreviated la, and this attribute space matches only label nodes. That makes la useful when your task is specifically about labels rather than nodes in general.

Start with the task

Before writing a query, decide what you need to isolate. Are you looking for a label by name? Do you want to check which labels are visible? Are you interested in selected labels, or labels with a particular selection flag? Turning the task into one property at a time makes the query easier to read and easier to adjust.

For example, the name attribute can be written in full as la.name, or with its short name as la.n. The reference page shows these example expressions:

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

Names are written in quotes. If you use the second example, treat "L*" as the documented example expression; consult the NSL reference if you need to confirm how name patterns are interpreted for your specific query.

Check visibility without guessing

Visibility is a common source of confusion when scanning a crowded scene. For labels, the visible attribute has the short name v. The documented examples are la.v and not la.v. The first expresses a query for labels whose visible attribute is true; the second uses not to express the opposite.

The related visibilityFlag attribute has the short name vf, with examples la.vf and la.vf false. Both visible and visibilityFlag are available in the label attribute space, but they are distinct attributes. When a query does not return what you expect, check that you used the property that matches the question you meant to ask rather than swapping one for the other.

Keep selection properties distinct

There are also two selection-related attributes in the label reference. selected is written as la.selected, or negated as not la.selected. Unlike several other attributes in the table, it has no short name listed for the label attribute space. selectionFlag does have a short name, sf; the examples include la.sf and la.sf false.

These names are not interchangeable in a query: the documentation lists them as separate attributes. If you are troubleshooting a selection-related query, try expressing the intended property explicitly and keep the two forms separate while checking your results.

A small, repeatable query routine

  1. Restrict the target type: use the la attribute space when you want label nodes.
  2. Choose one property: begin with a name, visibility, or selection attribute.
  3. Use the documented spelling: choose a full attribute name or its listed short name, and quote name values.
  4. Use negation deliberately: for example, compare la.v with not la.v when you want to check the opposite condition.
  5. Expand only when needed: once the single-property query is clear, build on it using the broader NSL language.

This stepwise approach is useful because it separates two questions: whether you are targeting labels, and whether the property you chose describes the labels you meant to find. It also gives you a simple way to inspect a query when its results are surprising.

All the attributes described here are inherited from the general node attribute space. The label reference lists the label-specific forms and their examples. Learn more in the label attributes documentation.

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

Comments are closed.