From 023617e576dbc99a7adb87043cf29627763dfc36 Mon Sep 17 00:00:00 2001 From: Nicolas Zimmermann Date: Wed, 18 Sep 2019 22:19:07 +0200 Subject: [PATCH] separated conformations module from projet8, added a figure --- results/identity_cluster.png | Bin 0 -> 10057 bytes results/md.csv | 502 ------------------- src/__pycache__/Conformations.cpython-37.pyc | Bin 0 -> 6556 bytes src/__pycache__/conformations.cpython-37.pyc | Bin 0 -> 6715 bytes src/conformations.py | 194 +++++++ src/projet8.py | 195 +------ 6 files changed, 199 insertions(+), 692 deletions(-) create mode 100644 results/identity_cluster.png delete mode 100644 results/md.csv create mode 100644 src/__pycache__/Conformations.cpython-37.pyc create mode 100644 src/__pycache__/conformations.cpython-37.pyc create mode 100644 src/conformations.py diff --git a/results/identity_cluster.png b/results/identity_cluster.png new file mode 100644 index 0000000000000000000000000000000000000000..b4855d05512d65c102e3f4b173788778d974b576 GIT binary patch literal 10057 zcmeHtXH-+^y8j02hz=qmD9yo9L=cRMAT7=aGBz>}(xgO*w4sLH!!!*wVd_D!l%flj`DZr)x;G%=bOjoq&P{yutI zTL1pNrnj$))>dcPod~iUIc@ya#o%O4FX>l{p$I;=(d25=8_fs#wG@l7%NLBdULX>8 zePev%ih`?t!fV~1id<{9J0H^3>om)}pjvP)dz-nMYy21459QAP`fT2`Snl%X%o%sp z2V11g)t^?JH4l(|s_`y$N;$Hsygc@41@BdaL+;%pA5#U%erdD6mrf;D$@yo4Efw{Amr&^*iDQtlOHJq`a%3jZ=nY>mp`Ypn+} zGcziU>k-{;o}Qi;?Cn!TMyV=de3|e$LjTN+uh>R}nRL6Kc4t_UCWdU=hrnUaUp$!K z6e|tp4!#-kB{rYeQ4H)MPz-mtqy$*bP4#0N40%1l9R*ZusJ=AS?{3>@X!wQF7!H*arBadEMkJn|y%iFcmrdvnX|OER`4Uh(Je zA5(1N4-XGN&B~f6%+1d~eDD7K3d1KkIhvEDtc2X7IAni}ou*1{jG;urw!Op+KD^1^ zJfDxR_+vQIt`z}qs;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7mLDhk9`i0|kzx4RL{rS5XvfM|@r1g&;aA&QtLXD&D4o`0FMv z{QmPUG;BRgxEc~~#uwh$brByXsgmoxIneaUsN@n(sM)o+f>GiI6+frqB^00-sVb~~ zDEu~U9;gb0rMZlIuDF8^{@jsI1w`s21pq}CzaR;BsW>Fpzof@m-cfX#efR=zC6RDr zZUywZYpwuhRslMo+C;aXxd2IQ(Okj%MRWJm3wF21Ht1iM&R6IFCkTpe5R7s@!C_)h z%m)F^(bMWpI|z6l1%Wt2nrco(fkzNI62y+gfQrK<=o+Qjf|6u{cAa6nE!%R>xJ%tL z?yCDu{jPVaaLN;9o%R$heMq7A-*<6rrL!*JluC&BgCs_I&e<~pqStIz8r2#@`hnO8_aQz?kT`QFTn^1lh>8prpilSmxe z3&Qkb8N3CWt2F8342x=5rM`;@@Ab-`w_SyMsr&?&i8yL^LpafYt2(KoQ?GgRf7A34 AqyPW_ literal 0 HcmV?d00001 diff --git a/src/__pycache__/conformations.cpython-37.pyc b/src/__pycache__/conformations.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8aaf1a29e34dc498ee5f0f97eb9a036e48a65599 GIT binary patch literal 6715 zcma)B&yU^990+Ei90nhr{K+bRkWMJY|vRzY8P9rb z=lM;tJDL>|i8wU^ZX6Iw1Q#SEkoXJW%7GgPAGmPJjVnFz`9A-co!u05R(`gh-}}B_ zpYP}UV{fjlbv69{@{6B+df`<~`!~JRKLZcn!Ig6qTyr(fxE?cCS9ilT)xG6fxEpbM zV!QUF<8~%px67!l8Lv!M-BtCh$7_>ycY|pkYP`j*#~QaD>Fz1s;cad|X6`1}?`XZQ z{|}~V-MgbGcP1&H#$oP^{Djjz6R8ZNBzJ-|8Kh$3%P7SgzB+y!rw`G?PoiuZ<3loZ z#KAH%uC4juL`#a7gl%tgA&Nb&F z9wsu92WTcAh8Vmbr$O#ufnChS$)ibz#Y-m@4v%uYMzJrbeJRR!@@YSZfGO=pH87@f zGnJzg(+JW@Hl<}fjPP~u@+9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^fJx#X9@POwgKQ(Xj z%_k=2!1&gl@k=Jo$oA6?e`(In!i8XHNvsH--2xMy_OH}TSZ5Lu%RA8o2~(nuI$=mz zH|y7)iFY*@fm1wy(qcMRwr^9_p6LQ4l>e73Zkfrs6z`f*pvjsk;!b zP~|tMz`qbQafJ$UdWX31`_H?WQ|n>Gq!+ zKreBVil0zH!7dz>SQbX#7jB!j3XTqh#c3YGC#TJESB@MCNUe_uAsN8IuWmz;PO~Fk z`DY|~!3QdC?KFGwYkbXVA==6o{PM281-3d3?t+g_e)@?E%*NLBEqq_s#R&a~wzkBN z@l;r4T31COMN4H0)OuaJ{x5={px!-`2N9A8IWm;U43ht*Z0(VloRHvN$POxXp(K6v zxLtE^X#_Um3gG_}GLHI4^w1M#q3$Ap3`K2fnn$)kZAKZtUoRQ<23a7L7Xm9{fi^o$ L;fcQfQ_c7vw>@GZ literal 0 HcmV?d00001 diff --git a/src/conformations.py b/src/conformations.py new file mode 100644 index 0000000..9a48164 --- /dev/null +++ b/src/conformations.py @@ -0,0 +1,194 @@ +""" +This modules handles proteins conformations and allows manipulating them. + +Conformations are loaded as a pdb file and are then converted to PBs sequences +using the pbxplore package. + +Distance matrixes can be produced using 2 methods : Identity between blocs for +the simplest or dissimilarity using a substitution matrix. + +Both matrixes can be computed with k-medoids algorithm for clustering. + +Generated clusters can be visualised with the visualisation method. +""" + +import pandas as pd +import numpy as np +import pbxplore as pbx +from scipy.spatial.distance import squareform, pdist, jaccard +from pyclustering.cluster.kmedoids import kmedoids +import matplotlib.pyplot as plt + +class Conformations: + """ + An instance of the class conformations contains differents conformations of + the same protein, encoded as 1D sequences of protein bloc, in a pandas + dataframe. + """ + + def __init__(self, filename): + """ + filename : a .pdb file or several pdb file containing the conformations + + Attribute : + - df : pd.DataFrame object + - filename : a list of str, paths to the structure files + - simple_dist : matrix distance computed with the identity method + Initiality empty, must be computed + - dissimilarity_dist : matrix distance computed with the + dissimilarity method, initialy empty because + the computation time is long + Each row of the dataframe is a conformation and each column a position + of the sequence. + """ + self.df = pd.DataFrame() + self.filename = filename + self.identity_dist = np.array(None) + self.dissimilarity_dist = np.array(None) + for chain_name, chain in pbx.chains_from_files([filename]): + dihedrals = chain.get_phi_psi_angles() + pb_seq = pbx.assign(dihedrals) + self.df = self.df.append(pd.Series(list(pb_seq)), + ignore_index=True) + + def identity(self): + """ + Computes a distance matrix between all conformations based on + wether the PB at each position is identical or not. + Returns the matrix as a numpy.ndarray object. + """ + dict_str_to_float = {'Z':0, 'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6, + 'g':7, 'h':8, 'i':9, 'j':10, 'k':11, 'l':12, + 'm':13, 'n':14, 'o':15, 'p':16} + # dict to transform PB to + # int, necessary for the pdist function + dfnum = self.df.replace(dict_str_to_float) + dist = squareform(pdist(dfnum, metric='jaccard')) + self.identity_dist = dist + + return dist + + def dissimilarity(self, matrix=None): + """ + Returns a matrix of the distance between all conformations computed + according to a substitution matrix of the protein blocks. + If no substitution matrix is specified, use the matrix from the + PBxplore package. + """ + dissimilarity = np.zeros((self.df.shape[0], self.df.shape[0])) + if matrix == None: + matrix = pd.read_table("data/PBs_substitution_matrix.dat", + index_col=False, sep='\t') + matrix = matrix/100 # because in this file weight where multiplied + # by 100. + matrix.index = matrix.columns + ncol = self.df.shape[1] + nrow = self.df.shape[0] + for i in range(1, nrow): # compute each pairwise distance once only + for j in range(i): + for k in range(ncol): + dissimilarity[i][j] += \ + matrix[self.df.loc[i, k]][self.df.loc[j, k]] + dissimilarity = dissimilarity + dissimilarity.T # fills the whole matrix + + return self.dist_from_dissimilarity(dissimilarity) + + def dist_from_dissimilarity(self, diss_matrix): + """ + Using the substitution matrix from the PBxplore package, the obtained + dissimilarity matrix has both positive and negative values. Low value + represent strong differences as identical PB substitution are high + positive value. + This function returns a distance matrix from the dissimilarity matrix. + + Arguments : + - diss_matrix : ndarray + obtained from Configurations.dissimilarity + """ + diss_matrix = -diss_matrix + diss_matrix = (diss_matrix - np.min(diss_matrix))/np.ptp(diss_matrix) + dist = diss_matrix * abs((np.identity(self.df.shape[0])-1)) + + self.dissimilarity_dist = dist + + return dist + + def small_kmedoids(self, matrix, ncluster): + """ + Returns clusters and medoids computed with kmedoids on a distance matrix + Arguments : + - matrix : str, ('identity' or 'dissimilarity') + corresponding to the desired distance matrix to be + computed + - ncluster number of clusters to be computed + """ + if matrix == 'identity': + + matrix = self.identity_dist + if matrix.all() == None: + print("Error : distance matrix from identity hasn't been " \ + "computed yet") + return + elif matrix == 'dissimilarity': + matrix = self.dissimilarity_dist + if matrix.all() == None: + print("Error : distance matrix from dissimilarity hasn't " \ + "been computed yet") + return + + if ncluster > matrix.shape[0]: + print("Error : number of desired clusters > number of objects") + return + + initial_medoids = np.random.randint(matrix.shape[0], size=ncluster) + kmed1 = kmedoids(matrix, initial_medoids, data_type='distance_matrix') + kmed1.process() + + clusters = kmed1.get_clusters() + medoids = kmed1.get_medoids() + + return (clusters, medoids) + +def visualise(clusters, output_name=None): + """ + Generate an image to visualise clusters. Can currently display up to + seven different colors + Arguments : + - clusters : list of lists + output of the small_kmedoids method + + - output_name : str + desired filename for the image output, if none don't save file + """ + nb_confs = sum([len(x) for x in clusters]) + confs = np.arange(nb_confs) + group = np.zeros(nb_confs) + + for i in range(len(clusters)): + for j in clusters[i]: + group[j] = i+1 + + color = [] + #dict_col = {1:'b',2:'c',3:'',4:'',5:'',6:''} + for i in group: + if i == 1: + color.append('b') + if i == 2: + color.append('g') + if i == 3: + color.append('y') + if i == 4: + color.append('r') + if i == 5: + color.append('c') + if i == 6: + color.append('m') + elif i > 6: + color.append('k') + + plt.bar(confs, group, width=1.0, color=color) + + if output_name != None: + plt.savefig("results/"+output_name) + + plt.close() diff --git a/src/projet8.py b/src/projet8.py index 9205a92..f6be08d 100644 --- a/src/projet8.py +++ b/src/projet8.py @@ -1,189 +1,7 @@ #!/bin/python3 -import pandas as pd -import numpy as np -import pbxplore as pbx import sys -from scipy.spatial.distance import squareform, pdist, jaccard -from pyclustering.cluster.kmedoids import kmedoids -from pyclustering.cluster import cluster_visualizer -from pyclustering.utils import read_sample -from pyclustering.samples.definitions import FCPS_SAMPLES -import matplotlib.pyplot as plt - -class Conformations: - """ - An instance of the class conformations contains differents conformations of - the same protein, encoded as 1D sequences of protein bloc, in a pandas - dataframe. - """ - pass - - def __init__(self, filename): - """ - filename : a .pdb file or several pdb file containing the conformations - - Attribute : - - df : pd.DataFrame object - - filename : a list of str, paths to the structure files - - simple_dist : matrix distance computed with the identity method - Initiality empty, must be computed - - dissimilarity_dist : matrix distance computed with the - dissimilarity method, initialy empty because - the computation time is long - Each row of the dataframe is a conformation and each column a position - of the sequence. - """ - self.df = pd.DataFrame() - self.filename = filename - self.identity_dist = np.array(None) - self.dissimilarity_dist = np.array(None) - for chain_name, chain in pbx.chains_from_files([filename]): - dihedrals = chain.get_phi_psi_angles() - pb_seq = pbx.assign(dihedrals) - self.df = self.df.append(pd.Series(list(pb_seq)), - ignore_index=True) - - def identity(self): - """ - Computes a distance matrix between all conformations based on - wether the PB at each position is identical or not. - Returns the matrix as a numpy.ndarray object. - """ - dict_str_to_float = {'Z':0,'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7, - 'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14, - 'o':15,'p':16} # dict to transform PB to int, - # necessary for the pdsit function - dfnum = self.df.replace(dict_str_to_float) - dist = squareform(pdist(dfnum, metric ='jaccard')) - self.identity_dist = dist - - return dist - - def dissimilarity(self, matrix=None): - """ - Returns a matrix of the distance between all conformations computed - according to a substitution matrix of the protein blocks. - If no substitution matrix is specified, use the matrix from the - PBxplore package. - """ - dissimilarity = np.zeros((self.df.shape[0],self.df.shape[0])) - if matrix == None: - matrix = pd.read_table("data/PBs_substitution_matrix.dat", - index_col=False, sep ='\t') - matrix = matrix/100 # because in this file weight where multiplied - # by 100. - matrix.index = matrix.columns - ncol = self.df.shape[1] - nrow = self.df.shape[0] - it1 = self.df.iterrows() - for i in range(1,nrow): # compute each pairwise distance once only - for j in range(i): - for k in range(ncol): - dissimilarity[i][j] += matrix[confs.df.loc[i,k]][confs.df.loc[j,k]] - dissimilarity = dissimilarity + dissimilarity.T # fills the whole matrix - - return self.dist_from_dissimilarity(dissimilarity) - - def dist_from_dissimilarity(self, diss_matrix): - """ - Using the substitution matrix from the PBxplore package, the obtained - dissimilarity matrix has both positive and negative values. Low value - represent strong differences as identical PB substitution are high - positive value. - This function returns a distance matrix from the dissimilarity matrix. - - Arguments : - - diss_matrix : ndarray - obtained from Configurations.dissimilarity - """ - diss_matrix = -diss_matrix - diss_matrix = (diss_matrix - np.min(diss_matrix))/np.ptp(diss_matrix) - dist = diss_matrix * abs((np.identity(confs.df.shape[0])-1)) - - self.dissimilarity_dist = dist - - return dist - - def small_kmedoids(self, matrix, ncluster): - """ - Returns clusters and medoids computed with kmedoids on a distance matrix - Arguments : - - matrix : str, ('identity' or 'dissimilarity') - corresponding to the desired distance matrix to be - computed - - ncluster number of clusters to be computed - """ - if matrix == 'identity': - - matrix = self.identity_dist - if matrix.all() == None: - print("Error : distance matrix from identity hasn't been " \ - "computed yet") - return - elif matrix == 'dissimilarity': - matrix = self.dissimilarity_dist - if matrix.all() == None: - print("Error : distance matrix from dissimilarity hasn't " \ - "been computed yet") - return - - if ncluster > matrix.shape[0]: - print("Error : number of desired clusters > number of objects") - return - - initial_medoids = np.random.randint(matrix.shape[0], size=ncluster) - kmed1 = kmedoids(matrix, initial_medoids, data_type='distance_matrix') - kmed1.process() - - clusters = kmed1.get_clusters() - medoids = kmed1.get_medoids() - - return (clusters, medoids) - - def visualise(clusters, output_name=None): - """ - Generate an image to visualise clusters. Can currently display up to - seven different colors - Arguments : - - clusters : list of lists - output of the small_kmedoids method - - - output_name : str - desired filename for the image output, if none don't save file - """ - nb_confs = sum([len(x) for x in clusters]) - x = np.arange(nb_confs) - y = np.zeros(nb_confs) - - for i in range(len(clusters)): - for j in clusters[i]: - y[j] = i+1 - - color = [] - #dict_col = {1:'b',2:'c',3:'',4:'',5:'',6:''} - for i in y: - if i == 1: - color.append('b') - if i == 2: - color.append('g') - if i == 3: - color.append('y') - if i == 4: - color.append('r') - if i == 5: - color.append('c') - if i == 6: - color.append('m') - elif i > 6: - color.append('k') - - plt.bar(x, y, width=1.0, color=color) - - if output_name != None: - plt.savefig("results/"+output_name) - - plt.close() +from conformations import * if __name__ == "__main__": if len(sys.argv) < 2: @@ -195,7 +13,7 @@ if __name__ == "__main__": # Computation of the distance matrixes confs.identity() - confs.dissimilarity() + #confs.dissimilarity() # Running the kmedoids algorithm on the identity distance matrix clusters_idt = confs.small_kmedoids('identity', nclusters) @@ -203,10 +21,7 @@ if __name__ == "__main__": clusters_idt = clusters_idt[0] # Running the kmedoids algorithm on the dissimilarity distance matrix - clusters_diss = confs.small_kmedoids('dissimilarity', nclusters) - medoids_diss = clusters_diss[1] - clusters_diss = clusters_diss[0] + #clusters_diss = confs.small_kmedoids('dissimilarity', nclusters) + #medoids_diss = clusters_diss[1] + #clusters_diss = clusters_diss[0] - - - print(confs.df)