Skip to contents

Factory function to open a SOMA measurement for reading (lifecycle: maturing).

Usage

SOMAMeasurementOpen(
  uri,
  mode = "READ",
  platform_config = NULL,
  tiledbsoma_ctx = NULL,
  tiledb_timestamp = NULL
)

Arguments

uri

URI for the TileDB object.

mode

One of “READ” or “WRITE”.

platform_config

Optional platform configuration.

tiledbsoma_ctx

Optional SOMATileDBContext.

tiledb_timestamp

Optional Datetime (POSIXct) for TileDB timestamp; defaults to the current time. If not NULL, all members accessed through the collection inherit the timestamp.

Value

A SOMA measurement stored at uri opened in mode mode.

Examples

uri <- withr::local_tempfile(pattern = "soma-measurement")
var <- data.frame(
  soma_joinid = bit64::seq.integer64(0L, 99L),
  var_id = paste0("feature_", seq_len(100L))
)
sch <- arrow::infer_schema(var)

(ms <- SOMAMeasurementCreate(uri))
#> <SOMAMeasurement>
#>   uri: /tmp/RtmpjD0Pq2/soma-measurement27091244cc66
sdf <- ms$add_new_dataframe(
  "var",
  sch,
  "soma_joinid",
  list(soma_joinid = c(0, 100))
)
sdf$write(arrow::as_arrow_table(var, schema = sch))
sdf$close()
ms$close()

(ms <- SOMAMeasurementOpen(uri))
#> <SOMAMeasurement>
#>   uri: /tmp/RtmpjD0Pq2/soma-measurement27091244cc66
ms$var
#> <SOMADataFrame>
#>   uri: file:///tmp/RtmpjD0Pq2/soma-measurement27091244cc66/var
#>   dimensions: soma_joinid 
#>   attributes: var_id