Thanks for the development of Scanpy. Here, I wonder how to plot a force-directed graph with stem-cells in the middle of the figure.
I find that there is a parameter “root” in function “sc.tl.draw_graph()”. Hence, I set it as following. However, the figure I got did not change with or without the “root” parameter. Could you please guide me to plot a force-directed graph with stem-cells in the middle of the figure and differentiated cells surrounding the stem-cells.
Code:
fPCA=30
fNEIGHBOR=30
sc.tl.pca(adata,n_comps=fPCA)
sc.pp.neighbors(adata, n_neighbors=fNEIGHBOR, n_pcs=fPCA)
adata.obs[‘celltype2_cat’] = adata.obs[‘celltype2’].astype(‘category’).values
adata.uns[‘iroot’] = np.flatnonzero(adata.obs[‘celltype2_cat’].isin([‘IPC1’,‘IPC2’]))[0]
sc.tl.draw_graph(adata, layout = ‘fa’, root=‘iroot’)
sc.pl.draw_graph(adata, color=‘celltype2_cat’, legend_loc=‘on data’, show=False,
save=str(str(fPCA) + “_” + str(fNEIGHBOR) + “_celltype2_cat_iroot.pdf”))
the plot I got: