smftools.preprocessing.binarize

Contents

smftools.preprocessing.binarize#

Functions

binarize_adata(adata[, source, ...])

Binarize a dense matrix and preserve NaNs.

smftools.preprocessing.binarize.binarize_adata(adata, source='X', target_layer='binary', threshold=0.8)#

Binarize a dense matrix and preserve NaNs.

Parameters:
  • adata (AnnData) -- AnnData object with input matrix or layer.

  • source (str (default: 'X')) -- "X" to use the main matrix or a layer name.

  • target_layer (str (default: 'binary')) -- Layer name to store the binarized values.

  • threshold (float (default: 0.8)) -- Threshold above which values are set to 1.

Return type:

None