Révision f8c4eafe modules/clustering.py
b/modules/clustering.py | ||
---|---|---|
54 | 54 |
num_confs = len(mol_list) |
55 | 55 |
conf_ids = list(range(num_confs)) |
56 | 56 |
rmsd_mtx = np.zeros((num_confs, num_confs)) |
57 |
for id1 in conf_ids: # TODO reduce RMSD precision |
|
57 |
for id1 in conf_ids: # TODO reduce RMSD precision
|
|
58 | 58 |
for id2 in conf_ids[id1 + 1:]: |
59 | 59 |
rmsd = Chem.GetBestRMS(mol_list[id1], mol_list[id2]) |
60 | 60 |
rmsd_mtx[id1][id2] = rmsd |
... | ... | |
153 | 153 |
plt.figure(figsize=(10, 8)) |
154 | 154 |
for i in range(len(labels)): |
155 | 155 |
plt.plot(x[i], y[i], c=rb(labels[i]), marker='.') |
156 |
if i == exemplars[labels[i]]: |
|
156 |
if len(exemplars) > 0 and i == exemplars[labels[i]]:
|
|
157 | 157 |
plt.plot(x[i], y[i], c=rb(labels[i]), marker="x", |
158 | 158 |
markersize=15, |
159 | 159 |
label=f"Exemplar cluster {labels[i]}") |
... | ... | |
216 | 216 |
logger.info(f'Conformers are grouped in {len(exemplars)} clusters.') |
217 | 217 |
return exemplars |
218 | 218 |
else: |
219 |
pass |
|
219 |
not_impl_err = 'Clustering not yet implemented for vectorized data' |
|
220 |
logger.error(not_impl_err) |
|
221 |
raise NotImplementedError(not_impl_err) |
Formats disponibles : Unified diff