How to Quickly Filter Visible Backbones in Molecular Models

When navigating large molecular models, it’s easy to get visually overwhelmed. Whether you’re preparing publication images or managing a complex assembly, identifying and controlling which parts of your system are visible can save both time and energy.

In molecular design with SAMSON, working with backbone elements (like simplified representations of biopolymers or coarse-grained models) often requires toggling visibility or isolating certain components quickly. Fortunately, the Node Specification Language (NSL) provides a simple and readable way to express these conditions using attributes inherited from the node class — especially those related to visibility.

Understanding visibility-related attributes

Backbone nodes inherit multiple attributes you can use to query or filter based on their visual state. These are particularly helpful when writing NSL expressions:

Attribute Short name Description
visible v Returns true if the backbone is currently visible in the scene.
visibilityFlag vf Returns true if the visibility flag is enabled. This flag controls whether the node can be seen if other parent or global settings allow it.
hidden h Returns true if the node is explicitly hidden.

Common visibility queries

You can combine these attributes to write quick filters. Here are a few examples:

  • Show only visible backbones: bb.v
  • Select backbones set to be visible but currently hidden: bb.vf bb.h
  • Hide all currently undesired backbones from view: Use not bb.v or not bb.vf to filter them.

This approach makes it easy to rapidly isolate the visual state of different parts of your model without manually toggling options in the GUI.

Why care about visibility vs. visibilityFlag vs. hidden?

Sometimes a backbone may not appear in the viewport, but it’s not immediately clear why. That’s because visibility is determined by several overlapping settings:

  • visibilityFlag – If this is false, the node cannot be shown, regardless of any other visual settings.
  • hidden – If this is true, the node is hidden from view even if all other conditions would allow it to appear.
  • visible – This is the actual current rendering state. It reflects both the above, plus global visual controls and parent node settings.

So if your backbone isn’t appearing when it should, or vice versa, these attributes can help you debug and adjust your scene accordingly.

Try it in your own project

If you’re working with a model and want to make sure you’re only exporting or adjusting visible components, you can use the NSL expressions above to quickly find and group what you need. It’s a small trick that makes routine tasks significantly more manageable.

To explore more about these attributes and others available for backbones, visit the official documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON here.

Comments are closed.