Getting Start

Examples of PhyloVelo and steps are provided in Jupyter Notebook under notebooks folder. For start, please refer to records analyzing simulation, C.elegans and KPTracer datasets.

PhyloVelo on New Dataset

PhyloVelo provides an integrated function for phylogenetic velocity analysis by default whilst specific configurations might need to be adjusted accordingly.

1. import pacakge

import phylovelo as pv

2. import data, filter, normalize and dimensionality reduction

sd = pv.scData(count=xx, phylo_tree=xx)
sd.drop_duplicate_genes()
sd.normalize_filter(min_count=20)
sd.dimensionality_reduction(target='x_normed', method='umap')

3. Run model

depths = [tree.get_depth(sd.phylo_tree.find_any(name=i)) for i in sd.x_normed.index]
pv.velocity_inference(sd, depths, cutoff=0.95, target='x_normed')

4. Porject velocity into embedding and visualization

pv.velocity_embedding(sd, target='x_normed')
fig, ax = plt.subplots()
ax.scatter(sd.Xdr.iloc[:,0], sd.Xdr.iloc[:,1], c=depths, s=100, alpha=0.3)
ax = pv.velocity_plot(sd.Xdr.to_numpy(), sd.velocity_embeded, ax, 'stream', radius=0.8, lw_coef=100, arrowsize=2)

5. PhyloVelo pseudotime analysis

pv.calc_phylo_pseudotime(sd, n_neighbors=100, r_sample=0.8)
fig, ax = plt.subplots(figsize=(8,8))
scatter = ax.scatter(sd.Xdr.iloc[:,0],sd.Xdr.iloc[:,1], c=sd.phylo_pseudotime,cmap='plasma', s=60)
cbaxes = inset_axes(ax, width="3%", height="30%", loc='lower left')
plt.colorbar(scatter, cax=cbaxes, orientation='vertical')
[ ]: