tiledbsoma.io.resize_experiment¶
- tiledbsoma.io.resize_experiment(uri: str, *, nobs: int, nvars: ~typing.Dict[str, int], verbose: bool = False, check_only: bool = False, context: ~tiledbsoma.options._soma_tiledb_context.SOMATileDBContext | None = None, output_handle: ~_io.TextIOWrapper | ~_io.StringIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) bool¶
For each dataframe contained within the SOMA
Experimentpointed to by the given URI, resizes thedomainfor thesoma_joinidindex column (if it is an indexed column) to match the desired new value.The desired new value may be the same size as at present, or bigger, but not exceeding
maxdomainfor thesoma_joinidindex column.For each N-D array contained within the SOMA
Experiment, resizes theshapeto match the desired values.For
Xarrays, the resize is to newnobsx the measurement’s newnvar.For
obsmarrays, the resize is to newnobsx the array’s existingsoma_dim_1shape.For
obsparrays, the resize is to newnobsx that samenobs.For
varmarrays, the resize is to newnvarx the array’s existingsoma_dim_1shape.For
varparrays, the resize is to newnvarx that samenvar.
In all cases, the desired new
shapevalue may be the same size on the given dimension, or bigger, but not exceedingmaxshapefor the given dimension.If any array has not been upgraded, then the experiment’s
resizewill fail.- Parameters:
uri – The URI of a SOMA
Experiment.nobs – The desired new shape of the experiment’s
obsdataframe.nvars – The desired new shapes of the experiment’s
vardataframes. This should be a dict from measurement name to shape, e.g.{"RNA": 10000, "raw": 20000}.verbose – If
True, produce per-array output as the upgrade runs.check_only – If
True, don’t apply the upgrades, but show what would be attempted, and show why each one would fail.context – Optional
SOMATileDBContext.
Example:
>>> tiledbsoma.io.resize_experiment( 'pbmc3k_unprocessed', nobs=5600, nvars={"data":3204, "raw": 13714}, check_only=True, ) [DataFrame] obs URI file:///data/pbmc3k_unprocessed/obs Dry run for: tiledbsoma_resize_soma_joinid_shape(5600) OK [DataFrame] ms/RNA/var URI file:///data/pbmc3k_unprocessed/ms/RNA/var Dry run for: tiledbsoma_resize_soma_joinid_shape(13714) OK [SparseNDArray] ms/RNA/X/data URI file:///data/pbmc3k_unprocessed/ms/RNA/X/data Dry run for: resize((5600, 13714)) OK