Closed zhenzuo2 closed 3 years ago
Fixed. 'Clusters' must be a string categorical variable instead of numeric ones.
Thanks for spotting this, it occurs when we associate the names in adata.obs['seurat_clusters']
with macrostate names.
Though I haven't been able to reproduce it with the code below, at least the final dtype should be all strings and be fixed in #750
import cellrank as cr
import numpy as np
adata = cr.datasets.pancreas_preprocessed()
k = cr.tl.transition_matrix(adata)
g = cr.tl.estimators.GPCCA(k)
g.compute_schur()
g.compute_macrostates()
adata.obs['cls_float'] = adata.obs['clusters'].cat.rename_categories(
dict(zip(['Ngn3 low EP', 'Ngn3 high EP', 'Fev+', 'Beta', 'Alpha', 'Delta', 'Epsilon'],
np.array(list(range(7)), dtype=float))))
g.compute_macrostates(n_states=7, cluster_key='cls_float')
More thorough look/refactoring will be done in #745
closed via #750
g.compute_macrostates(n_states=7, cluster_key="seurat_clusters")
Computing
7
macrostates /storage/singlecell/zz4/miniconda3/envs/mypython/lib/python3.8/site-packages/anndata/_core/anndata.py:120: ImplicitModificationWarning: Transforming to str index. warnings.warn("Transforming to str index.", ImplicitModificationWarning) /storage/singlecell/zz4/miniconda3/envs/mypython/lib/python3.8/site-packages/anndata/_core/anndata.py:120: ImplicitModificationWarning: Transforming to str index. warnings.warn("Transforming to str index.", ImplicitModificationWarning)