smftools.preprocessing.invert_adata

Contents

smftools.preprocessing.invert_adata#

smftools.preprocessing.invert_adata(adata, uns_flag='invert_adata_performed', force_redo=False)#

Invert the AnnData object along the column axis in-place.

Flips each layer and X one at a time to avoid materialising the full AnnData twice (which would peak at 2× total size).

Parameters:
  • adata (AnnData) -- AnnData object.

  • uns_flag (str (default: 'invert_adata_performed')) -- Flag in adata.uns indicating prior completion.

  • force_redo (bool (default: False)) -- Whether to rerun even if uns_flag is set.

Returns:

The same AnnData object with inverted column ordering.

Return type:

anndata.AnnData