-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript4.py
More file actions
41 lines (31 loc) · 748 Bytes
/
script4.py
File metadata and controls
41 lines (31 loc) · 748 Bytes
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
#!/usr/bin/python2.6
# -*-coding:Latin-1 -*
from numpy import *
from pylab import *
# List of unique proteins
b = loadtxt('prot_list', dtype= int)
# Eig centrality
ce = loadtxt('ce_matrix', dtype= float)
# Deg centrality
cd = loadtxt('cd_matrix', dtype= float)
# Linear regression
(x,y) = polyfit(ce,cd,1)
print("cd = %f * ce + %f"%(x,y))
# Polyval evaluates the line equation at each point
yp = polyval([x,y],ce)
# Plot
plot(ce,yp)
scatter(ce, cd)
show()
# Delete biggest value
ce = delete(ce, ce.argmax(), 0)
cd = delete(cd, cd.argmax(), 0)
# Linear regression
(x,y) = polyfit(ce,cd,1)
print("cd = %f * ce + %f"%(x,y))
# Polyval evaluates the line equation at each point
yp = polyval([x,y],ce)
# Plot
plot(ce,yp)
scatter(ce, cd)
show()