alphapepttools.pp.impute_gaussian#
- alphapepttools.pp.impute_gaussian(adata, std_offset=3, std_factor=0.3, random_state=42, layer=None, *, copy=False)#
Impute missing values in each column by random sampling from a gaussian distribution.
The distribution is centered at std_offset * feature standard deviation below the feature mean and has a standard deviation of std_factor * feature standard deviation. The function returns a copy of the AnnData object with imputed values in place of NaNs.
- Parameters:
adata (anndata.AnnData) – AnnData object containing the data to be imputed.
std_offset (float) – Number of standard deviations below the mean to center the gaussian distribution.
std_factor (float) – Factor to multiply the feature’s standard deviation with to get the standard deviation of the gaussian distribution.
layer (
Optional[str] (default:None)) – Name of the layer to impute. 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 AnnData object with imputed values in layer. If
copy=Falsemodifies the anndata object at layer inplace and returns None. Ifcopy=True, returns a modified copy.