spac.utils.check_table(adata, tables=None, should_exist=True, associated_table=False, warning=False)[source]

Perform common error checks for table (layers) or derived tables (obsm) in anndata related objects.

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

  • tables (str or list of str, optional) – The term “table” is equivalent to layer in anndata structure. The layer(s) to check for existence in adata.layers.keys().

  • 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).

  • associtated_table (bool, optional (default=False)) – Determines whether to check if the passed tables names should exist as layers or in obsm in the andata object.

  • warning (bool, optional (default=False)) – If True, generate a warning instead of raising an exception.

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

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

Warns:

UserWarning – If any of the specified layers, annotations, obsm, or features do not exist, and warning is True.