cellflow.preprocessing.transfer_labels¶
- cellflow.preprocessing.transfer_labels(query_adata, ref_adata, label_key, wknn_key='wknn', copy=False)[source]¶
Transfer labels from the reference to the query dataset.
- Parameters:
query_adata (
AnnData) – AnAnnDataobject with the query dataref_adata (
AnnData) – AnAnnDataobject with the reference datalabel_key (str) – Key in
obsofref_adatacontaining the labelswknn_key (str) – Key in
unsofref_adatacontaining the weighted k-nearest neighbors graphcopy (bool) – Return a copy of
query_adatainstead of updating it in place
- Return type:
AnnData|None- Returns:
: If
copyisTrue, returns a newAnnDataobject with the transferred labels stored inobs. Otherwise, updatesadatain place.Sets the following fields:
.obs[f"{label_key}_transfer"]: Transferred labels.obs[f"{label_key}_transfer_score"]: Confidence scores for the transferred labels