tiledbsoma.Experiment¶
- class tiledbsoma.Experiment(handle: tiledbsoma._tdb_handles.GroupWrapper, **kwargs: Any)¶
A collection subtype that combines observations and measurements from an individual experiment.
In single cell biology, this can represent multiple modes of measurement across a single collection of cells (i.e., a “multimodal dataset”). Within an experiment, a set of measurements on a single set of variables (i.e., features) is represented as a
Measurement
.- obs¶
Primary annotations on the observation axis. The contents of the
soma_joinid
column define the observation index domain, AKAobs_id
. All observations for the Experiment must be defined in this dataframe.- Type
- ms¶
A collection of named measurements.
- Type
Example
>>> import tiledbsoma >>> with tiledbsoma.open("/path/to/experiment") as exp: ... # While users can interact directly with an Experiment's fields: ... obs_df = exp.obs ... ... # the primary use case is to run queries on the experiment data. ... q = exp.query( ... "mtdna", ... obs_query=tiledbsoma.AxisQuery(value_filter="tissue == 'lung'"), ... var_query=tiledbsoma.AxisQuery(coords=(slice(50, 100),)), ... ) ... query_obs = q.obs().concat().to_pandas() ... query_var = q.var().concat().to_pandas()
Lifecycle
Experimental.
- __init__(handle: tiledbsoma._tdb_handles.GroupWrapper, **kwargs: Any)¶
Internal-only common initializer steps.
This function is internal; users should open TileDB SOMA objects using the
create()
andopen()
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.
axis_query
(measurement_name, *[, obs_query, ...])Creates an axis query over this experiment.
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
()Attributes
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
orw
.A collection of named measurements.
Primary observations on the observation axis.
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.