Skip to contents

Core data model

DafReader()
Base abstract reader class.
DafReadOnly()
Abstract read-only reader class.
DafWriter()
Abstract writer class.
MemoryDaf()
Concrete DafWriter backed by R environments (no I/O).
FilesDaf()
File-backed Daf writer class.
FilesDafReadOnly()
File-backed read-only Daf class.
ZarrDaf()
Zarr-backed Daf class.
ZarrDafReadOnly()
Read-only Zarr-backed Daf class.
HttpDaf() http_daf()
Read-only HTTP-served FilesDaf.
memory_daf()
In-memory Daf store.
files_daf()
File-backed Daf store.
zarr_daf()
Open a Zarr-backed Daf store.
pack_files_daf_metadata()
Pack a FilesDaf directory's JSON metadata into metadata.zip.
is_daf()
Test whether an object is a DafReader.
is_leaf()
Is daf a leaf storage format?
daf_name()
Return the name of a DafReader.
description()
Human-readable summary of a Daf store.
complete_path()
Canonical disk path of a (possibly chained) daf.
read_only()
Wrap a writer into a read-only view via a 1-element chain.
empty_cache()
Empty caches on a Daf object.

Readers

get_scalar()
Get a scalar, optionally with a default when missing.
get_vector()
Get a vector, returning it as an axis-named R vector.
get_matrix()
Get a matrix, returning it with axis-entry dimnames.
has_scalar()
Test whether a scalar exists.
has_vector()
Test whether a vector exists on an axis.
has_matrix()
Test whether a matrix exists for an axis pair.
has_axis()
Test whether an axis exists.
scalars_set()
Names of all scalars, sorted.
axes_set()
Names of all axes, sorted.
axis_entries()
Entry names of an axis (full or by index).
axis_dict()
Entry-name to 1-based-index hash for an axis.
axis_indices()
Look up 1-based positions of entries in an axis.
axis_length()
Length (entry count) of an axis.
axis_vector()
Entry-name vector for an axis.
vectors_set()
Names of vectors on an axis, sorted.
matrices_set()
Names of matrices for an axis pair, sorted.

Writers

add_axis()
Add a new axis.
delete_axis()
Delete an axis (and all vectors / matrices that depend on it).
set_scalar()
Set a scalar.
delete_scalar()
Delete a scalar.
set_vector()
Set a vector on an axis.
delete_vector()
Delete a vector on an axis.
set_matrix()
Set a matrix indexed by a pair of axes.
delete_matrix()
Delete a matrix.
relayout_matrix()
Physically store the transposed layout of a matrix.
reorder_axes()
Reorder one or more axis entries in place.
reset_reorder_axes()
Reset any in-progress axis reorder.
empty_data()
Build a flat-keyed empty (or types) list for copy_all().

Query DSL (string form)

get_query()
Evaluate a query against a daf reader.
has_query()
Check whether a query can be evaluated against a daf without error.
parse_query()
Parse a query string into an AST (list of qop nodes).
canonical_query()
Canonicalise a query string.
is_axis_query()
Test whether a query yields an axis entry vector.
query_axis_name()
Return the axis name implied by a query, if any.
query_result_dimensions()
Return the dimensionality of a query's result.
query_requires_relayout()
Does evaluating this query require a matrix relayout (transpose)?
escape_value()
Escape a value for use as a query literal.
unescape_value()
Inverse of escape_value().

Query builders (DafrQuery)

DafrQuery()
Pipe-composable query object.
Abs()
Element-wise query operation: absolute value.
Clamp()
Element-wise query operation: clamp values to a range.
Convert()
Element-wise query operation: convert values to a given type.
Fraction()
Element-wise query operation: convert each entry to its fraction of the total.
Log()
Element-wise query operation: logarithm.
Round()
Element-wise query operation: round to nearest integer.
Significant()
Element-wise query operation: keep only "significant" entries.
Count()
Reduction query operation: count non-zero entries.
CountBy()
Count-by query operation.
GeoMean()
Reduction query operation: geometric mean.
GroupBy()
Group-by query operation.
GroupColumnsBy()
Group-columns-by query operation.
GroupRowsBy()
Group-rows-by query operation.
Max()
Reduction query operation: maximum.
Mean()
Reduction query operation: mean.
Median()
Reduction query operation: median.
Min()
Reduction query operation: minimum.
Mode()
Reduction query operation: most-frequent value.
Quantile()
Reduction query operation: quantile.
ReduceToColumn()
Reduce-to-column query operation.
ReduceToRow()
Reduce-to-row query operation.
Std()
Reduction query operation: standard deviation.
StdN()
Reduction query operation: standard deviation normalised by the mean.
Sum()
Reduction query operation: sum.
Var()
Reduction query operation: variance.
VarN()
Reduction query operation: variance normalised by the mean.
Axis()
Axis selection query operation.
AsAxis()
As-axis query operation.
BeginMask()
Begin-mask query operation.
BeginNegatedMask()
Negated begin-mask query operation.
EndMask()
End-mask query operation.
IfMissing()
If-missing query operation.
IfNot()
If-not query operation.
LookupMatrix()
Lookup-matrix query operation.
LookupScalar()
Lookup-scalar query operation.
LookupVector()
Lookup-vector query operation.
Names()
Names query operation.
SquareColumnIs()
Square-column-is query operation.
SquareRowIs()
Square-row-is query operation.
AndMask()
And-mask query operation.
AndNegatedMask()
And-negated-mask query operation.
OrMask()
Or-mask query operation.
OrNegatedMask()
Or-negated-mask query operation.
XorMask()
Xor-mask query operation.
XorNegatedMask()
Xor-negated-mask query operation.
IsEqual()
Equal-to comparison query operation.
IsGreater()
Greater-than comparison query operation.
IsGreaterEqual()
Greater-than-or-equal comparison query operation.
IsLess()
Less-than comparison query operation.
IsLessEqual()
Less-than-or-equal comparison query operation.
IsMatch()
Regex-match query operation.
IsNotEqual()
Not-equal-to comparison query operation.
IsNotMatch()
Negated regex-match query operation.

DataFrames

get_dataframe()
Extract vectors on an axis as a data.frame.
get_dataframe_query()
Extract an axis-resolving query's result as a data.frame.
get_tidy()
Pivot axis vectors into a tidy long-format tibble.

AnnData interop

DafAnnData
Read-only AnnData-shaped facade over a Daf.
as_anndata()
One-shot factory for a DafAnnData facade.
h5ad_as_daf()
Load a Muon-style h5ad file into a memory_daf.
daf_as_h5ad()
Write a Daf to a Muon-style h5ad file.

Chains & views

chain_reader()
Create a read-only chain of DafReaders.
chain_writer()
Create a chain of DafReaders with a final DafWriter.
viewer()
Construct a ViewDaf over a base daf.
ViewDaf()
A read-only view over a base daf.
ReadOnlyChainDaf()
Read-only chain of DafReaders.
WriteChainDaf()
Write chain of DafReaders with a final DafWriter.
VIEW_ALL_AXES
Default view spec: expose all axes as-is.
VIEW_ALL_DATA
Default view spec: expose all data (scalars + vectors + matrices) as-is.
VIEW_ALL_MATRICES
Default view spec: expose all matrices as-is.
VIEW_ALL_SCALARS
Default view spec: expose all scalars as-is.
VIEW_ALL_VECTORS
Default view spec: expose all vectors as-is.

Contracts

Contract()
A contract describing a computation's inputs and outputs.
ContractDaf()
Contract-enforcing daf wrapper
contract_scalar() contract_vector() contract_matrix()
Contract entry constructors
tensor_contract()
Tensor-contract record.
axis_contract()
Axis-contract record.
function_contract()
Retrieve the contract bound to a wrapped computation.
create_contract()
Construct a Contract() from typed per-category argument lists.
contract_description()
Render a contract as a human-readable multi-line string.
contract_docs()
Render a Contract() as human-readable documentation.
contractor()
Wrap a daf with a contract for a computation
verify_input() verify_output()
Verify contract inputs / outputs
verify_contract()
Single-pass contract verification (input + output).
merge_contracts()
Merge two contracts.
RequiredInput OptionalInput CreatedOutput GuaranteedOutput OptionalOutput
Contract expectation constants

Computations & adapters

computation()
Wrap a function so a contract is enforced on every call.
adapter()
Apply a computation to a renaming view of a DafWriter.

Mmap readers

mmap_dgCMatrix()
Construct a dgCMatrix whose x, i, p slots are ALTREP mmap views.
mmap_real() mmap_int() mmap_lgl()
Open a binary file as a read-only mmap-backed vector.

Op registry

register_eltwise()
Register an eltwise operation.
register_reduction()
Register a reduction operation.
registered_eltwise()
List registered eltwise operations.
registered_reductions()
List registered reduction operations.
get_eltwise()
Retrieve a registered eltwise operation by name.
get_reduction()
Retrieve a registered reduction operation by name.

Fast kernels

OpenMP-parallel kernels callable directly on in-memory data, bypassing the DSL overhead. Intended for downstream packages with their own session-level caches.

fast_log()
Parallel log(x + eps) / log(base) on dense numeric input.
top_k_per_col()
Per-column bounded top-K with OpenMP.

Handlers

register_dafr_handler()
Register a handler for an action category.
inefficient_action_handler()
Register a handler for the "inefficient" action category.
ERROR_HANDLER WARN_HANDLER IGNORE_HANDLER
Inefficient-action handler constants.

Threads

OpenMP thread-count control. Kernels honour the value set via set_num_threads() (or the dafr.num_threads option). CRAN-like environments are auto-capped to two cores on package load.

set_num_threads() get_num_threads()
Control OpenMP thread count for dafr kernels.

Version counters

axis_version_counter()
Per-axis version counter.
vector_version_counter()
Per-vector version counter.
matrix_version_counter()
Per-matrix version counter.
MEMORY_DATA MAPPED_DATA QUERY_DATA
Cache-group constants.

Group helpers

compact_groups()
Renumber group indices to be dense in 1..N.
collect_group_members()
Invert group-index assignment into per-group entry lists.
group_names()
Deterministic names for groups of axis entries.

Example data

example_cells_daf()
Load cells example data into a MemoryDaf.
example_metacells_daf()
Load metacells example data into a MemoryDaf.
example_chain_daf()
Load a chain of cells and metacells example data.

Copy & concat

copy_all()
Copy everything from one daf to another.
copy_axis()
Copy an axis (its entries) from one daf to another.
copy_vector()
Copy a vector from one daf to another.
copy_matrix()
Copy a matrix from one daf to another.
copy_scalar()
Copy a scalar from one daf to another.
copy_tensor()
Copy a tensor (set of per-main-axis-entry matrices) between dafs.
concatenate()
Concatenate multiple dafs along one or more axes.
files_to_zarr()
Convert a files_daf directory to a zarr_daf directory.
zarr_to_files()
Convert a zarr_daf directory to a files_daf directory.
ALL_AXES
Wildcard for all axes.
ALL_MATRICES
Wildcard for all matrices.
ALL_SCALARS
Wildcard for all scalars.
ALL_VECTORS
Wildcard for all vectors.
MERGE_SKIP MERGE_LAST_VALUE MERGE_COLLECT_AXIS
Merge action constants for concatenate().

Zarr store backend

ZarrStore() DirStore() DictStore() MmapZipStore()
Zarr v2 Store abstract base class.
new_dict_store()
Create an in-memory Zarr v2 store.
new_dir_store()
Create a directory-backed Zarr v2 store.
new_mmap_zip_store()
Create a zip-archive-backed Zarr v2 store (mmap, append-only).
new_http_store()
Construct a read-only ZarrStore over HTTP.
HttpStore()
Read-only HTTP-served Zarr store.
store_get_bytes() store_set_bytes() store_delete() store_exists() store_list()
Zarr v2 store generics.

Reconstruction & completion

open_daf()
Open a Daf store by URI or path.
complete_daf()
Reopen a persistent chain from disk.
complete_chain()
Create a persistent chain by linking new_daf to a base_daf.
reconstruct_axis()
Promote an implicit property to an explicit axis.