How to Easily Select Visible and Hidden Nodes in SAMSON

Molecular modelers often deal with complex systems that contain large numbers of nodes, such as atoms, bonds, and molecules, organized into hierarchical structures. Managing what is visible or hidden at any given time is crucial for effective and efficient molecular design. How can you quickly identify and select the visible and hidden nodes in a complex molecular scene within the SAMSON platform? This post offers a practical guide to two powerful attributes in the Node Specification Language (NSL): node.visible and node.hidden.

Understanding node.visible and node.hidden

The node.visible attribute allows you to select all nodes in your data graph that are currently visible. Visibility is determined by the node’s visibility flag being set to true, as well as the visibility of its ancestors. Conversely, the node.hidden attribute identifies nodes that are hidden, either because their visibility flag is false or an ancestor’s visibility flag is false.

Use Case: Simplifying Complex Models

Imagine working on a large biomolecular structure containing thousands of entities, from small ligands to extensive protein chains. By toggling the visibility of specific parts of the model, you can focus on areas of interest, but you might lose track of what is currently visible or hidden. These attributes let you quickly regain that context:

  • node.visible: Selects all visible entities, making it easy to understand what is actively displayed in the viewer.
  • node.hidden: Targets hidden nodes, facilitating operations like toggling visibility back on or organizing hidden elements.

Practical Examples

Here’s how you can make the most of node.visible and node.hidden in NSL:

1. Select All Visible Nodes

Use the following expression to select all currently visible nodes in your hierarchy:

Short version for quick access:

2. Select All Hidden Nodes

For selecting nodes that are currently hidden, use:

Short version:

3. Checking for Specific Flags

If more granular control is needed, consider combining visibility attributes with specific node types. For instance, you could target visible atoms:

Short version:

Why It Matters

Efficient selection of visible or hidden elements saves time, especially when working on intricate systems where organization is key. For example, troubleshooting interactions or preparing exportable visualizations becomes much smoother when you can quickly isolate or focus on visible components. Similarly, clearing or revisiting hidden nodes ensures that nothing important is overlooked.

Explore More

To dive deeper into the node visibility options and other NSL attributes, visit the complete SAMSON NSL documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. Discover the power of SAMSON for your molecular modeling needs by downloading it from samson-connect.net.

Comments are closed.