spared.layer_operations.log1p_transformation

spared.layer_operations.log1p_transformation(adata: AnnData, from_layer: str, to_layer: str) AnnData[source]

Perform \(\log_2(x+1)\) transformation

Performs logarithmic transformation over adata.layers[from_layer]. Simple wrapper of scanpy’s sc.pp.log1p() (base 2) to transform data from adata.layers[from_layer] and save it into adata.layers[to_layer].

Parameters:
  • adata (ad.AnnData) – The AnnData object to transform.

  • from_layer (str) – The layer to take the data from.

  • to_layer (str) – The layer to store the results of the transformation.

Returns:

The updated AnnData object with transformed data in adata.layers[to_layer].

Return type:

ad.AnnData