alphapepttools.pp.nanlog#
- alphapepttools.pp.nanlog(data, base=2, verbosity=1, layer=None, *, copy=False)#
Logarithmize a data matrix.
Apply arbitrary base logarithm transformation to AnnData.X, replacing invalid values with np.nan. Similar to the underlying numpy log functions, invalid values are replaced with np.nan, but a more detailed summary of which values were replaced is provided.
Current invalid values include: - NaN values - Zero values - Negative values - Positive infinity - Negative infinity
- Parameters:
x (anndata.AnnData) – Input data; negatives and/or zeros are converted to np.nan
base (int) – Base of the logarithm. Defaults to 2 (log2).
verbosity (int, default 1) – If 1, log warnings for invalid values found in the data.
layer (
Optional[str] (default:None)) – Name of the layer to transform. If None (default), the data matrix X is used.copy (
bool(default:False)) – Whether to return a modified copy (True) of the anndata object. If False (default) modifies the object inplace
- Return type:
- Returns:
None | anndata.AnnData Log-transformed data with invalid values replaced by np.nan. If
copy=Falsemodifies the anndata object at layer inplace and returns None. Ifcopy=True, returns a modified copy.