annotate_cells_clustering¶
- besca.tl.annotate_cells_clustering(adata, new_cluster_labels, new_annotation_label='celltype', clustering_label='leiden')[source]¶
Function to add annotation to adata.obs based on clustering This function replaces the original cluster labels located in the column clustering_label with the new values specified in the list new_cluster_lables. The values in this list need to be in the same lexicographic order as the cluster values. The order of this can be checked by running ` sorted(adata.obs.get(clustering_label).unique(), key=int)` or ` sorted(adata.obs.get(clustering_label).unique(), key=str)`
- Parameters:
adata (AnnData) – the AnnData object that is supposed to recieve a new annotation
new_cluster_labels (list) – a list in correct lexicographic order of the new cluster labels
new_annotation_label (str | default = ‘celltype’) – string identifying the name underwhich the new cluster labels should be added to adata.obs
clustering_label (str | default = ‘louvain’) – string identifying the name underwhich the old cluster labels can be found in adata.obs
- Returns:
The adata.obs has been updated with a new column containing the new annotation
- Return type:
AnnData