Find the Right Labels Without Losing Track of Them

Labels can be easy to overlook in a crowded molecular scene. When you need to isolate a particular label—or exclude labels that are already hidden or visible—searching manually can become a small but persistent interruption to your modeling workflow. SAMSON’s Node Specification Language (NSL) lets you describe which label nodes you want to match using compact expressions.

The key detail is that the label attribute space matches only label nodes. Its short name is la, so label queries begin with la. This gives you a focused way to work with labels rather than unintentionally querying other kinds of nodes.

Start with the label’s name

If you know the name you are looking for, use the name attribute, or its short name n. For example, the documented expressions include la.n "A" and la.n "L*". Put the value in quotation marks, as shown. This is a practical starting point when labels follow a naming scheme: first query by name, then refine the result with another attribute if needed.

For example, when reviewing a scene, you might begin with la.n "A" to focus your query on labels named A. If your naming convention includes labels such as those represented by the documented la.n "L*" expression, you can use that form as a starting point too. The exact matching behavior of name expressions depends on NSL’s string-matching rules; use the relevant NSL guidance when you need to confirm how a particular pattern is interpreted.

Filter by visibility state

Labels inherit the node attributes hidden and visible. Their short forms are h and v, respectively. The page’s examples show la.h and not la.h, as well as la.v and not la.v. These expressions give you a concise way to include or exclude labels according to the corresponding state.

This can be useful when a label is present in the scene but is not currently part of what you want to inspect. Instead of changing labels one by one just to locate a target set, express the state you want to match. For example, not la.v is the documented form for querying labels that do not match the visible condition. The query describes what to find; it does not, by itself, imply that the labels’ visibility will be changed.

Keep selection-related attributes distinct

There are two selection-related attributes in this label space: selected and selectionFlag. The page lists la.selected and not la.selected for the first, and la.sf or la.sf false for the second. A useful detail when writing queries is that selected has no short name in the label attribute space. In particular, the short name s is not available for it here.

That distinction matters when adapting a query from another context or trying to shorten an expression. Use the full selected attribute for label selection state, and use sf when you specifically mean selectionFlag. The two names are listed separately in the reference, so it is safer not to treat them as interchangeable.

A small, repeatable query routine

  1. Confirm the target type. Begin with la when the objects of interest are labels.
  2. Narrow by a known name. Use la.n followed by a quoted value, such as la.n "A".
  3. Add a state condition only when useful. Check la.h, la.v, la.selected, or la.sf and their documented forms.
  4. Use negation deliberately. Expressions such as not la.h and not la.v express the opposite condition, which can make an exclusion query easier to read.

This routine helps keep a label query understandable: specify the node type, identify the name or state you care about, and avoid substituting one attribute for another simply because their names sound similar. The label page is a compact reference for the available attributes, their short names, and example expressions.

For the full attribute list and examples, see the SAMSON label NSL reference.

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

Comments are closed.