1
0
Fork 0

fixed the Conformations.visualise method bug

master
nicolas-zimmermann 2019-09-18 19:42:34 +02:00
parent 194bb3dcef
commit 05bc57ef6e
1 changed files with 12 additions and 9 deletions

View File

@ -9,7 +9,7 @@ from pyclustering.cluster.kmedoids import kmedoids
from pyclustering.cluster import cluster_visualizer from pyclustering.cluster import cluster_visualizer
from pyclustering.utils import read_sample from pyclustering.utils import read_sample
from pyclustering.samples.definitions import FCPS_SAMPLES from pyclustering.samples.definitions import FCPS_SAMPLES
import matplotlib.pyplot as plt
class Conformations: class Conformations:
""" """
@ -156,31 +156,34 @@ class Conformations:
x = np.arange(nb_confs) x = np.arange(nb_confs)
y = np.zeros(nb_confs) y = np.zeros(nb_confs)
for i in range(len(clusters_diss)): for i in range(len(clusters)):
for j in clusters_diss[i]: for j in clusters[i]:
y[j] = i+1 y[j] = i+1
color = [] color = []
#dict_col = {1:'b',2:'c',3:'',4:'',5:'',6:''}
for i in y: for i in y:
if i == 1: if i == 1:
color.append('b') color.append('b')
if i == 2: if i == 2:
color.append('c')
if i == 3:
color.append('g') color.append('g')
if i == 4: if i == 3:
color.append('y') color.append('y')
if i == 5: if i == 4:
color.append('r') color.append('r')
if i == 5:
color.append('c')
if i == 6: if i == 6:
color.append('m') color.append('m')
else: elif i > 6:
color.append('k') color.append('k')
plt.bar(x, y, width=1.0, color=color) plt.bar(x, y, width=1.0, color=color)
if output_name != None: if output_name != None:
plt.savefig(output_name) plt.savefig("results/"+output_name)
plt.close()
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 2: if len(sys.argv) < 2: