spac.data_utils.select_values(data, annotation, values=None, exclude_values=None)[source]

Selects values from either a pandas DataFrame or an AnnData object based on the annotation and values.

Parameters:
  • data (pandas.DataFrame or anndata.AnnData) – The input data. Can be a DataFrame for tabular data or an AnnData object.

  • annotation (str) – The column name in a DataFrame or the annotation key in an AnnData object to be used for selection.

  • values (str or list of str) – List of values for the annotation to include. If None, all values are considered for selection.

  • exclude_values (str or list of str) – List of values for the annotation to exclude. Can’t be combined with values.

Returns:

The filtered DataFrame or AnnData object containing only the selected rows based on the annotation and values.

Return type:

pandas.DataFrame or anndata.AnnData