Filtering according to a user-defined criteria

ThunderSTORM can remove unwanted molecules according to a user-defined criteria, or display molecules in a user-specified region. The filtering criteria is formulated as an expression combining mathematical and logical functions and operators with parameters from the table of results obtained from previous data analysis. All molecules with parameters not accepted by the criteria are removed. Note that users can also display histograms of particular measured parameters and select thresholds to define the filtering criteria.

Examples of filter formulas

  • sigma > 15

  • frame < 1000 | frame > 2000

  • intensity > 100 & uncertainty < 20

  • (x > 5000 & x < 10000 & y > 5000 & y < 10000)

  • (x-10000)^2 + (y-10000)^2 < 2000^2

Formula interpreter syntax

The filtering criteria is specified as an expression combining statistical and logical functions and operators with variables from the table of localization results. The result of the formula must be a vector of Boolean values containing ‘‘true’’ for each row that should stay in the table and ‘‘false’’ for the rows that should be deleted. A brief description of the syntax and semantic rules follows.

Variables

Variables used in formulas can be numerical scalars or vectors, or logical vectors. Numerical vectors are provided by columns in the table of results. To use a column as a variable, input its name (without square brackets with units). Any column can be used as a variable.

Operators

Operators take variables as operands. All vector operations are performed element-wise, therefore vectors must have the same size. The semantics is as follows:

scalar + scalar = scalar
vector + vector = vector
vector + scalar = vector (scalar is added to each element of the vector)

Arithmetical operators

Arithmetical operators can take numerical vectors or scalars as operands. The behavior changes accordingly. The output is a numerical vector if at least one of the operands is a vector, or a scalar if both operands are scalar. The supported arithmetical operators are:

a + b addition
a - b subtraction
a * b multiplication
a / b division
a % b modulo
a ^ b exponentiation (b must be a scalar)

Logical operators

Logical operators perform logical operations on vectors. All operations are performed element-wise. The output is a vector of Boolean values. The supported logical operators are:

a & b logical AND
a | b logical OR
a < b smaller than
a > b greater than
a = b equals
a != b not equals
!a negation

Functions

Functions can take a numerical vector or a scalar as an argument or a result of a function which is a numerical vector or a scalar. The supported functions are:

var(x) variance of x
std(x) standard deviation of x
mean(x) mean value of x
median(x) median of x
min(x) minimum value in x
max(x) maximum value in x
sum(x) sum of all items in x
abs(x) absolute value of x