-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript2.py
More file actions
38 lines (28 loc) · 813 Bytes
/
script2.py
File metadata and controls
38 lines (28 loc) · 813 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
#!/usr/bin/python2.6
# -*-coding:Latin-1 -*
from numpy import *
f = open('rattus.txt', 'r')
a = loadtxt(f, skiprows = 1, usecols = (0,1,2), dtype = int)
# List of unique proteins
b = loadtxt('prot_list', dtype= int)
# Number of proteins
n = len(b)
# Number of interactions
m = len(a)
# Adjacence matrix
c = loadtxt('adj_matrix')
eigval, eigvect = linalg.eig(c)
#First value is the biggest
ce = [0.0] * n
# Protein with the biggest cd
# First value is the maximum, and the second is the index
maxce = [0,-1]
for i in range(0, n):
ce[i] += eigvect[i,0]
if(ce[i] > maxce[0]):
maxce[1] = i
maxce[0] = ce[i]
print("La protéine avec la plus grande centralité par valeur propre est la protéine : ")
print(b[maxce[1]])
savetxt('ce_matrix', eigvect[:,0].real, delimiter=' ', fmt='%.5f')
# See linalg.eig