besca.subset_adata

besca.subset_adata(adata, filter_criteria, raw=True, axis=0)[source]

Subset AnnData object into new object

Parameters:
  • adata (AnnData) – complete AnnData object

  • filter_criteria (bool serie) – filtering requirement along the axis chosen.

  • raw (bool | default = True) – boolian indicator if the subset should be initialized with the data contained in adata.raw or not

  • axis (0 or 1 | default = 0) – if 0 then then the filter criteria is applied as a selector for rows, if 1 then the filter criteria is applied as a selector for columns

Returns:

if raw = True the AnnData subset initialized with the adata.raw otherwise the AnnData subset initialized with adata

Return type:

AnnData

Examples

>>> import besca as bc
>>> adata = bc.datasets.simulated_pbmc3k_processed()
>>> adata_BCELL =  bc.subset_adata( adata, filter_criteria= adata.obs.get('dblabel') == 'naive B cell')