When building and analyzing molecular systems in SAMSON, one often needs to focus on specific structural components. For many research projects, this means hiding or revealing backbone structures to reduce visual clutter or highlight important elements. This seemingly simple action can be frustrating if you don’t know exactly how to do it efficiently using the Node Specification Language (NSL). Fortunately, SAMSON provides structured and powerful ways to control visibility using attributes.
Why visibility control matters
Imagine you’re working on a protein-ligand interaction project. The backbone might serve as helpful context at first, but as you dive into local binding interactions or sidechain dynamics, you may need to hide the backbone to focus more easily. Inversely, you might want to ensure that only backbones with certain properties—like charge or atom count—are visible to study specific features.
Visibility attributes for backbones in NSL
In SAMSON’s NSL, backbones belong to the backbone attribute space (short name: s) and are referred to as bb. Several visibility-related attributes inherited from the node attribute space allow you to select and manipulate visibility states smartly.
The key attributes to manage visibility include:
visible(v): Whether a node is currently visible on screen.visibilityFlag(vf): A flag that governs whether a node can be visible at all, depending on higher hierarchy settings.hidden(h): Whether a node has been manually hidden from view.
Using NSL to manage visibility
Here’s how to put these attributes into practice:
1. Hide all visible backbones
|
1 |
bb.v |
This selects all backbone nodes that are currently visible. Once selected, you can simply hide them using the “Hide” action in the interface.
2. Show backbones based on atom count
|
1 |
bb.vf bb.nat > 300 |
This selects backbone nodes that are allowed to be visible (via their vf) and contain more than 300 atoms. This is one way to declutter scenes by only working with larger structures.
3. Unhide all hidden backbones
|
1 |
not bb.h |
This selects backbones that have not been explicitly hidden.
4. Focus on backbones with visibility constraints
|
1 |
not bb.vf |
This lets you select backbone nodes that are prevented from being visible due to constraints from the parent node or group. This is useful when you can’t explain why something isn’t showing up.
Common pitfalls
It’s important to remember that visibility is determined by the combined effect of visible, visibilityFlag, and hidden. For instance, even if a node is marked as visible, it won’t render if its visibilityFlag is set to false due to hierarchical constraints (e.g., it’s inside a group that is not visible).
Quick tip
You can combine multiple conditions using logical operators. To select all backbone nodes that are visible and contain more than 500 atoms:
|
1 |
bb.v bb.nat > 500 |
Conclusion
By mastering a few simple NSL expressions, you can gain precise control over how and when backbone structures appear in your projects. This can streamline your workflow and help you prepare clearer visuals for presentations or publications.
Learn more about backbone attributes in SAMSON’s documentation.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
