ehrapy.preprocessing.offset_negative_values

ehrapy.preprocessing.offset_negative_values(adata, layer=None, copy=False)[source]

Offsets negative values into positive ones with the lowest negative value becoming 0.

This is primarily used to enable the usage of functions such as log_norm that do not allow negative values for mathematical or technical reasons.

Parameters:
  • adata (AnnData) – AnnData object containing X to normalize values in.

  • layer (str) – The layer to offset.

  • copy (bool) – Whether to return a modified copy of the AnnData object.

Return type:

AnnData

Returns:

Copy of AnnData object if copy is True.