spac.utils.check_feature(adata, features=None, should_exist=True)[source]

Perform common error checks for features in anndata related objects.

Parameters:
  • adata (anndata.AnnData) – The AnnData object to be checked.

  • features (str or list of str, optional) – The feature(s) to check for existence in adata.var_names.

  • should_exist (bool, optional (default=True)) – Determines whether to check if elements exist in the target list (True), or if they should not exist (False).

Raises:
  • TypeError – If adata is not an instance of anndata.AnnData.

  • ValueError – If any of the specified layers, annotations, or features do not exist.