Queries
DataAxesFormats.Queries
—
Module
Extract data from a
DafReader
.
Construction
DataAxesFormats.Queries.Query
—
Type
A query is a description of a (subset of a) procedure for extracting some data from a
DafReader
. A full query is a sequence of
QueryOperation
, that when applied to some
DafReader
, result in a set of names, or scalar, vector or matrix result.
Queries can be constructed in two ways. In code, a query can be built by chaining query operations (e.g., the query
Axis("gene") |> LookupVector("is_marker")
looks up the
is_marker
vector property of the
gene
axis). Alternatively, a query can be parsed from a string, which needs to be parsed into a
Query
object (e.g., the above can be written as
parse_query("@gene:is_marker")
or using the
@q_str
macro as
q"gene:is_marker"
).
Being able to represent queries as strings allows for reading them from configuration files and letting the user input them in an application UI (e.g., allowing the user to specify the X, Y and/or colors of a scatter plot using queries). At the same time, being able to incrementally build queries using code allows for convenient reuse (e.g., reusing axis sub-queries in
Daf
views), without having to go through the string representation.
To apply a query, invoke
get_query
to apply a query to some
DafReader
data (you can also use the shorthand
daf[query]
instead of
get_query(daf, query)
. Tou can also write
query |> get_query(daf)
which is useful when constructing a query from parts using
|>
). By default,
get_query
will cache their results in memory as
QueryData
, to speed up repeated queries. This may lock up large amounts of memory. Using
daf[query]
does not cache the results; you can also use
empty_cache!
to release the memory.
This has started as a very simple query language (which it still is, for the simple cases) but became complex to allow for useful but complex scenarios. In particular, the approach here of using a concatenative language (similar to
ggplot
) makes simple things simpler, but became less natural for some of the more advanced operations. However, using an RPN or a LISP notation to better support such cases would have ended up with a much less nice syntax for the simple cases.
Hopefully we have covered sufficient ground so that we won't need to add further operations (except for more element-wise and reduction operations). In most cases, you can write code that accesses the vectors/matrix data and performs whatever computation you want instead of writing a complex query; however, this isn't an option when defining views or adapters, which rely on the query mechanism for specifying the data.
Execution Model
Queries consist of a combination of one or more of the operators listed below. However, the execution of the query is not one operator at a time. Instead, at each point, a phrase consisting of several operators is executed as a single operation. Each such step modifies the state of the query (starting with an empty state). When the query is done, the result is extracted from the final query state.
The query state is a stack which starts empty. Each phrase only applies if the top of the stack matches some pattern (e.g., looking up a vector property requires the top of the stack contains an axis specification). The execution of the phrase pops out the matching top stack elements, performs some operations on them, and then pushes some elements to the stack.
This approach simplifies both the code and the mental model for the query language. For example, when looking up a scalar property using the
LookupScalar
operator, e.g.
". version"
, and we want to provide a default value to return if the property doesn't exist by following it with the
IfMissing
operator, e.g.
" || 0.0.0", the phrase
LookupScalar("version") |> IfMissing("0.0.0")
is executed as a single operation, invoking
get_scalar(daf, "version"; default = "0.0.0")
and pushing a scalar into the query state stack. This eliminates the issue of "what is the state of the query after executing a
LookupScalar
of a missing scalar property, before executing
IfMissing`".
A disadvantage of this approach is that the semantics of an operator depends on the phrase it is used in. However, we defined the operators such that they would "make sense" in the context of the different phrases they participate in. This allows us to provide a list of operators with a coherent function for each:
Query Operators
| Operator | Implementation | Description |
|---|---|---|
@
|
Axis
|
Specify an axis, e.g. for looking up a vector or matrix property. |
=@
|
AsAxis
|
Specify that values are axis entries, e.g. for looking up another vector or matrix property. |
@❘
|
SquareColumnIs
|
Specify which column to slice from a square matrix. |
@-
|
SquareRowIs
|
Specify which row to slice from a square matrix. |
/
|
GroupBy
|
Group elements of a vector by values of another vector of the same length. |
❘/
|
GroupColumnsBy
|
Group columns of a matrix by values of a vector with one value per row. |
-/
|
GroupRowsBy
|
Group rows of a matrix by values of a vector with one value per row. |
%
|
EltwiseOperation
|
Specify an element-wise operation to apply to scalar, vector or matrix data. |
>>
|
ReductionOperation
|
Specify a reduction operation to convert vector or matrix data to a single scalar value. |
>❘
|
ReduceToColumn
|
Specify a reduction operation to convert matrix data to a single column. |
>-
|
ReduceToRow
|
Specify a reduction operation to convert matrix data to a single row. |
❘❘
|
IfMissing
|
Specify a default value to use when looking up a property that doesn't exist, |
| or when reducing an empty vector or matrix into a single scalar value. | ||
*
|
CountBy
|
Count in a matrix the number of times each combination of values from two vectors coincide. |
?
|
Names
|
Ask for a set of names of axes or properties that can be used to look up data. |
??
|
IfNot
|
Specify a final value to use when performing chained lookup operations based on an empty value. |
.
|
LookupScalar
|
Lookup a scalar property. |
:
|
LookupVector
|
Lookup a vector property based on some axis. |
::
|
LookupMatrix
|
Lookup a matrix property based on a pair of axes (rows and columns). |
<
|
IsLess
|
Compare less than a value. |
<=
|
IsLess
|
Compare less than or equal to a value. |
=
|
IsEqual
|
Compare equal to a value. |
!=
|
IsNotEqual
|
Compare not equal to a value. |
>=
|
IsLess
|
Compare greater than or equal to a value. |
>
|
IsLess
|
Compare greater than a value. |
~
|
IsMatch
|
Compare by matching to a regular expression. |
!~
|
IsNotMatch
|
Compare by not matching to a regular expression. |
[
|
BeginMask
|
Begin computing a mask on an axis. |
[ !
|
BeginNegatedMask
|
Begin computing a mask on an axis, negating it. |
]
|
EndMask
|
Complete computing a mask on an axis. |
&
|
AndMask
|
Merge masks by AND Boolean operation. |
& !
|
AndNegatedMask
|
Merge masks by AND NOT Boolean operation. |
❘
|
OrMask
|
Merge masks by OR Boolean operation. |
❘ !
|
OrNegatedMask
|
Merge masks by OR NOT Boolean operation. |
^
|
XorMask
|
Merge masks by XOR Boolean operation. |
^ !
|
XorNegatedMask
|
Merge masks by XOR NOT Boolean operation. |
Due to Julia's Documenter limitations, the ASCII
|
character (
|
, vertical bar) is replaced by the Unicode
❘
character (
❘
, light vertical bar) in the above table. Sigh.
Query Syntax
Obviously not all possible combinations of operators make sense (e.g.,
LookupScalar("is_marker") |> Axis("cell")
will not work). Valid queries are built out of supported phrases (each including one or more operators), combined into a coherent query. For the full list of valid phrases and queries, see
NAMES_QUERY
,
SCALAR_QUERY
,
VECTOR_QUERY
and
MATRIX_QUERY
below.
DataAxesFormats.Queries.QuerySequence
—
Type
struct QuerySequence <: Query
A sequence of
N
QueryOperation
s. This is the internal representation of the query as of itself (without applying it).
DataAxesFormats.Queries.QueryString
—
Type
Most operations that take a query allow passing a string to be parsed into a query, or an actual
Query
object. This type is used as a convenient notation for such query parameters.
DataAxesFormats.Queries.parse_query
—
Function
parse_query(
query_string::AbstractString,
operand_only::Maybe{Type{<:QueryOperation}} = nothing
)::QueryOperation
Parse a query (or a fragment of a query). If the
query_string
contains just a name, and
operand_only
was specified, then it is assumed this is the type of query operation.
If the provided query string contains only an operand, and
operand_only
is specified, it is used as the operator (i.e.,
parse_query("metacell")
is an error, but
parse_query("metacell", Axis)
is the same as
Axis("metacell")
). This is useful when providing suffix queries (e.g., for
get_frame
).
DataAxesFormats.Queries.@q_str
—
Macro
q"..."
Shorthand for parsing a literal string as a
Query
. This is equivalent to
Query
(raw"...")
, that is, a
\
can be placed in the string without escaping it (except for before a
"
). This is very convenient for literal queries (e.g.,
q"@ cell = ATCG\:B1 : batch"
==
parse_query(raw"@ cell = ATCG\:B1 : batch")
==
parse_query("@ cell = ATCG\\:B1 : batch")
==
Axis("cell") |> IsEqual("ATCG:B1") |> LookupVector("batch"))
.
println("@ cell = ATCG\\:B1 : batch")
println(q"@ cell = ATCG\:B1 : batch")
# output
@ cell = ATCG\:B1 : batch
@ cell = ATCG\:B1 : batch
Syntax
Each description of a part of the query syntax is accompanied by a diagram.
DataAxesFormats.Queries.NAMES_QUERY
—
Constant
A query returning a set of names. Valid phrases are:
- Looking up the set of names of the scalar properties (
?). Example:
cells = example_cells_daf()
cells[". ?"]
# output
KeySet for a Dict{AbstractString, Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8, AbstractString}} with 2 entries. Keys:
"organism"
"reference"
- Looking up the set of names of the axes (
@ ?). Example:
cells = example_cells_daf()
cells["@ ?"]
# output
KeySet for a Dict{AbstractString, AbstractVector{<:AbstractString}} with 4 entries. Keys:
"gene"
"experiment"
"donor"
"cell"
- Looking up the set of names of the vector properties of an axis (e.g.,
@ cell : ?).
cells = example_cells_daf()
cells["@ gene : ?"]
# output
KeySet for a Dict{AbstractString, AbstractVector{T} where T<:(Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8, S} where S<:AbstractString)} with 1 entry. Keys:
"is_lateral"
- Looking up the set of names of the matrix properties of a pair of axes (e.g.,
@ cell @ gene :: ?).
cells = example_cells_daf()
cells["@ cell @ gene :: ?"]
# output
Set{AbstractString} with 1 element:
"UMIs"
DataAxesFormats.Queries.SCALAR_QUERY
—
Constant
A query returning a scalar result. Valid phrases are:
- Looking up a scalar property (
. scalar-property,. scalar-property || default-value). - Looking up a vector, and picking a specific entry in it (
: vector-property @ axis = entry,: vector-property || default-value @ axis = entry). - Looking up a matrix, and picking a specific entry in it (
:: matrix-property @ rows-axis = row-entry @ columns-axis = column-entry,:: matrix-property || default-value @ rows-axis = row-entry @ columns-axis = column-entry).
In addition, you can use
EltwiseOperation
and
ReductionOperation
:
-
Transform any scalar (...scalar...
% Eltwise operation...). Actually, we don't currently have any element-wise operations that apply to strings, but we can add some if useful. -
Reduce any vector to a scalar (...vector...
>> Reduction operation...) - seeVECTOR_QUERY. Example:
cells = example_cells_daf()
# Number of genes which are marked as lateral.
cells["@ gene : is_lateral >> Sum type Int64"]
# output
438
- Reduce any matrix to a scalar (...matrix...
>> Reduction operation...) - seeMATRIX_QUERY. Example:
cells = example_cells_daf()
# Total number of measured UMIs in the data.
cells["@ cell @ gene :: UMIs >> Sum type Int64"]
# output
1171936
DataAxesFormats.Queries.VECTOR_QUERY
—
Constant
A query returning a vector result. Valid phrases are:
- Looking up a vector axis (
@ axis). This gives us a vector of the axis entries. Example:
cells = example_cells_daf()
cells["@ experiment"]
# output
23-element Named SparseArrays.ReadOnly{SubString{StringViews.StringView{Vector{UInt8}}}, 1, Vector{SubString{StringViews.StringView{Vector{UInt8}}}}}
experiment │
─────────────────┼───────────────────
demux_01_02_21_1 │ "demux_01_02_21_1"
demux_01_02_21_2 │ "demux_01_02_21_2"
demux_01_03_21_1 │ "demux_01_03_21_1"
demux_04_01_21_1 │ "demux_04_01_21_1"
demux_04_01_21_2 │ "demux_04_01_21_2"
demux_07_03_21_1 │ "demux_07_03_21_1"
demux_07_03_21_2 │ "demux_07_03_21_2"
demux_07_12_20_1 │ "demux_07_12_20_1"
⋮ ⋮
demux_21_02_21_1 │ "demux_21_02_21_1"
demux_21_02_21_2 │ "demux_21_02_21_2"
demux_21_12_20_1 │ "demux_21_12_20_1"
demux_21_12_20_2 │ "demux_21_12_20_2"
demux_22_02_21_1 │ "demux_22_02_21_1"
demux_22_02_21_2 │ "demux_22_02_21_2"
demux_28_12_20_1 │ "demux_28_12_20_1"
demux_28_12_20_2 │ "demux_28_12_20_2"
- Applying a mask to an axis (...axis...
[...mask...]) - seeVECTOR_MASK. - Looking up the values of a property based on a (possibly masked) axis (...axis...
:...lookup...) - seeVECTOR_LOOKUP. - Applying some operation to a vector we looked up (...vector...
% Eltwise operation...) - seeVECTOR_OPERATION. - Taking any matrix query and reducing it to a column or a row vector (...matrix...
>| Reduction operation..., ...matrix...>- Reduction operation...) - seeVECTOR_FROM_MATRIX.
DataAxesFormats.Queries.VECTOR_OPERATION
—
Constant
A query fragment specifying some operation on a vector of values. Valid phrases are:
- Treating the vector values as names of some axis entries and looking up some property of that axis (...vector...
@ axis-values-are-entries-of : vector-property-of-that-axis || default-value) - seeVECTOR_AS_AXISandVECTOR_LOOKUP).
metacells = example_metacells_daf()
metacells["@ metacell : type : color"]
# output
7-element Named Vector{String}
metacell │
──────────┼────────────
M1671.28 │ "gold"
M2357.20 │ "gold"
M2169.56 │ "plum"
M2576.86 │ "#eebb6e"
M1440.15 │ "gold"
M756.63 │ "#eebb6e"
M412.08 │ "steelblue"
- Applying some operation to a vector we looked up (...vector...
% Eltwise ...).
cells = example_cells_daf()
cells["@ donor : age % Clamp min 40 max 60 type Int64"]
# output
95-element Named Vector{Int64}
donor │
───────┼───
N16 │ 60
N17 │ 60
N18 │ 60
N59 │ 60
N79 │ 60
N83 │ 42
N84 │ 60
N85 │ 60
⋮ ⋮
N176 │ 60
N177 │ 58
N178 │ 40
N179 │ 60
N181 │ 60
N182 │ 60
N183 │ 60
N184 │ 60
- Comparing the values in the vector with some constant (...vector...
> value).
cells = example_cells_daf()
cells["@ donor : age > 60"]
# output
95-element Named Vector{Bool}
donor │
───────┼──────
N16 │ true
N17 │ true
N18 │ true
N59 │ true
N79 │ true
N83 │ false
N84 │ true
N85 │ true
⋮ ⋮
N176 │ true
N177 │ false
N178 │ false
N179 │ true
N181 │ true
N182 │ true
N183 │ true
N184 │ true
- Grouping the vector values by something and reducing each group to a single value (...vector...
/ vector-property >> Sum) - seeVECTOR_GROUP.
DataAxesFormats.Queries.VECTOR_AS_AXIS
—
Constant
A query fragment for explicitly specifying that the values or a vector are entries of an axis. Valid phrases are:
- Using the name of the property of the vector as the axis name (...vector...
@). The convention is that the property name is the name of the axis, or starts with the name of the axis followed by.and some suffix - Specifying an explicit axis name (...vector...
@ axis) ignoring the vector property name.
When the values of a vector are entries in some axis, we can use it to look up some property based on it. For simple lookups the
@
can be omitted (e.g.
@ cell : metacell
). This can be chained (
@ cell : metacell : type : color
). When grouping a vector or matrix rows or columns, explicitly associating an axis with the values causes creating a group for each axis entry in the right order so that the result is a proper values vector for the axis (
@ metacell / type @ >> Count
).
metacells = example_metacells_daf()
metacells["@ metacell : type =@ : color"]
# output
7-element Named Vector{String}
metacell │
──────────┼────────────
M1671.28 │ "gold"
M2357.20 │ "gold"
M2169.56 │ "plum"
M2576.86 │ "#eebb6e"
M1440.15 │ "gold"
M756.63 │ "#eebb6e"
M412.08 │ "steelblue"
metacells = example_metacells_daf()
metacells["@ metacell : type =@ type : color"]
# output
7-element Named Vector{String}
metacell │
──────────┼────────────
M1671.28 │ "gold"
M2357.20 │ "gold"
M2169.56 │ "plum"
M2576.86 │ "#eebb6e"
M1440.15 │ "gold"
M756.63 │ "#eebb6e"
M412.08 │ "steelblue"
DataAxesFormats.Queries.VECTOR_LOOKUP
—
Constant
A query fragment specifying looking up vector properties. Valid phrases are:
- Looking up a vector property based on an axis (...axis...
: vector-property). Example:
metacells = example_metacells_daf()
metacells["@ metacell : type"]
# output
7-element Named SparseArrays.ReadOnly{String, 1, Vector{String}}
metacell │
──────────┼───────────
M1671.28 │ "MPP"
M2357.20 │ "MPP"
M2169.56 │ "MEBEMP-L"
M2576.86 │ "MEBEMP-E"
M1440.15 │ "MPP"
M756.63 │ "MEBEMP-E"
M412.08 │ "memory-B"
This can be further embellished:
- Looking up a matrix property based on an axis, and slicing a column based on an explicit entry of the other axis of the matrix (...axis...
:: matrix-property @ columns-axis = columns-axis-entry). Example:
metacells = example_metacells_daf()
metacells["@ gene :: fraction @ metacell = M412.08"]
# output
683-element Named Vector{Float32}
gene │
─────────────┼────────────
RPL22 │ 0.00373581
PARK7 │ 6.50531f-5
ENO1 │ 4.22228f-5
PRDM2 │ 0.000151486
HP1BP3 │ 0.00012099
CDC42 │ 0.000176377
HNRNPR │ 6.7083f-5
RPL11 │ 0.0124251
⋮ ⋮
NRIP1 │ 2.79487f-5
ATP5PF │ 8.22312f-5
CCT8 │ 4.13243f-5
SOD1 │ 0.000103708
SON │ 0.00032361
ATP5PO │ 9.73498f-5
TTC3 │ 0.000122469
HMGN1 │ 0.000160654
- Looking up a square matrix property, and slicing a column based on an explicit entry of the (column) axis of the matrix (...axis...
:: square-matrix-property @| column-axis-entry).
metacells = example_metacells_daf()
# Outgoing weights from the M412.08 metacell.
metacells["@ metacell :: edge_weight @| M412.08"]
# output
7-element Named Vector{Float32}
metacell │
──────────┼────
M1671.28 │ 0.0
M2357.20 │ 0.0
M2169.56 │ 0.0
M2576.86 │ 0.0
M1440.15 │ 0.5
M756.63 │ 0.1
M412.08 │ 0.0
- Looking up a square matrix property, and slicing a row based on an explicit entry of the (column) axis of the matrix (...vector...
:: square-matrix-property @- row-axis-entry).
metacells = example_metacells_daf()
# Incoming weights into the M412.08 metacell.
metacells["@ metacell :: edge_weight @- M412.08"]
# output
7-element Named Vector{Float32}
metacell │
──────────┼────
M1671.28 │ 0.0
M2357.20 │ 0.0
M2169.56 │ 0.1
M2576.86 │ 0.0
M1440.15 │ 0.0
M756.63 │ 0.9
M412.08 │ 0.0
In all of these, the lookup operation (
:
,
::
) can be followed by
|| default-value
to specify a value to use if the property we look up doesn't exist (...vector...
: vector-property || default-value
, ...vector...
:: square-matrix-property || default-value @| column-entry
).
If the base axis is the result of looking up some property, then some of the entries may have an empty string value. Looking up the vector property based on this will cause an error. To overcome this, you can request that these entries will be masked out of the result by prefixing the query with
??
(...vector...
?? : vector-property
, ...vector...
?? :: matrix-property ...
), or specify the
final
value of these entries (...vector...
?? final-value : vector-property
, ...vector...
?? final-value :: matrix-property ...
). Since it is possible to chain lookup operations (see
VECTOR_OPERATION
), the final value is applied at the end of the lookup chain (
?? final-value : vector-property-which-holds-axis-entries : vector-property-of-that-axis-which-holds-another-axis-entries : vector-property-of-the-other-axis
).
DataAxesFormats.Queries.VECTOR_MASK
—
Constant
A query fragment specifying a mask to apply to an axis. Valid phrases are:
- Beginning a mask by looking up some vector property for each entry (...axis...
[ vector-property, ...axis...[ ! vector-property) - seeVECTOR_MASK_LOOKUP. - Applying some operation to a vector we looked up (...mask...
> value) - seeVECTOR_OPERATION. - Combining the mask with another one (...mask...
&...mask..., ...mask...& !...mask...) - seeVECTOR_MASK_OPERATION. - Ending the mask (...mask...
]).
DataAxesFormats.Queries.VECTOR_MASK_LOOKUP
—
Constant
A query fragment specifying looking up a vector for a mask to apply to an axis. Valid phrases are similar to
VECTOR_LOOKUP
, except that they start with
[
instead of
:
(starting with
[ !
reverses the mask). Example:
cells = example_cells_daf()
cells["@ gene [ ! is_lateral ]"]
# output
245-element Named Vector{SubString{StringViews.StringView{Vector{UInt8}}}}
gene │
───────────┼────────────
ENO1 │ "ENO1"
PRDM2 │ "PRDM2"
HP1BP3 │ "HP1BP3"
HNRNPR │ "HNRNPR"
RSRP1 │ "RSRP1"
KHDRBS1 │ "KHDRBS1"
THRAP3 │ "THRAP3"
SMAP2 │ "SMAP2"
⋮ ⋮
MYADM │ "MYADM"
DDT │ "DDT"
UQCR10 │ "UQCR10"
EIF3L │ "EIF3L"
TNRC6B │ "TNRC6B"
TNFRSF13C │ "TNFRSF13C"
SOD1 │ "SOD1"
ATP5PO │ "ATP5PO"
DataAxesFormats.Queries.VECTOR_MASK_OPERATION
—
Constant
A query fragment specifying combining a mask with a second mask. Valid phrases are similar to
VECTOR_MASK_LOOKUP
, except that they start with the logical combination operator (
&
,
|
,
^
), with an optional
!
suffix for negating the second mask. Operations are evaluated in order (left to right). Example:
cells = example_cells_daf()
cells["@ donor [ age > 60 & sex = male ]"]
# output
29-element Named Vector{SubString{StringViews.StringView{Vector{UInt8}}}}
donor │
───────┼───────
N16 │ "N16"
N17 │ "N17"
N59 │ "N59"
N86 │ "N86"
N88 │ "N88"
N91 │ "N91"
N92 │ "N92"
N95 │ "N95"
⋮ ⋮
N163 │ "N163"
N164 │ "N164"
N169 │ "N169"
N172 │ "N172"
N174 │ "N174"
N175 │ "N175"
N179 │ "N179"
N181 │ "N181"
DataAxesFormats.Queries.VECTOR_GROUP
—
Constant
A query fragment for grouping vector values by some property and computing a single value per group. Valid phrases for fetching the group values are similar to
VECTOR_LOOKUP
but start with a
/
instead of
:
. This can be followed by any
VECTOR_OPERATION
(in particular, additional lookups). Once the final group value is established for each vector entry, the values of all entries with the same group value are reduced using a
ReductionOperation
to a single value. The result vector has this reduced value per group. E.g.,
@ cell : age / type >> Mean
.
chain = example_chain_daf()
chain["@ cell : donor : age / metacell ?? : type >> Mean"]
# output
4-element Named Vector{Float32}
A │
─────────┼────────
MEBEMP-E │ 63.9767
MEBEMP-L │ 63.9524
MPP │ 64.238
memory-B │ 62.3077
By default the result vector is sorted by the group value (this is also used as the name in the result
NamedArray
). Specifying an
VECTOR_AS_AXIS
before the reduction operation changes this to require that the group values be entries in some axis. In this case the result vector will have one entry for each entry of the axis, in the axis order. If some axis entries do not have any vector values associated with them, then the reduction will fail (e.g. "mean of an empty vector"). In this case, you should specify a default value for the reduction. E.g.,
@ cell : age / type @ >> Mean || 0
. Example:
chain = example_chain_daf()
chain["@ cell [ metacell ?? : type != memory-B ] : donor : age / metacell : type =@ >> Mean || 0"]
# output
4-element Named Vector{Float32}
type │
─────────┼────────
memory-B │ 0.0
MEBEMP-E │ 63.9767
MEBEMP-L │ 63.9524
MPP │ 64.238
DataAxesFormats.Queries.VECTOR_FROM_MATRIX
—
Constant
A query fragment for reducing a matrix to a vector. Valid phrases are:
- Reduce each row into a single value, resulting in an entry for each column of the matrix (...matrix...
>| ReductionOperation ...). Example:
metacells = example_metacells_daf()
metacells["@ metacell @ gene :: fraction >| Max"]
# output
7-element Named Vector{Float32}
metacell │
──────────┼──────────
M1671.28 │ 0.023321
M2357.20 │ 0.0233425
M2169.56 │ 0.0219235
M2576.86 │ 0.0236719
M1440.15 │ 0.0227677
M756.63 │ 0.0249121
M412.08 │ 0.0284936
- Reduce each column into a single value, resulting in an entry for each row of the matrix (...matrix...
>- ReductionOperation ...).
metacells = example_metacells_daf()
metacells["@ metacell @ gene :: fraction >- Max"]
# output
683-element Named Vector{Float32}
gene │
─────────────┼────────────
RPL22 │ 0.00474096
PARK7 │ 0.000154199
ENO1 │ 0.000533887
PRDM2 │ 0.000151486
HP1BP3 │ 0.000248206
CDC42 │ 0.000207847
HNRNPR │ 0.000129013
RPL11 │ 0.0124251
⋮ ⋮
NRIP1 │ 0.000361428
ATP5PF │ 0.000170554
CCT8 │ 0.000142851
SOD1 │ 0.000177344
SON │ 0.00032361
ATP5PO │ 0.00018833
TTC3 │ 0.000144736
HMGN1 │ 0.000415481
DataAxesFormats.Queries.MATRIX_QUERY
—
Constant
A query returning a matrix result. Valid phrases are:
- Lookup a matrix property after specifying its rows and columns axes (...rows
axis... ...columns
axis...
:: matrix-property, ...rows axis... ...columns axis...:: matrix-property || default-value). Example:
cells = example_cells_daf()
cells["@ cell @ gene :: UMIs"]
# output
856×683 Named Matrix{UInt8}
cell ╲ gene │ RPL22 … HMGN1
────────────────────────────────────┼──────────────────────────────
demux_07_12_20_1_AACAAGATCCATTTCA-1 │ 0x0c … 0x02
demux_07_12_20_1_AACGAAAGTCCAATCA-1 │ 0x08 0x01
demux_07_12_20_1_AAGACAAAGTTCCGTA-1 │ 0x03 0x03
demux_07_12_20_1_AGACTCATCTATTGTC-1 │ 0x08 0x01
demux_07_12_20_1_AGATAGACATTCCTCG-1 │ 0x08 0x00
demux_07_12_20_1_ATCGTAGTCCAGTGCG-1 │ 0x0e 0x02
demux_07_12_20_1_CACAGGCGTCCTACAA-1 │ 0x0b 0x03
demux_07_12_20_1_CCTACGTAGCCAACCC-1 │ 0x03 0x01
⋮ ⋮ ⋱ ⋮
demux_11_04_21_2_GGGTCACCACCACATA-1 │ 0x05 0x03
demux_11_04_21_2_TACAACGGTTACACAC-1 │ 0x01 0x00
demux_11_04_21_2_TAGAGTCAGAACGCGT-1 │ 0x09 0x00
demux_11_04_21_2_TGATGCAAGGCCTGCT-1 │ 0x07 0x00
demux_11_04_21_2_TGCCGAGAGTCGCGAA-1 │ 0x01 0x00
demux_11_04_21_2_TGCTGAAAGCCGCACT-1 │ 0x01 0x03
demux_11_04_21_2_TTCAGGACAGGAATAT-1 │ 0x06 0x00
demux_11_04_21_2_TTTAGTCGTCTAGTGT-1 │ 0x06 … 0x00
- Given a vector of values, lookup another vector of the same size and generate a matrix of the number of times each combination of values appears (...vector...
* vector-property ...) - seeMATRIX_COUNT. Example:
Matrices can then be modified by applying any
MATRIX_OPERATION
to it.
DataAxesFormats.Queries.MATRIX_COUNT
—
Constant
A query fragment for computing a matrix of the number of times a combination of values appears in the same index in the first and second vectors. Valid phrases are similar to
VECTOR_LOOKUP
except they start with
*
instead of
:
. This can be followed by any
VECTOR_OPERATION
for computing the final second vector. E.g.,
@ cell : age * metacell : type
. Example:
cells = example_cells_daf()
cells["@ cell : experiment * donor : sex"]
# output
23×2 Named Matrix{UInt16}
A ╲ B │ female male
─────────────────┼───────────────
demux_01_02_21_1 │ 0x0017 0x000e
demux_01_02_21_2 │ 0x000a 0x001a
demux_01_03_21_1 │ 0x0012 0x001b
demux_04_01_21_1 │ 0x0013 0x0016
demux_04_01_21_2 │ 0x0006 0x0012
demux_07_03_21_1 │ 0x000a 0x0016
demux_07_03_21_2 │ 0x000d 0x001b
demux_07_12_20_1 │ 0x0006 0x0011
⋮ ⋮ ⋮
demux_21_02_21_1 │ 0x0012 0x0005
demux_21_02_21_2 │ 0x0009 0x002a
demux_21_12_20_1 │ 0x001e 0x0005
demux_21_12_20_2 │ 0x0000 0x0026
demux_22_02_21_1 │ 0x0012 0x0009
demux_22_02_21_2 │ 0x001c 0x0013
demux_28_12_20_1 │ 0x0018 0x0022
demux_28_12_20_2 │ 0x003f 0x0009
By default, the matrix rows and columns are sorted by the unique values. Explicitly specifying
VECTOR_AS_AXIS
for either the first or second vector will change the rows or columns to the axis entries in the right (axis) order. This may create rows or columns with all-zero values. E.g.,
@ cell : batch @ * metacell : type @
. Example:
cells = example_cells_daf()
cells["@ cell : experiment =@ * donor : sex"]
# output
23×2 Named Matrix{UInt16}
experiment ╲ B │ female male
─────────────────┼───────────────
demux_01_02_21_1 │ 0x0017 0x000e
demux_01_02_21_2 │ 0x000a 0x001a
demux_01_03_21_1 │ 0x0012 0x001b
demux_04_01_21_1 │ 0x0013 0x0016
demux_04_01_21_2 │ 0x0006 0x0012
demux_07_03_21_1 │ 0x000a 0x0016
demux_07_03_21_2 │ 0x000d 0x001b
demux_07_12_20_1 │ 0x0006 0x0011
⋮ ⋮ ⋮
demux_21_02_21_1 │ 0x0012 0x0005
demux_21_02_21_2 │ 0x0009 0x002a
demux_21_12_20_1 │ 0x001e 0x0005
demux_21_12_20_2 │ 0x0000 0x0026
demux_22_02_21_1 │ 0x0012 0x0009
demux_22_02_21_2 │ 0x001c 0x0013
demux_28_12_20_1 │ 0x0018 0x0022
demux_28_12_20_2 │ 0x003f 0x0009
DataAxesFormats.Queries.MATRIX_OPERATION
—
Constant
A query fragment specifying some operation on a matrix of values. Valid phrases are:
-
Treating the matrix values as names of some axis entries and looking up some property of that axis (...matrix...
@ axis-values-are-entries-of : vector-property-of-that-axis || default-value) - seeVECTOR_AS_AXISandVECTOR_LOOKUP) (while the matrix retains its shape, this shape does not effect the result so we treat it as a long vector for the purpose of the lookup). -
Applying some operation to a vector we looked up (...matrix...
% Eltwise ...). Example:
metacells = example_metacells_daf()
metacells["@ metacell @ gene :: fraction % Log base 2 eps 1e-5"]
# output
7×683 Named Matrix{Float32}
metacell ╲ gene │ RPL22 PARK7 … TTC3 HMGN1
────────────────┼──────────────────────────────────────────────────────────
M1671.28 │ -7.80014 -13.3582 … -13.0011 -11.4571
M2357.20 │ -7.91664 -12.5723 -13.009 -11.7136
M2169.56 │ -7.71757 -13.0192 -13.0406 -11.1986
M2576.86 │ -7.8198 -12.8843 -12.6579 -11.5767
M1440.15 │ -7.77472 -12.9433 -13.3506 -11.5629
M756.63 │ -7.84368 -13.0487 -13.148 -11.8308
M412.08 │ -8.06051 -13.7017 … -12.8821 -12.5166
- Grouping the matrix rows or columns by something and reducing each group to a single one (...matrix...
-/ vector-property >- Sum, ...matrix...|/ vector-property >| Sum) - seeMATRIX_GROUP.
DataAxesFormats.Queries.MATRIX_GROUP
—
Constant
A query fragment for grouping rows or columns by some property and computing a single one per group. Valid phrases for fetching the group values are similar to
VECTOR_LOOKUP
but start with a
-/
or
|/
instead of
:
. This can be followed by any
VECTOR_OPERATION
(in particular, additional lookups). Once the final group value is established for each row or column entry, the values of all entries with the same group value are reduced using a
ReductionOperation
to a single value. The result matrix has this reduced value per group. E.g.,
@ cell @ gene :: UMIs -/ metacell : type >- Sum
. The reduction operation must match the group operation (
-/ ... >-
,
|/ ... >|
). Example:
metacells = example_metacells_daf()
metacells["@ metacell @ gene :: fraction -/ type >- Mean"]
# output
4×683 Named Matrix{Float32}
A ╲ gene │ RPL22 PARK7 … TTC3 HMGN1
─────────┼──────────────────────────────────────────────────────────
MEBEMP-E │ 0.00437961 0.000115139 … 0.000122451 0.000290955
MEBEMP-L │ 0.00474096 0.000110458 0.000108683 0.000415481
MPP │ 0.00438723 0.000118797 0.000103007 0.000317991
memory-B │ 0.00373581 6.50531f-5 … 0.000122469 0.000160654
By default groups are sorted by their unique values. Explicitly specifying
VECTOR_AS_AXIS
for the group will change the rows or columns to the axis entries in the right (axis) order. T This may create rows or columns with all-zero values.
By default the result is sorted by the group value (this is also used as the name in the result
NamedArray
). Specifying an
VECTOR_AS_AXIS
before the reduction operation changes this to require that the group values be entries in some axis. In this case the result will have one entry for each entry of the axis, in the axis order.
metacells = example_metacells_daf()
metacells["@ metacell @ gene :: fraction -/ type =@ >- Mean"]
# output
4×683 Named Matrix{Float32}
type ╲ gene │ RPL22 PARK7 … TTC3 HMGN1
────────────┼──────────────────────────────────────────────────────────
memory-B │ 0.00373581 6.50531f-5 … 0.000122469 0.000160654
MEBEMP-E │ 0.00437961 0.000115139 0.000122451 0.000290955
MEBEMP-L │ 0.00474096 0.000110458 0.000108683 0.000415481
MPP │ 0.00438723 0.000118797 … 0.000103007 0.000317991
If some axis entries do not have any values associated with them, then the reduction will fail (e.g. "mean of an empty row/column vector"). In this case, you should specify a default value for the reduction. E.g.,
@ cell @ gene :: UMIs -/ metacell : type =@ >- Sum || 0
. Example:
Functions
DataAxesFormats.Queries.get_query
—
Function
get_query(
daf::DafReader,
query::QueryString;
[cache::Bool = true]
)::Union{AbstractSet{<:AbstractString}, StorageScalar, NamedVector, NamedMatrix}
query |> get_query(
daf::DafReader;
cache::Bool = true,
)
Apply the full
query
to the
Daf
data and return the result. By default, this will cache the final query result, so repeated identical queries will be accelerated. This may consume a large amount of memory. You can disable it by specifying
cache = false
, or release the cached data using
empty_cache!
.
As a shorthand syntax you can also invoke this using
getindex
, that is, using the
[]
operator (e.g.,
daf["@ cell"]
is equivalent to
get_query(daf, "@ cell"; cache = false)
). Finally, you can use
|>
to invoke the query, which is especially useful when constructing it from the operations
Axis("cell") |> get_query(daf)
or even
"@ cell" |> get_query(daf)
.
DataAxesFormats.Queries.has_query
—
Function
has_query(daf::DafReader, query::QueryString)::Bool
Return whether the
query
can be successfully applied to the
Daf
data.
DataAxesFormats.Queries.get_frame
—
Function
get_frame(
daf::DafReader,
axis::QueryString,
[columns::Maybe{FrameColumns} = nothing;
cache::Bool = true]
)::DataFrame end
Return a
DataFrame
containing multiple vectors of the same
axis
.
The
axis
can be either just the name of an axis (e.g.,
"cell"
), or a query for the axis (e.g.,
q"@ cell"
), possibly using a mask (e.g.,
q"@ cell [ age > 1 ]"
). The result of the query must be a vector of unique axis entry names.
If
columns
is not specified, the data frame will contain all the vector properties of the axis, in alphabetical order (since
DataFrame
has no concept of named rows, the 1st column will contain the name of the axis entry).
By default, this will not
cache
the results of the queries.
DataAxesFormats.Queries.FrameColumn
—
Type
Specify a column for
get_frame
for some axis. The most generic form is a pair
"column_name" => query
. Two shorthands apply: the pair
"column_name" => "="
is a shorthand for the pair
"column_name" => ": column_name"
, and so is the shorthand
"column_name"
(simple string).
We also allow specifying tuples instead of pairs to make it easy to invoke the API from other languages such as Python which do not have the concept of a
Pair
.
The query is combined with the axis query as follows (using
full_vector_query
). The (full) query result should be a vector with one value for each entry of the axis query result.
DataAxesFormats.Queries.FrameColumns
—
Type
Specify all the columns to collect for a frame. We would have liked to specify this as
AbstractVector{<:FrameColumn}
but Julia in its infinite wisdom considers
["a", "b" => "c"]
to be a
Vector{Any}
, which would require literals to be annotated with the type.
DataAxesFormats.Queries.full_vector_query
—
Function
full_vector_query(
axis_query::Query,
vector_query::QueryString,
vector_name::Maybe{AbstractString} = nothing,
)::Query
Given a query for an axis, and some suffix query for a vector property, combine them into a full query for the vector values for the axis. This is used by
FrameColumn
for
get_frame
and also for queries of vector data in views.
Normally we just concatenate the axis query and the vector query. However, similar to defining a view, if the query starts with an axis operator, it may require repeating the axis query in it, so an axis operator with the special
__axis__
name is replaced by the axis query.
DataAxesFormats.Queries.query_result_dimensions
—
Function
query_result_dimensions(query::QueryString)::Int
Return the number of dimensions (-1 - names, 0 - scalar, 1 - vector, 2 - matrix) of the results of a
query
. This also verifies the query is syntactically valid, though it may still fail if applied to specific data due to invalid data values or types.
DataAxesFormats.Queries.query_requires_relayout
—
Function
query_requires_relayout(daf::DafReader, query::QueryString)::Bool
Whether computing the
query
for the
daf
data requires
relayout
of some matrix. This also verifies the query is syntactically valid and that the query can be computed, though it may still fail if applied to specific data due to invalid values or types.
DataAxesFormats.Queries.is_axis_query
—
Function
is_axis_query(query::QueryString)::Bool
Returns whether the
query
specifies a (possibly masked) axis. This also verifies the query is syntactically valid, though it may still fail if applied to specific data due to invalid data values or types.
DataAxesFormats.Queries.query_axis_name
—
Function
query_axis_name(query::QueryString)::AbstractString
Return the axis name of a query. This must only be applied to queries that have a vector result that specify an axis, that is, if
is_axis_query
.
DataAxesFormats.Queries.guess_typed_value
—
Function
guess_typed_value(value::AbstractString)::StorageScalar
Given a string value, guess the typed value it represents:
-
trueandfalseare assumed to beBool. - Integers are assumed to be
Int64. - Floating point numbers are assumed to be
Float64, as areeandpi. - Anything else is assumed to be a string.
This doesn't have to be 100% accurate; it is intended to allow omitting the data type in most cases when specifying an
IfMissing
value. If it guesses wrong, just specify an explicit type (e.g.,
. version || 1.0 String
).
Query Operators
Names
DataAxesFormats.Queries.Names
—
Type
struct Names <: Query end
A query operation for looking up a set of names. In a string
Query
, this is specified using the
?
operator. This is only used in
NAMES_QUERY
.
Lookup
DataAxesFormats.Queries.LookupScalar
—
Type
struct LookupScalar <: Query
property_name::Maybe{AbstractString}
end
Lookup the value of a scalar property (see
SCALAR_QUERY
).
DataAxesFormats.Queries.Axis
—
Type
struct Axis <: Query
axis_name::Maybe{AbstractString}
end
A query operator for specifying an axis. This is used extensively in
VECTOR_QUERY
and
MATRIX_QUERY
. In addition, this is also used to ask for the names of axes (see
NAMES_QUERY
).
DataAxesFormats.Queries.AsAxis
—
Type
struct AsAxis <: QueryOperation
axis_name::Maybe{AbstractString}
end
A query operator for specifying that the values of a property we looked up are the names of entries in some axis. This is used extensively in
VECTOR_AS_AXIS
.
DataAxesFormats.Queries.LookupVector
—
Type
struct LookupVector <: QueryOperation
property_name::Maybe{AbstractString}
end
Lookup the value of a vector property (see
VECTOR_QUERY
).
DataAxesFormats.Queries.LookupMatrix
—
Type
struct LookupMatrix <: QueryOperation
property_name::Maybe{AbstractString}
end
Lookup the value of a matrix property, even if we immediately slice just a vector (row or column) or even a single scalar entry out of the matrix (see
SCALAR_QUERY
,
VECTOR_LOOKUP
and
MATRIX_QUERY
).
DataAxesFormats.Queries.SquareColumnIs
—
Type
struct SquareColumnIs <: QueryOperation
comparison_value::AbstractString
end
Whenever extracting a vector from a square matrix, specify the axis entry that identifies the column to extract. This is used in any phrase that looks up a vector out of a matrix (see
VECTOR_QUERY
and
MATRIX_QUERY
).
Julia and
Daf
use column-major layout as their default, so this is typically the natural way to extract a vector from a square matrix (e.g., for a square
is_in_neighborhood
matrix per block per block, the column is the base block and the rows are the other block, so the column vector contains a mask of all the blocks in the neighborhood of the base block).
DataAxesFormats.Queries.SquareRowIs
—
Type
struct SquareRowIs <: QueryOperation
comparison_value::AbstractString
end
Whenever extracting a vector from a square matrix, specify the axis entry that identifies the row to extract. This is used in any phrase that looks up a vector out of a matrix (see
VECTOR_QUERY
and
MATRIX_QUERY
).
Julia and
Daf
use column-major layout as their default, so this typically cuts across the natural way to extract a vector from a square matrix (e.g., for a square
is_in_neighborhood
matrix per block per block, the column is the base block and the rows are the other block, so the row vector contains a mask of all the base blocks that a given block is in the neighborhood of).
DataAxesFormats.Queries.IfMissing
—
Type
struct IfMissing <: QueryOperation
default_value::StorageScalar
end
A query operator for specifying a value to use for a property that is missing from the data. This is used anywhere we look up a property (see
SCALAR_QUERY
,
VECTOR_QUERY
,
MATRIX_QUERY
).
DataAxesFormats.Queries.IfNot
—
Type
struct IfNot <: QueryOperation
final_value::Maybe{StorageScalar}
end
Specify a final value to use when, having looked up some base property values, we use them as axis entry names to lookup another property of that axis. If the base property value is empty, then this is an error. Specifying
IfNot
without a
final_value
allows us to mask out that entry from the result instead. Specifying a
final_value
will use it for the final property value (since there may be an arbitrarily long chain of lookup operations).
Masks
DataAxesFormats.Queries.BeginMask
—
Type
struct BeginMask <: QueryOperation
property_name::AbstractString
end
Start specifying a mask to apply to an axis of the result. Must be accompanied by an
EndMask
(see
VECTOR_MASK
).
DataAxesFormats.Queries.BeginNegatedMask
—
Type
struct BeginNegatedMask <: QueryOperation
property_name::AbstractString
end
Start specifying a mask to apply to an axis of the result, negating the first mask. Must be accompanied by an
EndMask
(see
VECTOR_MASK
).
DataAxesFormats.Queries.EndMask
—
Type
struct EndMask <: QueryOperation end
Finish specifying a mask to apply to an axis of the result, following
BeginMask
or
BeginNegatedMask
(see
VECTOR_MASK
).
DataAxesFormats.Queries.AndMask
—
Type
struct AndMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise AND operator (see
VECTOR_MASK
).
DataAxesFormats.Queries.AndNegatedMask
—
Type
struct AndNegatedMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise AND-NOT operator (see
VECTOR_MASK
).
DataAxesFormats.Queries.OrMask
—
Type
struct OrMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise OR operator (see
VECTOR_MASK
).
DataAxesFormats.Queries.OrNegatedMask
—
Type
struct OrNegatedMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise OR-NOT operator (see
VECTOR_MASK
).
DataAxesFormats.Queries.XorMask
—
Type
struct XorMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise XOR operator (see
VECTOR_MASK
).
DataAxesFormats.Queries.XorNegatedMask
—
Type
struct XorNegatedMask <: QueryOperation
property_name::AbstractString
end
Combine a mask with another, using the bitwise XOR-NOT operator (see
VECTOR_MASK
).
Comparisons
DataAxesFormats.Queries.IsLess
—
Type
struct IsLess <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are less than the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsLessEqual
—
Type
struct IsLessEqual <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are less than or equal to the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsEqual
—
Type
struct IsEqual <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are equal to the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsNotEqual
—
Type
struct IsNotEqual <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are not equal to the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsGreater
—
Type
struct IsGreater <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are greater than the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsGreaterEqual
—
Type
struct IsGreaterEqual <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for entries that are greater than or equal to the
comparison_value
(see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsMatch
—
Type
struct IsMatch <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for (string!) entries that are a (complete!) match to the
comparison_value
regular expression (see
VECTOR_OPERATION
).
DataAxesFormats.Queries.IsNotMatch
—
Type
struct IsNotMatch <: QueryOperation
comparison_value::StorageScalar
end
Convert a vector of values to a vector of Booleans, is true for (string!) entries that are not a (complete!) match to the
comparison_value
regular expression (see
VECTOR_OPERATION
).
Groups
DataAxesFormats.Queries.CountBy
—
Type
struct CountBy <: QueryOperation
property_name::AbstractString
end
Specify a second property for each vector entry, to compute a matrix of counts of the entries with each combination of values (see
MATRIX_COUNT
.
DataAxesFormats.Queries.GroupBy
—
Type
struct GroupBy <: QueryOperation
property_name::AbstractString
end
Specify value per vector entry to group vector values by, must be followed by a
ReductionOperation
to reduce each group of values to a single value (see
VECTOR_GROUP
).
DataAxesFormats.Queries.GroupColumnsBy
—
Type
struct GroupColumnsBy <: QueryOperation
property_name::AbstractString
end
Specify value per matrix column to group the columns by, must be followed by a
ReduceToColumn
to reduce each group of columns to a single column (see
MATRIX_GROUP
).
DataAxesFormats.Queries.GroupRowsBy
—
Type
struct GroupRowsBy <: QueryOperation
property_name::AbstractString
end
Specify value per matrix row to group the rows by, must be followed by a
ReduceToRow
to reduce each group of rows to a single row (see
MATRIX_GROUP
).
DataAxesFormats.Queries.ReduceToColumn
—
Type
struct ReduceToColumn <: QueryOperation
reduction_operation::ReductionOperation
end
Specify a
ReductionOperation
to convert each row of a matrix to a single value, reducing the matrix to a single column (see
VECTOR_FROM_MATRIX
and
MATRIX_GROUP
).
DataAxesFormats.Queries.ReduceToRow
—
Type
struct ReduceToRow <: QueryOperation
reduction_operation::ReductionOperation
end
Specify a
ReductionOperation
to convert each column of a matrix to a single value, reducing the matrix to a single row (see
VECTOR_FROM_MATRIX
and
MATRIX_GROUP
).
Index
-
DataAxesFormats.Queries -
DataAxesFormats.Queries.MATRIX_COUNT -
DataAxesFormats.Queries.MATRIX_GROUP -
DataAxesFormats.Queries.MATRIX_OPERATION -
DataAxesFormats.Queries.MATRIX_QUERY -
DataAxesFormats.Queries.NAMES_QUERY -
DataAxesFormats.Queries.SCALAR_QUERY -
DataAxesFormats.Queries.VECTOR_AS_AXIS -
DataAxesFormats.Queries.VECTOR_FROM_MATRIX -
DataAxesFormats.Queries.VECTOR_GROUP -
DataAxesFormats.Queries.VECTOR_LOOKUP -
DataAxesFormats.Queries.VECTOR_MASK -
DataAxesFormats.Queries.VECTOR_MASK_LOOKUP -
DataAxesFormats.Queries.VECTOR_MASK_OPERATION -
DataAxesFormats.Queries.VECTOR_OPERATION -
DataAxesFormats.Queries.VECTOR_QUERY -
DataAxesFormats.Queries.AndMask -
DataAxesFormats.Queries.AndNegatedMask -
DataAxesFormats.Queries.AsAxis -
DataAxesFormats.Queries.Axis -
DataAxesFormats.Queries.BeginMask -
DataAxesFormats.Queries.BeginNegatedMask -
DataAxesFormats.Queries.CountBy -
DataAxesFormats.Queries.EndMask -
DataAxesFormats.Queries.FrameColumn -
DataAxesFormats.Queries.FrameColumns -
DataAxesFormats.Queries.GroupBy -
DataAxesFormats.Queries.GroupColumnsBy -
DataAxesFormats.Queries.GroupRowsBy -
DataAxesFormats.Queries.IfMissing -
DataAxesFormats.Queries.IfNot -
DataAxesFormats.Queries.IsEqual -
DataAxesFormats.Queries.IsGreater -
DataAxesFormats.Queries.IsGreaterEqual -
DataAxesFormats.Queries.IsLess -
DataAxesFormats.Queries.IsLessEqual -
DataAxesFormats.Queries.IsMatch -
DataAxesFormats.Queries.IsNotEqual -
DataAxesFormats.Queries.IsNotMatch -
DataAxesFormats.Queries.LookupMatrix -
DataAxesFormats.Queries.LookupScalar -
DataAxesFormats.Queries.LookupVector -
DataAxesFormats.Queries.Names -
DataAxesFormats.Queries.OrMask -
DataAxesFormats.Queries.OrNegatedMask -
DataAxesFormats.Queries.Query -
DataAxesFormats.Queries.QuerySequence -
DataAxesFormats.Queries.QueryString -
DataAxesFormats.Queries.ReduceToColumn -
DataAxesFormats.Queries.ReduceToRow -
DataAxesFormats.Queries.SquareColumnIs -
DataAxesFormats.Queries.SquareRowIs -
DataAxesFormats.Queries.XorMask -
DataAxesFormats.Queries.XorNegatedMask -
DataAxesFormats.Queries.full_vector_query -
DataAxesFormats.Queries.get_frame -
DataAxesFormats.Queries.get_query -
DataAxesFormats.Queries.guess_typed_value -
DataAxesFormats.Queries.has_query -
DataAxesFormats.Queries.is_axis_query -
DataAxesFormats.Queries.parse_query -
DataAxesFormats.Queries.query_axis_name -
DataAxesFormats.Queries.query_requires_relayout -
DataAxesFormats.Queries.query_result_dimensions -
DataAxesFormats.Queries.@q_str