campa.tl.add_clustering_to_adata

add_clustering_to_adata(data_dir, cluster_name, adata, annotation, added_name=None, annotation_col=None)[source]

Add clustering to adata.

Adds cluster_name to adata.obs[added_name] and colour values for each cluster stored in the annotation dict. Assumes that adata has the same dimensionality as the clustering.

Parameters
  • data_dir (str) – Full path to directory containing {cluster_name}.npy.

  • cluster_name (str) – Column in annotation containing current clustering values.

  • adata (AnnData) – Adata to which to add the clustering to.

  • annotation (DataFrame) – Annotation table containing mapping from clustering values to annotated values.

  • added_name (Optional[str]) – Name to use for clustering in adata. Defaults to annotation_col

  • annotation_col (Optional[str]) – Columns in annotation containing desired annotation. Defaults to cluster_name.

Return type

Nothing, adds clustering to adata.obs[added_name].