Skip to content
Snippets Groups Projects
Commit 654a0bdc authored by Studer Gabriel's avatar Studer Gabriel
Browse files

bugfix: guard np.mean from empty list as input

parent a552c768
Branches
Tags
No related merge requests found
...@@ -1095,11 +1095,17 @@ class Scorer: ...@@ -1095,11 +1095,17 @@ class Scorer:
# - the two above including nonmapped_interfaces => set DockQ to 0.0 # - the two above including nonmapped_interfaces => set DockQ to 0.0
scores = np.array(self._dockq_scores) scores = np.array(self._dockq_scores)
weights = np.array(self._native_contacts) weights = np.array(self._native_contacts)
self._dockq_ave = np.mean(scores) if len(scores) > 0:
self._dockq_ave = np.mean(scores)
else:
self._dockq_ave = 0.0
self._dockq_wave = np.sum(np.multiply(weights/np.sum(weights), scores)) self._dockq_wave = np.sum(np.multiply(weights/np.sum(weights), scores))
scores = np.append(scores, [0.0]*len(self._nonmapped_interfaces)) scores = np.append(scores, [0.0]*len(self._nonmapped_interfaces))
weights = np.append(weights, self._nonmapped_interfaces_contacts) weights = np.append(weights, self._nonmapped_interfaces_contacts)
self._dockq_ave_full = np.mean(scores) if len(scores) > 0:
self._dockq_ave_full = np.mean(scores)
else:
self._dockq_ave_full = 0.0
self._dockq_wave_full = np.sum(np.multiply(weights/np.sum(weights), self._dockq_wave_full = np.sum(np.multiply(weights/np.sum(weights),
scores)) scores))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment