smftools.preprocessing.binary_layers_to_ohe

smftools.preprocessing.binary_layers_to_ohe#

Functions

binary_layers_to_ohe(adata, binary_layers[, ...])

smftools.preprocessing.binary_layers_to_ohe.binary_layers_to_ohe(adata, binary_layers, stack='hstack')#
Parameters:
  • adata (AnnData) -- Anndata object.

  • binary_layers (list) -- a list of strings. Each string represents a layer in the adata object. The layer should encode a binary matrix.

  • stack (str) -- Dimension to stack the one-hot-encoding. Options include 'hstack' and 'vstack'. Default is 'hstack', since this is more efficient.

Returns:

A dictionary keyed by obs_name that points to a stacked (hstack or vstack) one-hot encoding of the binary layers

Return type:

ohe_dict (dict)

Input: An adata object and a list of layers containing a binary encoding.