phylovelo.pseudo_time

Module Contents

Functions

get_nearest_neighbor(data, target[, n_neighbors])

Get nearest neighbors of the target

time_interval(pt1, pt2, v1, v2)

Given two points' coordinate and velocity, calculate the time interval

graph_dict(pts, v[, n_neighbors])

Build graph to construct MST

prim(graph, root)

Prim algorithm to build MST from graph

calc_phylo_pseudotime(sd[, n_neighbors, r_sample])

Calculate the phyloVelo pseudotime

get_nearest_neighbor(data: numpy.ndarray, target: int, n_neighbors: int = 10)

Get nearest neighbors of the target

Args:
data:

Data to train knn

target:

Target point to get nearest neighbors

n_neighbors:

How many nearest neighbors to return

Returns:
list:

Euclidean distance from target to neighbors

list:

Neighbors’ indices

time_interval(pt1: numpy.ndarry, pt2: numpy.ndarry, v1: numpy.ndarry, v2: numpy.ndarry)

Given two points’ coordinate and velocity, calculate the time interval

Args:
pt1:

Coordinate of one point

pt2:

Coordinate of the other point

v1:

Velocity of one point

v2:

Velocity of the other point

Return:
float:

Time interval

graph_dict(pts: numpy.ndarry, v: numpy.ndarry, n_neighbors: int = 30)

Build graph to construct MST

Args:
pts:

All cells’ coordinate in embedding

v:

Phylo velocity

n_neighbors:

N nearest neighbors to build MST

Return:
dict:

Graph to build MSt

prim(graph, root)

Prim algorithm to build MST from graph

calc_phylo_pseudotime(sd: scData, n_neighbors: int = 30, r_sample: float = 1)

Calculate the phyloVelo pseudotime

Args:
sd:

sc data

n_neighbors:

N nearest neighbors to build MST. The smaller the number, the faster the calculation, but there is a chance of error

r_sample:

[0-1], random sample a subset calculate pseudotime.

Return:

scData.phylo_pseudotime