tiledbsoma.ExperimentAxisQuery¶
- class tiledbsoma.ExperimentAxisQuery(experiment: Experiment, measurement_name: str, *, obs_query: AxisQuery = AxisQuery(value_filter=None, coords=()), var_query: AxisQuery = AxisQuery(value_filter=None, coords=()), index_factory: IndexFactory = <class 'pandas.core.indexes.base.Index'>)¶
Axis-based query against a SOMA Experiment.
ExperimentAxisQuery allows easy selection and extraction of data from a single
Measurementin anExperiment, by obs/var (axis) coordinates and/or value filter.The primary use for this class is slicing
ExperimentXlayers by obs or var value and/or coordinates. Slicing onSparseNDArrayXmatrices is supported;DenseNDArrayis not supported at this time.IMPORTANT: this class is not thread-safe.
IMPORTANT: this query class assumes it can store the full result of both axis dataframe queries in memory, and only provides incremental access to the underlying X NDArray. API features such as
n_obsandn_varscodify this in the API.The ExperimentAxisQuery is a context manager and it is recommended that you use the following pattern:
with ExperimentAxisQuery(...) as query: ...
Lifecycle: maturing
- __init__(experiment: Experiment, measurement_name: str, *, obs_query: AxisQuery = AxisQuery(value_filter=None, coords=()), var_query: AxisQuery = AxisQuery(value_filter=None, coords=()), index_factory: IndexFactory = <class 'pandas.core.indexes.base.Index'>)¶
Methods
X(layer_name, *[, batch_size, partitions, ...])Returns an
Xlayer as a sparse read.__init__(experiment, measurement_name, *[, ...])close()Releases resources associated with this query.
obs(*[, column_names, batch_size, ...])Returns
obsas an Arrow table iterator.Returns
obssoma_joinidsas an Arrow array.Returns a pyarrow array with scene ids that contain obs from this query.
obsm(layer)Returns an
obsmlayer as a sparse read.obsp(layer)Returns an
obsplayer as a sparse read.to_anndata(X_name, *[, column_names, ...])Exports the query to an in-memory
AnnDataobject.to_spatialdata(X_name, *[, column_names, ...])Returns a SpatialData object containing the query results.
var(*[, column_names, batch_size, ...])Returns
varas an Arrow table iterator.Returns
varsoma_joinidsas an Arrow array.Return a pyarrow array with scene ids that contain var from this query.
varm(layer)Returns a
varmlayer as a sparse read.varp(layer)Returns a
varplayer as a sparse read.Attributes
A
soma_joinidindexer for bothobsandvaraxes.The number of
obsaxis query results.The number of
varaxis query results.