tiledbsoma.Experiment.var_axis_delete

Experiment.var_axis_delete(measurement_name: str, coords: Sequence[None | bytes | Slice[bytes] | Sequence[bytes] | float | Slice[float] | Sequence[float] | int | Slice[int] | Sequence[int] | slice | Slice[slice] | Sequence[slice] | str | Slice[str] | Sequence[str] | datetime64 | Slice[datetime64] | Sequence[datetime64] | TimestampType | Slice[TimestampType] | Sequence[TimestampType] | Array | ChunkedArray | ndarray[tuple[Any, ...], dtype[integer]] | ndarray[tuple[Any, ...], dtype[datetime64]]] = (), *, value_filter: str | None = None, platform_config: Dict[str, Mapping[str, Any]] | object | None = None) None

Delete variables (var axis elements only) from all predefined sub-objects within a single user-specified Measurement.

Deleted features are specified:

  • by var DataFrame joinid: a sequence of joinid or a slice

  • by var DataFrame value filter / query condition

Sub-objects affected by this operation, given a named Measurement (ms_name):

  • exp.ms[ms_name].var - delete matching DataFrame elements

  • exp.ms[ms_name].var_spatial_presence - delete matching DataFrame elements, joining on the soma_joinid dimension

  • exp.ms[ms_name].X[*] - delete matching SparseNDMatrix values, joining on the soma_dim_1 dimension

  • exp.ms[ms_name].varm[*] - delete matching SparseNDMatrix values, joining on the soma_dim_0 dimension

  • exp.ms[ms_name].varp[*] - delete matching SparseNDMatrix values, joining on the soma_dim_0 and soma_dim_1 dimensions

  • exp.spatial[*].varl[ms_name][*] - delete matching PointCloudDataFrame/GeometryDataFrame elements, joining on the soma_joinid dimension

The following Measurement sub-objects are unaffected by this operation:

  • exp.ms[ms_name].obsm[*]

  • exp.ms[ms_name].obsp[*]

If any affected sub-objects are a DenseNDArray (dense TileDB array), the entire operation results in an error.

Either coords or value_filter must be provided. When both coords and value_filter are provided, the variables that match both constraints will be removed.

For example, to delete observations where feature_biotype == 'gene':
>>> with tiledbsoma.Experiment.open(experiment_uri, mode="d") as exp:
...     exp.var_axis_delete(value_filter="feature_biotype == 'gene'")

Note: Deleting variables does not change the size of the current domain or possible enumeration values.

Parameters:
  • coords – A per-dimension Sequence of scalar, slice, sequence of scalar or Arrow IntegerArray <https://arrow.apache.org/docs/python/generated/pyarrow.IntegerArray.html> values defining the region to read.

  • value_filter – An optional [value filter] to apply to the results. Defaults to no filter.