For molecular modelers, navigating through complex molecular datasets or visualizing intricate molecular structures can often be challenging. Fortunately, SAMSON, the integrative molecular design platform, offers a robust solution through the Node Specification Language (NSL). One of the most important and useful aspects of NSL is the ability to leverage node attributes for defining, querying, and manipulating molecular data. Let’s delve into how node attributes can simplify your work.
What Are Node Attributes?
Node attributes in SAMSON are key-value pairs associated with nodes in a molecular data graph. They enable users to specify, query, and filter nodes based on various properties like visibility, selection, or node type. Attributes belong to the node attribute space (short name: n), making them universally applicable across different node types—including atoms, bonds, and molecular structures.
For instance, consider the attribute selectionFlag. This attribute can be used to identify nodes that are currently selected in the molecular design environment. For practical use, the NSL expression node.selectionFlag true (or its short form n.sf true) matches any selected node, regardless of its type.
How Do Node Attributes Help?
Node attributes are particularly valuable for modelers who need to:
- Hierarchically organize molecular data
- Easily identify specific structures, atoms, or groups
- Enhance visibility by toggling structures or selecting hidden components
The attributes span a wide range of categories, including identity (e.g., name), states (e.g., locked, visible), and categories of structural or visual properties.
Examples of Node Attributes
Here are a few common use cases to showcase the practical power of node attributes:
- Selection: Use
node.selected(short:n.s) to match nodes that are selected. Example:n.smatches all selected nodes. - Visibility: The
node.hidden(short:n.h) attribute can identify hidden nodes. For instance, the expressionn.hmatches nodes that are hidden due to their visibility flags. - Node Categories: The
categoryattribute (short:c) groups nodes, such asligandorwater. Example: The expressionn.c ligmatches all nodes categorized as ligands.
Key Attributes to Know
Here’s a brief overview of some essential attributes to incorporate into your workflows:
name(n.n): Matches nodes based on their names. Supports wildcards. Example:n.n "L*"matches nodes with names starting with ‘L.’locked(n.l): Matches locked nodes. Example:n.l.hasMaterial(n.hm): Identifies nodes with applied or inherited materials. Example:n.hm.type(n.t): Identifies node types such asatom,bond, orresidue. Example:n.t a.
Next Steps
Node attributes in SAMSON offer remarkable versatility and can significantly reduce the overhead of working with large and complex molecular datasets. By mastering these attributes, you can streamline tasks such as identifying key structures, toggling visibility, or applying actions selectively to specified components.
To explore the full list of node attributes and their potential applications, visit the documentation page.
**SAMSON and all SAMSON Extensions are free for non-commercial use.** You can download SAMSON from here.
