Visible, Yet Missing? Debugging Molecular Scene Visibility with NSL

A molecule can seem to disappear for reasons that are easy to confuse: its own visibility may be off, or it may inherit hidden state from a parent in the scene hierarchy. When you are inspecting a large molecular model, checking every node by hand is slow—and changing the wrong setting can make the scene harder to understand.

SAMSON’s Node Specification Language (NSL) lets you query visibility at two different levels: the node’s effective visibility and its visibility flag. Knowing which one you are asking about is the key to tracking down what is hidden.

Effective visibility versus the flag

Use node.visible, or its short form n.v, to match nodes that are actually visible. A node is visible when its visibility flag is true and its ancestors are visible. In other words, a node with its own flag turned on can still be effectively hidden because an ancestor is hidden.

To find nodes that are currently not visible, query:

not node.visible

The short form is not n.v. This is a useful first check when something you expect to see is missing: it asks about the outcome in the hierarchy, rather than only the node’s local setting.

By contrast, node.visibilityFlag (short form n.vf) checks the node’s own flag. For example:

  • node.visibilityFlag false finds nodes whose own visibility flag is off.
  • node.visibilityFlag true finds nodes whose own visibility flag is on.

These queries answer different questions. A node with a true visibility flag is not necessarily visible in the scene, because a parent may have its flag set to false. That distinction helps explain a common puzzle: “Why is this node marked visible, but I still can’t see it?” Check the effective state with node.visible, not just the local flag.

A practical way to narrow down the problem

  1. Start with the visible state. Query not node.visible to identify nodes that are effectively hidden.

  2. Check the local flag. Query node.visibilityFlag false to find nodes whose own flag is off.

  3. Compare the results. If a node is not visible but its own flag is true, the hierarchy matters: an ancestor’s visibility flag may be false.

This approach separates two causes without treating them as interchangeable. It also avoids assuming that every hidden descendant has its own flag turned off.

Make the query more specific

Node attributes can be combined with node types. For instance, node.type atom and not node.visible expresses the goal of finding atoms that are not visible. The abbreviated type form is n.t a, and the visibility shorthand is n.v. NSL also supports category queries, so you can narrow a visibility check to a category such as ligand with node.category ligand (short form n.c lig).

For example, node.type atom in node.category ligand matches atoms in ligands; adding a visibility condition can help focus the investigation on the nodes relevant to your task. The key is to keep the question precise: are you looking for atoms, a structural category, nodes with a local flag off, or nodes that are effectively hidden?

The same hierarchy idea applies to selection

Visibility is not the only state that can be inherited. node.selected (n.s) matches nodes selected either directly or through an ancestor’s selection flag. node.selectionFlag (n.sf), on the other hand, checks the node’s own selection flag. As with visibility, distinguishing effective state from a local flag can make hierarchy-related results easier to interpret.

When a model looks incomplete, begin with the effective state, then inspect local flags and the hierarchy. That small distinction can turn a frustrating visual mystery into a clear, testable query.

For the full list of node attributes and examples, see the SAMSON NSL node attributes reference.

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

Comments are closed.