Louis BECQUEY

prevent div by zero if no 3D structures in the folder

......@@ -944,7 +944,6 @@ def par_distance_matrix(filelist, f, label, consider_all_atoms, s):
coordinates_with_gaps.append(coordinates[i - nb_gap])
# Build the pairwise distances
print("> Computing distances for", s.id)
d = np.zeros((len(s.seq), len(s.seq)), dtype=np.float16)
for i in range(len(s.seq)):
for j in range(len(s.seq)):
......@@ -953,7 +952,6 @@ def par_distance_matrix(filelist, f, label, consider_all_atoms, s):
else:
d[i,j] = get_euclidian_distance(coordinates_with_gaps[i], coordinates_with_gaps[j])
print("> finished.")
np.savetxt(runDir + '/results/distance_matrices/' + f + '_'+ label + '/'+ s.id.strip("\'") + '.csv', d, delimiter=",", fmt="%.3f")
return 1-np.isnan(d).astype(int), np.nan_to_num(d), np.nan_to_num(d*d)
......@@ -1026,6 +1024,7 @@ def get_avg_std_distance_matrix(f, consider_all_atoms, multithread=False):
exit(1)
if (counts > 1).all():
# Calculation of the average matrix
avg = avg/counts
np.savetxt(runDir + '/results/distance_matrices/' + f + '_'+ label + '/' + f + '_average.csv' , avg, delimiter=",", fmt="%.3f")
......