Skip to content

Commit

Permalink
estimate onset until minimum of corAB
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisFaure committed Nov 13, 2023
1 parent 758947b commit cf63184
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions scFates/plot/onset_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def onset_stat(
nrows = 2 if plot_logref else 1
if ax is None:
fig, ax = plt.subplots(figsize=(5, 2 * nrows), nrows=nrows, sharex=plot_logref)
if plot_logref:
ax, ax2 = ax

if plot_logref:
ax, ax2 = ax
for i in range(n_map):
ax.plot(
df.loc[df.n_map == i, "t"],
Expand Down
14 changes: 8 additions & 6 deletions scFates/tools/onset_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
from ..get import modules as get_modules


def onset_stat(
adata: AnnData, root_milestone, milestones, pseudotime_offset=0, n_map=None
):
def onset_stat(adata: AnnData, root_milestone, milestones, n_map=None):
"""\
Estimate the onset of biasing over probabilistic mappings. Simply inter-module correlation progression is
taken in reverse starting from the bifurcation point, onset pseudotime is considered once the inter-module
Expand All @@ -35,8 +33,6 @@ def onset_stat(
tip defining progenitor branch.
milestones
tips defining the progenies branches.
pseudotime_offset
pseudotime offest.
n_map
number of mappings to consider.
Expand Down Expand Up @@ -92,9 +88,15 @@ def onset_stat(
fork = np.array(img.vs["name"], dtype=int)[fork]

fork_t = adata.uns["graph"]["pp_info"].loc[fork, "time"].max()
fork_t = fork_t - pseudotime_offset
df = df.loc[df.t < fork_t]

dfns = []
for n in range(n_map):
dfn = df.loc[df.n_map == n]
dfn = dfn.loc[dfn.t < dfn.loc[dfn.corAB.idxmin(), "t"]]
dfns.append(dfn)
df = pd.concat(dfns)

onsets = []
dfs = []
for n in range(n_map):
Expand Down

0 comments on commit cf63184

Please sign in to comment.