cellflow.preprocessing.encode_onehot¶
- cellflow.preprocessing.encode_onehot(adata, covariate_keys, uns_key_added, exclude_values=None, copy=False)[source]¶
Encodes covariates
obsas one-hot vectors and stores them inuns.- Parameters:
adata (
AnnData) – AnAnnDataobject.covariate_keys (
str|Sequence[str]) – Key(s) inobscontaining the covariate(s) to encode.uns_key_added (
str) – Key inunsto store the one-hot encodings.exclude_values (
str|Sequence[Any]) – Value(s) to exclude from the one-hot encoding.copy (
bool) – Return a copy ofadatainstead of updating it in place.
- Return type:
None|AnnData- Returns:
: If
copyisTrue, returns a newAnnDataobject with the one-hot encodings stored inuns. Otherwise, updatesadatain place.Sets the following fields:
.uns[uns_key_added]: Dictionary containing the one-hot encodings for each covariate.