Set a matrix indexed by a pair of axes.
Arguments
- daf
A
DafReader.- rows_axis
Row-axis name.
- columns_axis
Column-axis name.
- name
Matrix name.
- mat
Dense
matrix, or sparsedgCMatrix/lgCMatrix, of shapeaxis_length(rows_axis) x axis_length(columns_axis).- overwrite
See
set_scalar.- relayout
If
TRUE(the default, matching Juliaset_matrix!(...; relayout = true)), also store the flipped layout soget_matrix(columns_axis, rows_axis, name)is directly available and skips the transpose-on-the-fly path. SetFALSEto store only the given orientation (saving storage at the cost of on-the-fly transposes).
Examples
# Mirrors writers.jl jldoctest at line 686.
m <- example_metacells_daf()
has_matrix(m, "gene", "metacell", "confidence", relayout = FALSE) # FALSE
#> [1] FALSE
set_matrix(m, "metacell", "gene", "confidence",
matrix(stats::runif(7L * 683L), 7L, 683L), relayout = FALSE)
has_matrix(m, "gene", "metacell", "confidence", relayout = FALSE) # FALSE
#> [1] FALSE
has_matrix(m, "metacell", "gene", "confidence", relayout = FALSE) # TRUE
#> [1] TRUE
set_matrix(m, "metacell", "gene", "confidence",
matrix(stats::runif(7L * 683L), 7L, 683L),
overwrite = TRUE, relayout = TRUE)
has_matrix(m, "gene", "metacell", "confidence", relayout = FALSE) # TRUE
#> [1] TRUE
has_matrix(m, "metacell", "gene", "confidence", relayout = FALSE) # TRUE
#> [1] TRUE