When working on molecular modeling projects with SAMSON, controlling the visibility of specific elements becomes crucial, especially in complex systems. Hidden nodes, visible nodes, and their related attributes can drastically improve how you handle large molecular structures, helping you focus on relevant elements of your model.
In this article, we will explore how the hidden and visible attributes of the Node Specification Language (NSL) in SAMSON can simplify visibility management. These attributes ensure you can fine-tune what stays in view and what remains hidden for better clarity while modeling.
Why Visibility Control Matters
Imagine working on a multi-component molecular system such as a protein-ligand complex. With thousands of elements displayed, your modeling environment might feel overwhelming. You may end up wasting time trying to find specific nodes of interest. Efficient visibility control allows you to highlight essential parts of the model, hide irrelevant ones, and streamline the analysis process.
SAMSON’s NSL offers two primary visibility-related attributes, hidden and visible, to help you manage nodes effectively.
The hidden Attribute
The hidden attribute (node.hidden, short name: n.h) allows you to identify nodes that are hidden. A node is considered hidden if its visibility flag is false or if one of its ancestor nodes is hidden.
For example, if you toggle a group of atoms as hidden, the visibility of the individual atoms within the group is also affected. This inheritable behavior helps in structuring visibility on a group-based level.
Usage examples:
node.hidden(short version:n.h): Matches hidden nodes.not node.hidden: Matches nodes that are not hidden.
The visible Attribute
The visible attribute (node.visible, short name: n.v) is the counterpart to hidden and identifies nodes that are visible in the scene. A node is visible if its visibility flag is set to true and all its ancestors are also visible.
This attribute is incredibly helpful when you want to focus on what is currently displayed in the molecular viewer, especially for dynamic environments where visibility might change frequently.
Usage examples:
node.visible(short version:n.v): Selects all visible nodes in the scene.not node.visible: Matches nodes that are not currently visible.
By combining these two attributes, you can create powerful expressions that allow you to alternate between hidden and visible nodes and focus on just the information you need.
A Practical Example: Focusing on Specific Node Types
Let’s assume you are working with a protein-ligand complex, and you want to focus only on visible nodes of type atom. Using NSL, you could write:
|
1 |
node.type atom and node.visible</code> (short version: <code>n.t a and n.v</code>) |
This expression will help you isolate all visible atoms, allowing for a more targeted analysis or visualization.
Conclusion
The hidden and visible attributes in SAMSON’s Node Specification Language allow for efficient and intuitive control over node visibility in complex molecular models. By combining these attributes with filters like type or category, you can streamline your workflow and focus better on relevant tasks.
For a complete reference and additional examples on visibility management, visit the official documentation page.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at SAMSON Connect.
