forked from yshin1209/Computational-Medicine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assignment - Two Different Dynamics
61 lines (50 loc) · 2.09 KB
/
Assignment - Two Different Dynamics
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
# Computational Medicine
# Assignment - Two Different Dynamics
# Yong-Jun Shin (2019)
import numpy as np
import matplotlib.pyplot as plt
N = 100 # Total number of data points
n = np.arange(0, N, 1) # [0,..., N-1] (vector)
x = np.empty(N) # Protein x concentration in uM (vector)
y1 = np.empty(N) # Protein y1 (control) concentration in uM (vector)
y2 = np.empty(N) # Protein y2 concentration in uM (vector)
y3 = np.empty(N) # Protein y3 concentration in uM (vector)
x.fill(10) # Constant x protein concentration (= 10 uM)
y1[0] = 0 # Initial y1 protein concentration (= 0 uM)
y2[0] = 0 # Initial y2 protein concentration (= 0 uM)
y3[0] = 0 # initial y3 protein concentration (= 0 uM)
Pxy1 = 0.4 # Production parameter Pxy1
Py1 = 0.9 # Degradation parameter Py1
Pxy2 = 0.8 # Production parameter Pxy2
Py2 = 0.2 # Degradation parameter Py2
# Increase Pxy (= more protein production)
# Only steady state level changes
for i in range (1, N): # discrete-time index i
y1[i] = Pxy1*x[i-1] + Py1*y1[i-1] # control
y2[i] = Pxy2*x[i-1] + Py1*y2[i-1] # target (change in Pxy)
# Decrease Py ( = more protein degradation)
# Both steady state level and response time change
for i in range (1, N): # discrete-time index i
y1[i] = Pxy1*x[i-1] + Py1*y1[i-1] # control
y3[i] = Pxy1*x[i-1] + Py2*y3[i-1] # target (change in Py)
# Pxy plot
plt.subplot(1,2,1)
plt.plot(n,x,'g',label = 'x')
plt.plot(n,y1,'r',label = 'y1')
plt.plot(n,y2,'b',label = 'y2')
plt.xlabel('time (n)')
plt.ylabel('protein concentration (uM)')
plt.legend(loc='upper left')
plt.title('Pxy increase: y1 --> y2 (more production)')
plt.grid(True)
# Py plot
plt.subplot(1,2,2)
plt.plot(n,x,'g',label = 'x')
plt.plot(n,y1,'r',label = 'y1')
plt.plot(n,y3,'c',label = 'y3')
plt.xlabel('time (n)')
plt.ylabel('protein concentration (uM)')
plt.legend(loc='upper left')
plt.title('Py decrease: y1 --> y3 (more degradation)')
plt.grid(True)
show()