Find the Right File Nodes Without Losing Track of Your Filters

When a molecular project contains many files, it can be easy to lose track of which file nodes a query is intended to match. SAMSON’s Node Specification Language (NSL) provides a compact way to describe file-node criteria. The key is to keep the file attribute space—and its short name, fi—in view while building and checking a filter.

Start by narrowing the scope

File attributes are defined in the file attribute space, which matches only file nodes. That gives a query a useful boundary: you are describing files, rather than making a general statement about every kind of node in the document. Use the fi prefix for these attributes. For example, fi.n "A" uses the short name n for the inherited name attribute.

Names are written as strings in quotes. The reference gives fi.n "A" and fi.n "L*" as examples. Keeping the value inside quotes makes the intended name expression easy to spot when you review a longer specification.

Make selection criteria explicit

Two boolean attributes are available in this file-specific reference: selected and selectionFlag. Both are inherited from the node attribute space, but their syntax differs. The file form of selected has no short name, so use fi.selected rather than assuming a one-letter shortcut. The documented examples show both fi.selected and not fi.selected.

selectionFlag, by contrast, has the short name sf. Its examples are fi.sf and fi.sf false. These examples let you write the full attribute name in your notes when clarity matters, or use the shorter form when composing a query. Both attributes accept boolean values, true and false.

A practical way to check a file query

Before using a file specification, read it in three passes:

  1. Check the scope: does the expression begin with fi, so it is limited to file nodes?
  2. Check the attribute: are you filtering by a quoted name, by selected, or by selectionFlag?
  3. Check the boolean intent: does the expression include the positive form, the negative form not fi.selected, or an explicit value such as fi.sf false?

This small review helps catch common specification mistakes: leaving quotes off a name, using an unlisted shortcut for selected, or mixing up the two boolean attribute names. It also makes a saved expression easier for a colleague to understand later.

Keep inherited attributes in mind

The file reference lists attributes inherited from node. Inheritance means these are not unique concepts introduced only for files; the file attribute space exposes them for file-node queries. When consulting examples or writing a filter, preserve the file prefix and use the syntax shown for the file context. In particular, the documentation explicitly notes that selected is inherited without the short name s, while selectionFlag is inherited with the short name sf.

For the complete attribute table and related NSL material, see the file attributes reference. You can also explore the broader Node Specification Language documentation and its examples.

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

Comments are closed.