celldancer.to_dynamo

celldancer.to_dynamo(cellDancer_df)

Convert the output dataframe of cellDancer to the input of dynamo. The output of this function can be directly used in the downstream analyses of dynamo.

Example usage:

import dynamo as dyn
import numpy as np
import pandas as pd
import anndata as ann
import matplotlib.pyplot as plt
import celldancer as cd
import celldancer.utilities as cdutil

# load the prediction result of all genes, the data could be achieved from section 'Deciphering gene regulation through vector fields analysis in pancreatic endocrinogenesis'
cellDancer_df=pd.read_csv('HgForebrainGlut_cellDancer_estimation_spliced.csv')
cellDancer_df=cd.compute_cell_velocity(cellDancer_df=cellDancer_df, projection_neighbor_choice='embedding', expression_scale='power10', projection_neighbor_size=100) # compute cell velocity

# transform celldancer dataframe to anndata
adata_from_dancer = cdutil.to_dynamo(cellDancer_df)

# plot the velocity vector
dyn.pl.streamline_plot(adata_from_dancer, color=["clusters"], basis = "cdr", show_legend="on data", show_arrowed_spines=True)
dynamo_plt
Parameters

cellDancer_df (pandas.DataFrame) –

The output dataframe of cellDancer.

cellDancer –> dynamo

cellDancer_df.splice –> adata.X

cellDancer_df.loss –> adata.var.loss

cellDancer_df.cellID –> adata.obs

cellDancer_df.clusters –> adata.obs.clusters

cellDancer_df.splice –> adata.layers[‘X_spliced’]

cellDancer_df.splice –> adata.layers[‘M_s’]

cellDancer_df.unsplice –> adata.layers[‘X_unspliced’]

cellDancer_df.unsplice –> adata.layers[‘M_u’]

cellDancer_df.alpha –> adata.layers[‘alpha’]

cellDancer_df.beta –> adata.layers[‘beta’]

cellDancer_df.gamma –> adata.layers[‘gamma’]

cellDancer_df.unsplice_predict - cellDancer_df.unsplice –> adata.layers[‘velocity_U’]

cellDancer_df.splice_predict - cellDancer_df.splice –> adata.layers[‘velocity_S’]

cellDancer_df[[‘embeddding1’, ‘embedding2’]] –> adata.obsm[‘X_cdr’]

cellDancer_df[[‘velocity1’, ‘velocity2’]] –> adata.obsm[‘velocity_cdr’]

Return type

adata