tiledbsoma.io.append_X

tiledbsoma.io.append_X(exp: ~tiledbsoma._experiment.Experiment, new_X: ~numpy.ndarray | ~h5py._hl.dataset.Dataset | ~scipy.sparse._csr.csr_matrix | ~scipy.sparse._csc.csc_matrix | ~anndata.abc.CSCDataset | ~anndata.abc.CSRDataset, measurement_name: str, X_layer_name: str, obs_ids: ~typing.Sequence[str], var_ids: ~typing.Sequence[str], *, registration_mapping: ~tiledbsoma.io._registration.ambient_label_mappings.ExperimentAmbientLabelMapping, X_kind: ~typing.Type[~tiledbsoma._sparse_nd_array.SparseNDArray] | ~typing.Type[~tiledbsoma._dense_nd_array.DenseNDArray] = <class 'tiledbsoma._sparse_nd_array.SparseNDArray'>, context: ~tiledbsoma.options._soma_tiledb_context.SOMATileDBContext | None = None, platform_config: ~typing.Dict[str, ~typing.Mapping[str, ~typing.Any]] | object | None = None) str

Appends new data to an existing X matrix. Nominally to be used in conjunction with update_obs and update_var, as an itemized alternative to doing from_anndata with a registration mapping supplied.

Example:

rd = tiledbsoma.io.register_anndatas(
    exp_uri,
    [new_anndata],
    measurement_name="RNA",
    obs_field_name="obs_id",
    var_field_name="var_id",
)


with tiledbsoma.Experiment.open(exp_uri) as exp:
    tiledbsoma.io.append_X(
        exp,
        new_X=adata.X,
        measurement_name=measurement_name,
        X_layer_name=X_layer_name,
        obs_ids=list(new_anndata.obs.index),
        var_ids=list(new_anndata.var.index),
        registration_mapping=rd,
    )

Lifecycle

Maturing.