test_that("annotation pairwise matrix can be stored and retrieved", {
uri <- file.path(withr::local_tempdir(), "annot-mat")
mat <- matrix(runif(100), nrow = 10, ncol = 10)
annotmat <- AnnotationPairwiseMatrix$new(uri)
expect_true(inherits(annotmat, "AnnotationPairwiseMatrix"))
rlabs <- clabs <- paste0("R", seq_len(nrow(mat)))
dimnames(mat) <- list(rlabs, clabs)
annotmat$from_matrix(mat, index_cols = c("i", "j"))
expect_true(dir.exists(annotmat$uri))
expect_s4_class(annotmat$tiledb_array(), "tiledb_array")
mat2 <- annotmat$to_matrix()
expect_identical(mat[rlabs, clabs], mat2[rlabs, clabs])
# verify legacy metadata tag is present
expect_equal(
annotmat$get_metadata(SOMA_LEGACY_VALIDITY_KEY),
SOMA_LEGACY_VALIDITY
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.