|
@@ -43,7 +43,7 @@ class Conformations:
|
43
|
43
|
|
44
|
44
|
return squareform(pdist(dfnum, metric ='jaccard'))
|
45
|
45
|
|
46
|
|
- def dissimilarity(self, matrix):
|
|
46
|
+ def dissimilarity(self, matrix=None):
|
47
|
47
|
"""
|
48
|
48
|
Returns a matrix of the distance between all conformations computed
|
49
|
49
|
according to a substitution matrix of the protein blocks.
|
|
@@ -54,13 +54,24 @@ class Conformations:
|
54
|
54
|
if matrix == None:
|
55
|
55
|
matrix = pd.read_table("data/PBs_substitution_matrix.dat",
|
56
|
56
|
index_col=False, sep ='\t')
|
|
57
|
+ matrix = matrix/100 # because in this file weight where multiplied
|
|
58
|
+ # by 100.
|
57
|
59
|
matrix.index = matrix.columns
|
58
|
|
-
|
|
60
|
+ ncol = self.df.shape[1]
|
|
61
|
+ nrow = self.df.shape[0]
|
|
62
|
+ it1 = self.df.iterrows()
|
|
63
|
+ for i in range(1,nrow):
|
|
64
|
+ for j in range(i):
|
|
65
|
+ for k in range(ncol):
|
|
66
|
+ dissimilarity[i][j] += matrix[confs.df.loc[i,k]][confs.df.loc[j,k]]
|
|
67
|
+ dissimilarity = dissimilarity + dissimilarity.T
|
|
68
|
+
|
|
69
|
+ return dissimilarity
|
|
70
|
+
|
59
|
71
|
|
60
|
72
|
if __name__ == "__main__":
|
61
|
73
|
if len(sys.argv) != 2:
|
62
|
|
- print("Error : usage $ python3 projet8 md.pdb")
|
63
|
|
- exit()
|
|
74
|
+ sys.exit("Error : usage '$ python3 projet8 md.pdb'")
|
64
|
75
|
|
65
|
76
|
confs = Conformations(sys.argv[1])
|
66
|
77
|
|