A SOMAMeasurement
is a sub-element of a
SOMAExperiment
, and is otherwise a specialized
SOMACollection
with pre-defined fields: X
, var
,
obsm
/varm
, and obsp
/varp
(see
Active Bindings below for details) (lifecycle: maturing).
Adding new objects to a collection
The SOMAMeasurement
class provides a number of type-specific methods for
adding new a object to the collection, such as add_new_sparse_ndarray()
and
add_new_dataframe()
. These methods will create the new object and add it as
member of the SOMAMeasurement
. The new object will always inherit the parent
context (see SOMATileDBContext
) and, by default, its platform
configuration (see PlatformConfig
). However, the user can override the
default platform configuration by passing a custom configuration to the
platform_config
argument.
Super classes
tiledbsoma::SOMAObject
-> tiledbsoma::SOMACollectionBase
-> SOMAMeasurement
Active bindings
var
A
SOMADataFrame
containing primary annotations on the variable axis, for variables in this measurement (i.e., annotates columns ofX
). The contents of thesoma_joinid
column define the variable index domain,var_id
. All variables for this measurement must be defined in this data frame.X
A
SOMACollection
ofSOMASparseNDArrays
, each contains measured feature values indexed by[obsid, varid]
.obsm
A
SOMACollection
ofSOMADenseNDArrays
containing annotations on the observation axis. Each array is indexed byobsid
and has the same shape asobs
.obsp
A
SOMACollection
ofSOMASparseNDArrays
containing pairwise annotations on the observation axis and indexed with[obsid_1, obsid_2]
.varm
A
SOMACollection
ofSOMADenseNDArrays
containing annotations on the variable axis. Each array is indexed byvarid
and has the same shape asvar
.varp
A
SOMACollection
ofSOMASparseNDArrays
containing pairwise annotations on the variable axis and indexed with[varid_1, varid_2]
.
Methods
Inherited methods
tiledbsoma::SOMAObject$class()
tiledbsoma::SOMAObject$exists()
tiledbsoma::SOMAObject$get_metadata()
tiledbsoma::SOMAObject$initialize()
tiledbsoma::SOMAObject$is_open()
tiledbsoma::SOMAObject$mode()
tiledbsoma::SOMAObject$reopen()
tiledbsoma::SOMACollectionBase$add_new_collection()
tiledbsoma::SOMACollectionBase$add_new_dataframe()
tiledbsoma::SOMACollectionBase$add_new_dense_ndarray()
tiledbsoma::SOMACollectionBase$add_new_sparse_ndarray()
tiledbsoma::SOMACollectionBase$close()
tiledbsoma::SOMACollectionBase$create()
tiledbsoma::SOMACollectionBase$get()
tiledbsoma::SOMACollectionBase$length()
tiledbsoma::SOMACollectionBase$names()
tiledbsoma::SOMACollectionBase$open()
tiledbsoma::SOMACollectionBase$print()
tiledbsoma::SOMACollectionBase$remove()
tiledbsoma::SOMACollectionBase$set()
tiledbsoma::SOMACollectionBase$set_metadata()
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-measurement2709c0d93d3
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-measurement2709c0d93d3
ms$var
#> <SOMADataFrame>
#> uri: file:///tmp/RtmpjD0Pq2/soma-measurement2709c0d93d3/var
#> dimensions: soma_joinid
#> attributes: var_id