File "", line 1, in
File "/opt/conda/lib/python3.10/site-packages/cellrank/kernels/_utils.py", line 184, in require_tmat
return wrapped(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/cellrank/kernels/_base_kernel.py", line 151, in plot_single_flow
fp = fp.prepare(cluster, clusters, time_points)
File "/opt/conda/lib/python3.10/site-packages/cellrank/kernels/utils/_tmat_flow.py", line 140, in prepare
self._flow = self.compute_flow(time_points, cluster)
File "/opt/conda/lib/python3.10/site-packages/cellrank/kernels/utils/_tmat_flow.py", line 197, in compute_flow
flow = callback(t1, t2)
File "/opt/conda/lib/python3.10/site-packages/cellrank/kernels/utils/_tmat_flow.py", line 181, in cluster_helper
df = pd.DataFrame(subset.A if sp.issparse(subset) else subset).sum(0)
AttributeError: 'csr_matrix' object has no attribute 'A'
Dear Developer of Cellrank2, After building a WOT model from adata, I was trying to run plot_single_flow for a cluster and below is the code I used:
rtk = cr.kernels.RealTimeKernel.from_wot(adata, path="tmaps/", time_key="days")
rtk = rtk.compute_transition_matrix()
rtk.plot_single_flow(cluster = "0", cluster_key = "leiden_res1", time_key = "days", min_flow = 0.15, remove_empty_clusters = True, ascending = False, save = "probmassflow_wot_cluster0.tiff", time_points = [0,7])
It returns an error message of
Versions: python==3.10 scanpy==1.10.2 cellrank==2.0.5 anndata==0.10.9 numpy==1.26.4 pandas==2.2.2