Find the Right File Nodes Without Guesswork

When a molecular project contains many files, a small search can save time—and help avoid acting on the wrong kind of node. SAMSON’s Node Specification Language (NSL) provides a file attribute space for matching file nodes by their attributes. Its short name is fi.

The key practical point is that these expressions describe criteria for matching file nodes. They are not commands to rename, delete, or modify files. Start with one attribute that reflects what you know: a name, whether a node is selected, or its selection flag.

Match files by name

The name attribute is inherited from the general node attribute space. Its short form is n, and values are written as quoted strings. The documentation gives these examples:

  • fi.n "A"
  • fi.n "L*"

This is useful when you can identify a file from its name or a name pattern. Keep the quotation marks around the value, and include the fi prefix when you want the search to match file nodes specifically. The example fi.n "L*" shows the pattern as written in NSL; consult the broader NSL documentation for details on expression syntax and pattern matching.

Check selection state

File nodes also inherit selected from node. The file attribute page shows two forms:

  • fi.selected
  • not fi.selected

These let you express a condition based on whether a file node is selected. One detail worth remembering: the file attribute space does not provide the short name s for selected. Use the full spelling, selected, in a file expression.

Use the selection flag explicitly

selectionFlag is another inherited attribute. Its short name is sf, and the page lists Boolean values, true and false. Examples include fi.sf false and fi.sf.

Because selected and selectionFlag are listed as separate attributes, it is useful to keep their names distinct when reading or writing an expression. The reference page does not define their underlying behavior or explain when they differ, so avoid treating them as interchangeable based on their names alone.

A simple way to avoid mistakes

  1. Confirm that the target is a file node; the fi attribute space matches only file nodes.
  2. Choose the attribute that reflects your goal: n for a name, selected for selected state, or sf for the selection flag.
  3. Use the documented spelling and value format. In particular, quote name values and use true or false for Boolean attributes.
  4. Read the expression before using it: a name condition and a selection condition answer different questions.

This small set of attributes is especially helpful when your task is simply to narrow attention to the right files before continuing your work. For the complete reference, see the SAMSON file attributes documentation.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.