-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
executable file
·48 lines (34 loc) · 1.26 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/bin/python
import dynclipy
task = dynclipy.main()
# task = dynclipy.main(
# ["--dataset", "/code/example.h5", "--output", "/mnt/output"],
# "/code/definition.yml"
# )
import pandas as pd
from ouijaflow import ouija
import time
checkpoints = {}
# ____________________________________________________________________________
# Load data ####
expression = task["expression"]
p = task["parameters"]
checkpoints["method_afterpreproc"] = time.time()
# ____________________________________________________________________________
# Create trajectory ####
oui = ouija()
oui.fit(expression.values, n_iter=int(p["iter"]))
z = oui.trajectory()
checkpoints["method_aftermethod"] = time.time()
# ____________________________________________________________________________
# Process output & save ####
dataset = dynclipy.wrap_data(cell_ids = expression.index)
# pseudotime
pseudotime = pd.DataFrame({
"pseudotime": z,
"cell_id": expression.index
})
dataset.add_linear_trajectory(pseudotime = pseudotime)
# timings
dataset.add_timings(timings = checkpoints)
dataset.write_output(task["output"])