The tiledbsoma.io module

Functions

Data conversion to/from TileDB-SOMA

tiledbsoma.io.from_h5ad

Reads an .h5ad file and writes it to an Experiment.

tiledbsoma.io.from_anndata

Writes an AnnData object to an Experiment.

tiledbsoma.io.to_h5ad

Converts the experiment group to AnnData format and writes it to the specified .h5ad file.

tiledbsoma.io.to_anndata

Converts the experiment group to AnnData format.

Updating values within a TileDB-SOMA Experiment

tiledbsoma.io.add_X_layer

Add a new X layer to a measurement in the experiment.

tiledbsoma.io.update_obs

Replace the entire obs DataFrame with the contents of a new pandas.DataFrame.

tiledbsoma.io.update_var

Replace the entire var DataFrame with the contents of a new pandas.DataFrame.

tiledbsoma.io.update_matrix

Given a SparseNDArray or DenseNDArray already opened for write, writes the new data.

Growing a TileDB-SOMA Experiment

tiledbsoma.io.register_anndatas

Register AnnData objects to extend an existing SOMA Experiment.

tiledbsoma.io.register_h5ads

Register H5AD files to extend an existing SOMA Experiment.

tiledbsoma.io.get_experiment_shapes

Returns the current shapes of the elements in the Experiment.

tiledbsoma.io.show_experiment_shapes

Outputs the current shapes of the elements in the Experiment.

tiledbsoma.io.upgrade_experiment_shapes

Upgrade the elements inside a SOMA Experiment to use the shape feature introduced in TileDB-SOMA 1.15.

tiledbsoma.io.resize_experiment

Resize the elements in the SOMA Experiment to fit the requested number of observations and variables.

Classes

class tiledbsoma.io.ExperimentAmbientLabelMapping(*, obs_axis: AxisAmbientLabelMapping, var_axes: dict[str, AxisAmbientLabelMapping], prepared: bool = False)

For all the to-be-appended AnnData/H5AD inputs in SOMA multi-file append-mode ingestion, this class contains information required to perform ingestion via from_h5ad or from_anndata.

This class tracks the mapping from input-data obs or var ID-column name (barcode ID, gene symbol) to SOMA join IDs for SOMA experiment obs or var, as well as any dictionary/enumeration values.

Methods

prepare_experiment(experiment_uri[, context])

Prepare experiment for ingestion.

subset_for_anndata(adata)

Return a copy of this object containing only the information necessary to ingest the specified AnnData.

subset_for_h5ad(h5ad_path)

Subset this plan to only contain ID maps useful for this H5AD.