"Match" test functions used to compare two values for filtering (what to render) and matching (comparison and finding related points across data layers)
How do matching and filtering work?
See the Interactivity Tutorial for details.
Adding a new function
LocusZoom allows users to write their own plugins, so that "does this point match" logic can incorporate
user-defined code. (via LocusZoom.MatchFunctions.add('my_function', my_function);
)
All "matcher" functions have the call signature (item_value, target_value) => {boolean}
Both filtering and matching depend on asking "is this field interesting to me", which is inherently a problem of making comparisons. The registry allows any arbitrary function (with a field value as the first argument), but that function doesn't have to use either argument.
- Source:
Methods
(inner) '!='(item_value, target_value)
Check if two values are not equal. This allows weak comparisons (eg undefined/null), so it can also be used to test for the absence of a value
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '%'(item_value, target_value)
Modulo: tests for whether the remainder a % b is nonzero
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '<'(item_value, target_value)
Less-than comparison
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '<='(item_value, target_value)
Less than or equals to comparison
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '='(item_value, target_value)
Check if two values are (strictly) equal
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '>'(item_value, target_value)
Greater-than comparison
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) '>='(item_value, target_value)
Greater than or equals to comparison
Parameters:
Name | Type | Description |
---|---|---|
item_value |
||
target_value |
- Source:
(inner) 'in'(item_value, target_value)
Check whether the provided value (a) is in the string or array of values (b)
This can be used to check if a field value is one of a set of predefined choices
Eg, gene_type
is one of the allowed types of interest
Parameters:
Name | Type | Description |
---|---|---|
item_value |
A scalar value |
|
target_value |
String | Array | A container that implements the |
- Source:
(inner) 'match'(item_value, target_value)
Partial-match function. Can be used for free text search ("find all gene names that contain the user-entered string 'TCF'")
Parameters:
Name | Type | Description |
---|---|---|
item_value |
String | Array | A container (like a string) that implements the |
target_value |
A scalar value, like a string |
- Source: