-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
executable file
·44 lines (31 loc) · 1.18 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
#!/usr/local/bin/python
import dynclipy
task = dynclipy.main()
import pandas as pd
import numpy as np
import json
from pymatcher import matcher
import time
checkpoints = {}
# ____________________________________________________________________________
# Load data ####
expression = task["expression"]
parameters = task["parameters"]
# ____________________________________________________________________________
# Infer trajectory ####
m = matcher.MATCHER([expression.values])
m.infer(quantiles = parameters["quantiles"], method = parameters["method"])
checkpoints["method_aftermethod"] = time.time()
# ____________________________________________________________________________
# Save output ####
dataset = dynclipy.wrap_data(cell_ids = expression.index)
# pseudotime
pseudotime = pd.DataFrame({
"cell_id":expression.index,
"pseudotime":m.master_time[0][:, 0]
})
dataset.add_linear_trajectory(pseudotime = pseudotime)
# timings
dataset.add_timings(checkpoints)
# save
dataset.write_output(task["output"])