scPhyloX.estimation

Submodules

Classes

LogLike

LogLike

LogLike

Functions

cellnumber(t, xx, r, a, b, k, t0, p, r1, b1)

ODE of cell number changes over time

cellnumber_nc(t, x, r, a)

Neutral cell number calculator

nc_sol(t, c0, k, r, a)

Analytical solution of neutral cell number

cellnumber_ac(t, x, c0, r, a, s, u)

Neutral cell number calculator

p_xi(gen, T, c0, ax, bx, r, k, t0, r1, b1)

Probability density function of LR distance

my_loglike(theta, data, args)

Likelihood of lr-dist

para_inference_DE(data[, T, c0, sigma, n_iter, ...])

Mutation rate estimation using DE

mcmc_inference(data, para_prior, T, c0, sigma[, draw, ...])

Mutation rate estimation using DE-MCMC

bt(t, a, b, k, t0)

Stem cell growth rate eta(t)

cellnumber(t, xx, r, a, b, k, t0, p, r1, b1)

ODE of cell number changes over time

ncyc(i, t, c0, ax, bx, r, d, k, t0)

Stem cell number calculator

nnc(i, t, c0, ax, bx, r, d, k, t0)

non-stem cell number calculator

p_xi(gen, T, c0, ax, bx, r, k, t0, r1, b1)

Probability density function of LR distance

my_loglike(theta, data, args)

Likelihood of lr-dist

para_inference_DE(data[, T, c0, sigma, n_iter, ...])

Mutation rate estimation using DE

mcmc_inference(data, para_prior, T, c0, sigma[, draw, ...])

Mutation rate estimation using DE-MCMC

cellnumber(t, xx, r, a, b, k, t0, p, r1, b1)

ODE of cell number changes over time

stem_num(i, t, c0, ax, bx, r, k, t0, r1, b1)

Stem cell number calculator

nstem_num(t, x, c0, ax, bx, r, k, t0, r1, b1)

p_xi(gen, T, c0, ax, bx, r, k, t0, r1, b1)

Probability density function of LR distance

my_loglike(theta, data, args)

Likelihood of lr-dist

para_inference_DE(data[, T, c0, sigma, n_iter, ...])

Mutation rate estimation using DE

mcmc_inference(data, para_prior, T, c0, sigma[, draw, ...])

Mutation rate estimation using DE-MCMC

Package Contents

cellnumber(t, xx, r, a, s, u)

ODE of cell number changes over time

Args:
t:

time

xx:

[n_stemcell, n_nonstemcell]

cellnumber_nc(t, x, r, a)

Neutral cell number calculator

Args:
t:

time

x:

neutral cell number

r, a:

parameters

return:
np.array:

neutral cell number at time t.

nc_sol(t, c0, k, r, a)

Analytical solution of neutral cell number

Args:
t:

time

c0:

initial neutral cell number

k:

generation

r, a:

parameters

return:
float:

neutral cell number in generation k at time t.

cellnumber_ac(t, x, c0, r, a, s, u)

Neutral cell number calculator

Args:
t:

time

x:

advantageous cell number

c0:

initial ac number

r, a, s, u:

parameters

return:
np.array:

advantageous cell number at time t.

p_xi(gen, T, x0, r, a, s, u)

Probability density function of LR distance Args:

gen:

generation

T:

time

x0:

initial cell number

r, a, s, u:

parameters

Return:
np.array:

Probability density of LR distance at time T.

my_loglike(theta, data, args)

Likelihood of lr-dist

Args:
theta:

parameters, (r, a, s, u)

data:

Observed lr dist

args:

paramteres, (time, initial_cell_number, prior_sigma)

Return:
float:

Sum of log-likelihood of given lr dist parameters

para_inference_DE(data, T=20, c0=None, sigma=1, n_iter=100, bootstrape=0, verbose='text')

Mutation rate estimation using DE

Args:
data:

lp-dist

n_iter:

Iterations of de estimation

bootstrape:

Weather using bootstrape to accuratly estimate mutation rate, 0 to turn off.

Return:
tuple:

(accepted parameters, loss, de-estimator)

class LogLike(loglike, data, args)

Bases: pytensor.tensor.Op

itypes
otypes
likelihood
data
args
perform(node, inputs, outputs)
mcmc_inference(data, para_prior, T, c0, sigma, draw=1000, tune=1000, chains=5)

Mutation rate estimation using DE-MCMC

Args:
data:

Observed lp-dist

data_prior:

mean of prior distributions of all parameters

T:

time of phylodynamics eqns

c0:

initial cell numbers

sigma:

variation of loss function

draw:

Number of smaples to draw

tune:

Number of iterations to tune

chain:

number of chains to sample

bt(t: float, a: float, b: float, k: float, t0: float)

Stem cell growth rate eta(t)

Args:
t:

time

a,b,k,t0:

parameters

cellnumber(t, xx, a, b, k, t0, p, r, d)

ODE of cell number changes over time

Args:
t:

time

xx:

[n_stemcell, n_nonstemcell]

ncyc(i, t, c0, ax, bx, r, d, k, t0)

Stem cell number calculator

Args:
i:

generation

t:

time

c0:

initial cell number

ax,bx,r,d,k,t0:

parameters

return:
float:

Stem cell number in generation i at time t.

nnc(i, t, c0, ax, bx, r, d, k, t0)

non-stem cell number calculator

Args:
i:

generation

t:

time

c0:

initial cell number

ax,bx,r,d,k,t0:

parameters

Return:
float:

non-stem cell number in generation i at time t.

p_xi(n_gen, T, c0, ax, bx, r, d, k, t0)

Probability density function of LR distance Args:

n_gen:

generation

T:

time

c0:

initial cell number

ax, bx, r, d, k, t0:

parameters

Return:
np.array:

Probability density of LR distance at time T.

my_loglike(theta, data, args)

Likelihood of lr-dist

Args:
theta:

parameters, (ax, bx, r, d, k ,t0)

data:

Observed lr dist

args:

paramteres, (time, initial_cell_number, prior_sigma)

Return:
float:

Sum of log-likelihood of given lr dist parameters

para_inference_DE(data, T=20, c0=None, sigma=1, n_iter=100, bootstrape=0, verbose='text')

Mutation rate estimation using DE

Args:
data:

lp-dist

n_iter:

Iterations of de estimation

bootstrape:

Weather using bootstrape to accuratly estimate mutation rate, 0 to turn off.

Return:
tuple:

(accepted parameters, loss, de-estimator)

class LogLike(loglike, data, args)

Bases: pytensor.tensor.Op

itypes
otypes
likelihood
data
args
perform(node, inputs, outputs)
mcmc_inference(data, para_prior, T, c0, sigma, draw=1000, tune=1000, chains=8)

Mutation rate estimation using DE-MCMC

Args:
data:

Observed lp-dist

data_prior:

mean of prior distributions of all parameters

T:

time of phylodynamics eqns

c0:

initial cell numbers

sigma:

variation of loss function

draw:

Number of smaples to draw

tune:

Number of iterations to tune

chain:

number of chains to sample

cellnumber(t, xx, r, a, b, k, t0, p, r1, b1)

ODE of cell number changes over time

Args:
t:

time

xx:

[n_stemcell, n_nonstemcell]

stem_num(i, t, c0, ax, bx, r, k, t0, r1, b1)

Stem cell number calculator

Args:
i:

generation

t:

time

c0:

initial cell number

ax,bx,r,d,k,t0:

parameters

return:
float:

Stem cell number in generation i at time t.

nstem_num(t, x, c0, ax, bx, r, k, t0, r1, b1)
p_xi(gen, T, c0, ax, bx, r, k, t0, r1, b1)

Probability density function of LR distance Args:

n_gen:

generation

T:

time

c0:

initial cell number

ax, bx, r, k, t0, r1, b1:

parameters

Return:
np.array:

Probability density of LR distance at time T.

my_loglike(theta, data, args)

Likelihood of lr-dist

Args:
theta:

parameters, (ax, bx, r, k, t0, r1, b1)

data:

Observed lr dist

args:

paramteres, (time, initial_cell_number, prior_sigma)

Return:
float:

Sum of log-likelihood of given lr dist parameters

para_inference_DE(data, T=20, c0=None, sigma=1, n_iter=100, bootstrape=0, verbose='text')

Mutation rate estimation using DE

Args:
data:

lp-dist

n_iter:

Iterations of de estimation

bootstrape:

Weather using bootstrape to accuratly estimate mutation rate, 0 to turn off.

Return:
tuple:

(accepted parameters, loss, de-estimator)

class LogLike(loglike, data, args)

Bases: pytensor.tensor.Op

itypes
otypes
likelihood
data
args
perform(node, inputs, outputs)
mcmc_inference(data, para_prior, T, c0, sigma, draw=1000, tune=1000, chains=9, est_bx=False)

Mutation rate estimation using DE-MCMC

Args:
data:

Observed lp-dist

data_prior:

mean of prior distributions of all parameters

T:

time of phylodynamics eqns

c0:

initial cell numbers

sigma:

variation of loss function

draw:

Number of smaples to draw

tune:

Number of iterations to tune

chain:

number of chains to sample