Quickly Identifying Files of Interest in Molecular Projects

As molecular modeling projects grow, so does the number of files within them. If you’ve ever found yourself scrolling endlessly through a complex data tree in SAMSON just to locate the right file, you’re not alone. Fortunately, the Node Specification Language (NSL) in SAMSON offers efficient ways to filter and query nodes, including files, based on specific attributes.

This post will focus on file attributes used in NSL and how they can help you stay organized, save time, and make your modeling workflow more effective. We’ll explore how to rapidly locate specific files through simple NSL expressions based on a subset of the fi (file) attribute space.

Why Filter Files with NSL?

Imagine you’ve loaded a molecular project containing dozens of simulation result files, structural models, and analysis data. You want to isolate the files with names starting with “L”, or perhaps identify only those that are currently selected. Using the graphical interface is an option—but NSL lets you do this in seconds, directly from selectors in scripts, filters, or SAMSON’s search bar.

Key File Attributes

When filtering file nodes in NSL, you can use the following attributes:

  • fi.n (name): Matches file nodes based on their name using string patterns.
  • fi.selected: Checks whether a file is currently selected.
  • fi.sf (selection flag): Boolean flag that can be manually or automatically set to mark specific files.

Example Queries

Here are a few ways you can use these attributes in practice:

Selects all file nodes whose name starts with the letter ‘L’. This is useful for grouping outputs from a specific phase of your simulation pipeline.

Returns files that are currently selected in the interface. This can be helpful to script operations on a specific subset you’ve manually highlighted.

Finds all file nodes that are not currently selected—useful for batch processing the rest of your dataset.

Filters files based on the custom selection flag, letting you apply logic to files you’ve pre-marked for follow-up or export.

Understanding Attribute Inheritance

All the file attributes above are inherited from the more general node attribute space. This means similar logic applies when filtering atoms, bonds, or other types of nodes. However, there are subtle differences—for example, while the node space provides a short name s for selected, the file space does not.

Organize Smarter

Using NSL for file querying allows modelers to go beyond manual inspection. It empowers you to:

  • Quickly isolate project components by name pattern.
  • Apply batch operations only to relevant files.
  • Combine selections with logical operators for more refined searches.

These small efficiencies can add up quickly, especially when working with large and complex molecular projects.

To explore more advanced use-cases for working with file nodes and attributes, visit the full documentation: https://documentation.samson-connect.net/users/latest/nsl/file/.

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

Comments are closed.