x, y = scv.utils.get_cell_transitions(adata, basis='PHATE_seurat', starting_cell=1000) ax = scv.pl.velocity_graph(adata, c='lightgrey', edge_width=.05, show=False, basis="PHATE_seurat") ax = scv.pl.scatter(adata, x=x, y=y, s=120, c='ascending', cmap='gnuplot', ax=ax, basis='PHATE_seurat') adata.uns['neighbors']['distances'] = adata.obsp['distances'] adata.uns['neighbors']['connectivities'] = adata.obsp['connectivities'] scv.tl.paga(adata, groups='seurat_clusters') df = scv.get_df(adata, 'paga/transitions_confidence', precision=2).T df.style.background_gradient(cmap='Blues').format('{:.2g}') scv.pl.paga(adata, basis='umap_seurat', size=50, alpha=.1, min_edge_width=2, node_size_scale=1.5, dpi=800)
def export_text_data(velocity_data, args): driver_genes = scvelo.get_df(velocity_data, "rank_dynamical_genes/names") driver_genes.to_csv(args.output + "putative_driver_genes.tsv", sep="\t")
scv.pl.velocity_embedding_stream(adata, basis="umap", color='latent_time', dpi=800, color_map='gnuplot') scv.pl.velocity_embedding_stream(adata, basis="umap", color='root_cells', dpi=300, min_mass=0, density=1, color_map='gnuplot') scv.tl.paga(adata, groups='velocity_clusters') df = scv.get_df(adata, 'paga/transitions_confidence', precision=2).T df.style.background_gradient(cmap='Blues').format('{:.2g}') scv.pl.paga(adata, basis='umap', size=50, alpha=.1, min_edge_width=2, node_size_scale=1.5, dpi=800) scv.pl.velocity(adata, "Msn", dpi=800) scv.tl.rank_velocity_genes(adata, min_corr=.3) df = scv.DataFrame(adata.uns['rank_velocity_genes']['names']) df.head()
dpi=300, figsize=(10, 10), color=clusters, save='{}.png'.format(key), title=key) ## Top drivers. top_genes = samples['HT29_EV'].var['fit_likelihood'].sort_values( ascending=False).index scv.pl.scatter(samples['HT29_EV'], basis=top_genes[:15], ncols=5, frameon=False) ## Top likelyhood genes. outdir = 'results/trajectory/velocity_dynamical/velocity_genes_dynamical' if not os.path.exists(outdir): os.makedirs(outdir) scv.settings.figdir = outdir for key, value in samples.items(): scv.tl.rank_dynamical_genes(value, groupby=clusters) df = scv.get_df(value, 'rank_dynamical_genes/names') df.to_csv("{}/{}.tsv".format(outdir, key), sep='\t', header=True, index=False)