mmc.batch_iterator()

mmochi.utils.batch_iterator(adata, batch_key, sort=True)

Generates a series of masks, for each different batch in batch_key and its corresponding batch name

Parameters:
  • adata (AnnData) –

  • batch_key (str) – Column within the adata.obs that delineates batches

  • sort (bool (default: True)) – Whether to sort the batch names according to the sorted() function

Return type:

Tuple[List[List[bool]], List[str]]

Returns:

  • batch_masks – Boolean masks for each of the batches in batch_key

  • batches – The names of the batches in the batch_key column of adata.obs