When working with complex molecular systems, selecting the right structural elements quickly can make a huge difference. Whether you’re modeling proteins, nucleic acids, or polymers, being able to filter backbone structures based on properties like visibility, selection, charge, or number of atoms helps streamline workflows and reduce visual clutter.
This is where the Node Specification Language (NSL) in SAMSON comes in handy. NSL allows you to define precise queries to filter nodes that match specific criteria. In this post, we’ll explore a particularly useful feature: how to filter backbones using short names for attributes in the NSL query language, giving you fine-grained control over your selections.
Why use short names in NSL?
Short names are abbreviations for attributes that make queries more concise and readable. This becomes especially useful when writing and iterating on filters during modeling sessions. Consider the difference between:
bb.numberOfAtoms < 500bb.nat < 500
The second version gets the job done with less typing, especially helpful when you’re running many queries in a tight loop or scripting sessions.
Examples of attribute filtering with short names
Here are a few real-world use cases where short attribute names shine when working with backbone structures:
- Hide invisible backbone groups:
not bb.vfilters out all backbones that are not visible. - Select groups with high partial charge:
bb.pc > 1.5filters only those with a partial charge above 1.5. - Look for highly carbonated fragments:
bb.nC > 20to find backbones with more than 20 carbon atoms. - Screen by name pattern:
bb.n "A*"to find backbones whose names start with ‘A’. - Exclude selected groups:
not bb.selectedfilters out what you’ve already selected.
Understanding attribute categories
The backbone attribute space combines attributes from both the node and structuralGroup attribute spaces. This gives access to properties that are general (e.g., visible, selected) and structural (e.g., numberOfAtoms, formalCharge), which you can combine as needed.
Here’s a helpful list of commonly used short names:
| Attribute | Short name |
|---|---|
| hasMaterial | hm |
| hidden | h |
| name | n |
| ownsMaterial | om |
| selectionFlag | sf |
| visibilityFlag | vf |
| visible | v |
| numberOfAtoms | nat |
| numberOfCarbons | nC |
| numberOfHydrogens | nH |
| numberOfNitrogens | nN |
| numberOfOxygens | nO |
| numberOfSulfurs | nS |
| partialCharge | pc |
Tips for effective filtering
Here are a few practical suggestions to help you make the most of short names:
- Use
:to define ranges:bb.nat 100:500 - Combine multiple filters with logical operators:
bb.v and bb.pc > 1.5 - Use
notto exclude unwanted parts:not bb.hfinds visible structures
These techniques are especially useful when working with large assemblies where filtering manually becomes inefficient. With short attribute names in NSL, you can script and query more efficiently—saving time and reducing the chance of errors.
To dive deeper into how these attributes operate and see more examples, visit the official documentation here: Backbone attributes — SAMSON Docs.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
