-
Notifications
You must be signed in to change notification settings - Fork 4
/
guo2010.py
65 lines (33 loc) · 1.08 KB
/
guo2010.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# coding: utf-8
# In[1]:
import numpy as np
import scipy as sp
import pandas as pd
import sys
import matplotlib.pyplot as plt
plt.style.use(["seaborn-darkgrid", "seaborn-colorblind", "seaborn-notebook"])
# In[2]:
raw_df = pd.read_csv("./guo2010Data.txt", header='infer', index_col=0, sep="\t", encoding=sys.getfilesystemencoding())
raw_df = raw_df.transpose()
time_stages = raw_df['Stage'].astype('int')
raw_df = raw_df.drop('Stage',1)
cell_names = raw_df.index.values
gene_names = raw_df.columns.values
raw_df.shape
# In[3]:
from DTFLOW import *
# In[4]:
z = DTFLOW(raw_df,time_stages)
M= z.get_transition_matrix(10)
S = z.get_diffusionRWR(p=0.9)
Y = z.get_Y(slover='svd',dim=2)
# In[5]:
z.plotY(size=(10,10),dims=[0,1],color ='stages')
# In[6]:
root_list = list(np.where(time_stages.values == 1)[0])
dftimes = z.get_dtflow_times(root_list)
np.savetxt("guo2010_dtflow_times.csv",dftimes,delimiter=',')
z.plotY(size=(10,10),dims=[0,1],color ='dftime')
# In[7]:
branch = z.get_branches(Num=112,delta = 0.9) # 1-11 12-112
z.plotY(size=(10,10),dims= [0,1],color ='branches')