tacco.utils.get_maximum_annotation¶
- get_maximum_annotation(adata, obsm_key, result_key=None)[source]¶
Turns a soft annotation into a categorical annotation by reporting the annotation categories with the maximum values per oberservation.
- Parameters:
adata – An
AnnData
with annotation in .obsm. Can also be aDataFrame
which is then used in place of .obsm[obsm_key].obsm_key – The .obsm key or array-like of .obs keys with the soft annotation. If adata is a
DataFrame
, this is ignored.result_key – The .obs key (or adata key if adata is a
DataFrame
) to write the categorical annotation to. If None, returns the categorical annotation asSeries
.
- Returns:
Depending on result_key returns either a
Series
containing the categorical annotation or the inpt adata with the split sample annotation written to adata.obs[result_key] (or adata[result_key] if adata is aDataFrame
).