tiledbsoma.Measurement

class tiledbsoma.Measurement(handle: GroupWrapper, **kwargs: Any)

A set of observations defined by a dataframe, with measurements.

This is a common set of annotated variables (defined by the var dataframe) for which values (e.g., measurements or calculations) are stored in sparse and dense ND arrays.

The observables are inherited from the parent Experiment’s obs dataframe. The soma_joinid of these observables (obsid), along with those of the measurement’s var dataframe (varid), are the indices for all the other matrices stored in the measurement.

In most cases, users interact with a measurement via querying the experiment which contains it, rather than directly accessing its fields.

var

Primary annotations on the variable axis, for variables in this measurement (i.e., annotates columns of X). The contents of the soma_joinid column define the variable index domain, AKA var_id. All variables for this measurement must be defined in this dataframe.

Type:

DataFrame

X

A collection of sparse matrices, each containing measured feature values. Each matrix is indexed by [obsid, varid].

Type:

Collection[SparseNDArray]

obsm

A collection of dense matrices containing annotations of each obs row. Has the same shape as obs, and is indexed with obsid.

Type:

Collection[DenseNDArray]

obsp

A collection of sparse matrices containing pairwise annotations of each obs row. Indexed with [obsid_1, obsid_2].

Type:

Collection[SparseNDArray]

varm

A collection of dense matrices containing annotations of each var row. Has the same shape as var, and is indexed with varid.

Type:

Collection[DenseNDArray]

varp

A collection of sparse matrices containing pairwise annotations of each var row. Indexed with [varid_1, varid_2]

Type:

Collection[SparseNDArray]

Lifecycle

Experimental.

__init__(handle: GroupWrapper, **kwargs: Any)

Internal-only common initializer steps.

This function is internal; users should open TileDB SOMA objects using the create() and open() factory class methods.

Methods

__init__(handle, **kwargs)

Internal-only common initializer steps.

add_new_collection(key[, kind, uri, ...])

Adds a new sub-collection to this collection.

add_new_dataframe(key, *[, uri, ...])

Adds a new DataFrame to this collection.

add_new_dense_ndarray(key, *, cls[, uri, ...])

Adds a new DenseNDArray to this Collection.

add_new_sparse_ndarray(key, *, cls[, uri, ...])

Adds a new SparseNDArray to this Collection.

clear()

close()

Release any resources held while the object is open.

create(uri, *[, platform_config, context, ...])

Creates and opens a new SOMA collection in storage.

exists(uri[, context, tiledb_timestamp])

Finds whether an object of this type exists at the given URI.

get(k[,d])

items()

keys()

open(uri[, mode, tiledb_timestamp, context, ...])

Opens this specific type of SOMA object.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

set(key, value, *[, use_relative_uri])

Adds an element to the collection.

setdefault(k[,d])

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

verify_open_for_writing()

Raises an error if the object is not open for writing.

Attributes

X

A collection of matrices containing feature values.

closed

True if the object has been closed.

context

A value storing implementation-specific configuration information.

metadata

The metadata of this SOMA object.

mode

The mode this object was opened in, either r or w.

obsm

Matrices containing annotations of each obs row.

obsp

Matrices containg pairwise annotations of each obs row.

soma_type

A string describing the SOMA type of this object.

tiledb_timestamp

The time that this object was opened in UTC.

tiledb_timestamp_ms

The time this object was opened, as millis since the Unix epoch.

uri

Accessor for the object's storage URI.

var

Primary annotations on the variable axis for vars on this meansurement.

varm

Matrices containing annotations of each var row.

varp

Matrices containg pairwise annotations of each var row.