For molecular modelers, selecting specific molecular structures and groups for analysis can often be a time-consuming and error-prone task. SAMSON’s Node Specification Language (NSL) offers a solution by enabling precise and efficient selection of nodes, such as atoms or residues, based on their properties. A particularly useful feature of NSL is its support for logical operators, which allow users to perform operations on complex sets of nodes.
What Are Logical Operators in NSL?
Logical operators in NSL are tools you can use to refine your selections by combining or excluding conditions. Whether you’re dealing with large biomolecules, intricate ligands, or receptor structures, these operators help you define exactly what you need with pinpoint accuracy. Four logical operators are available in NSL:
and: Select nodes satisfying multiple conditions.or: Include nodes that meet at least one of multiple conditions.not: Exclude nodes that satisfy a specific condition.xor: Select nodes satisfying one condition OR another, but not both.
Why Logical Operators Are Useful
Imagine you’re analyzing a protein structure with hundreds of residues. Perhaps you want to select residue nodes that are not alanine but are hydrophobic. Or maybe you’re studying structural groups and need to refine your selection further based on atomic composition. Logical operators help you combine these conditions effortlessly, without manually inspecting every node or writing lengthy queries.
Practical Examples
Below are actionable NSL examples using logical operators:
n.t r and not r.t CYS: Matches all residues except cysteine residues. Always combinenotwith a preceding condition to avoid accidentally selecting non-relevant nodes, like folders.sg.id 1000:1040 and sg.nat < 4: Picks structural groups with IDs between 1000 and 1040 that contain fewer than four atoms.n.t r or r.t ALA: Selects all residue nodes and any nodes specifically typed as alanine residues.a.sn >= 20 xor a.oc >= 0.5: Matches atoms with a serial number greater than or equal to 20 or an occupancy greater than or equal to 0.5, but excludes atoms that satisfy both conditions.
Tips for Effective Use
1. Combine operators thoughtfully: By creatively layering operators like and and not, you can create very specific queries to match your needs.
2. Mind not‘s behavior: Without a preceding logical condition, using not alone may return unintended nodes like container and folder nodes. Always include a broader condition like n.t r (node type residue) to filter properly.
3. Debug queries iteratively: Start with a simpler query to verify results before adding more logical operators for refinement.
See Logical Operators in Action
Below is an example NSL expression selecting residues that are hydrophobic and also within specific residue IDs:
n.t r and r.hy true and r.id 50:100
This query simplifies selecting residue nodes that meet three conditions: they must be residues, hydrophobic, and their ID ranges between 50 and 100.
Unlock More with NSL
Logical operators in SAMSON’s Node Specification Language open up exciting possibilities for researchers working with complex molecular datasets. For a deeper dive into NSL’s rich syntax and other capabilities, visit the original documentation page at https://documentation.samson-connect.net/users/latest/nsl/.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON at https://www.samson-connect.net.
