Why is only the upper percentile used when fitting an offest? #693
-
Hi, I have been running scVelo on the pancreas example data set, trying to understand the model details. I have noticed that it seems that the lower percentile is not used when calculating the steady-state velocity with the default parameters. Running the code below import scvelo as scv
import numpy as np
adata = scv.datasets.pancreas()
scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000)
scv.pp.moments(adata, n_neighbors=30)
p = [5, 10, 20]
result_all = []
type_all = []
for l in p:
result_p = []
type_p = []
for u in p:
r = scv.tl.velocity(adata, mode='deterministic', copy=True, perc = [l, 100 - u])
result_p.append(r.var["velocity_gamma"])
type_p.append([l, 100 - u])
result_all.append(result_p)
type_all.append(type_p)
for k in range(len(p)):
for i in range(len(p) - 1):
for j in range(i + 1, len(p)):
print(type_all[i][k], "vs", type_all[j][k], np.array_equal(result_all[i][k], result_all[j][k]))
print(type_all[k][i], "vs", type_all[k][j], np.array_equal(result_all[k][i], result_all[k][j])) results in the following
and it illustrates that gamma is the same regardless of the lower percentile.. Looking into the scVelo code, I saw that when fit_offset is set to False, which is the default value, only the upper percentile is used. Why is that? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@paula-tataru, the splicing process begins/ends in the origin. As such, we do not need to infer the lower percentile for the fit since it is know a priori. Only the upper quantile needs to be inferred. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the prompt answer Your article states "Steady states are expected at the lower and upper quantiles in phase space [...] hence, the ratio can be approximated by a linear regression on these extreme quantiles" under the "Steady-state model" methods section. Maybe clarifying this in the API might help other users :) |
Beta Was this translation helpful? Give feedback.
@paula-tataru, the splicing process begins/ends in the origin. As such, we do not need to infer the lower percentile for the fit since it is know a priori. Only the upper quantile needs to be inferred.