Quickly Identify Specific Files in SAMSON Using NSL

In large molecular modeling projects, keeping track of different data files can quickly become overwhelming. When you’re dealing with networks containing hundreds or thousands of files and nodes, being able to rapidly locate, filter, or select specific types of files becomes crucial for efficiency and clarity.

This is where the Node Specification Language (NSL) in SAMSON becomes especially valuable. NSL allows users to define patterns and queries to zero in on exactly what they need. An important aspect of NSL is its support for file attributes, which can significantly streamline your workflow by making it easy to query file nodes directly.

Understanding File Attributes in NSL

In SAMSON, file attributes are defined in the file attribute space (short name fi), and they apply strictly to file nodes in a document. With these attributes, you can write queries to match files based on their name or selection status.

Here’s a quick summary of the most commonly used file attributes:

  • Name (fi.n): Lets you filter file nodes by name using strings.
    • fi.n "A" matches files named exactly “A”.
    • fi.n "L*" matches all file nodes with names that start with “L”. The asterisk acts as a wildcard.
  • Selected (fi.selected): Filters based on whether a file node is selected.
    • fi.selected matches selected file nodes.
    • not fi.selected matches those that are not selected.
  • Selection Flag (fi.sf): Similar to fi.selected, allows for querying based on internal selection markers.
    • fi.sf false filters file nodes with an unset selection flag.

Why This Matters: A Workflow Example

Let’s say you’re working on a large supramolecular system and only want to export certain data files for further analysis. Instead of manually browsing through the structure or visually trying to select files, you can use the following query:

This line will instantly match all selected file nodes that have names starting with “Energy”, saving you time and eliminating human error.

These filters are also powerful when combined with scripts or automation tools within SAMSON, where you might want to process only a subset of files meeting certain criteria.

Helpful Tip

Remember that file attributes are inherited from generic node attributes in NSL, meaning you get the flexibility of general filtering logic with precision targeting for file nodes.

If you’d like to learn more about file attributes and how they integrate with NSL, see the official documentation page: https://documentation.samson-connect.net/users/latest/nsl/file/

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.

Comments are closed.