diff options
author | BonfaceKilz | 2020-07-22 01:37:52 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-07-24 03:47:43 +0300 |
commit | b39ef1e464208cf8806dc73cfe9684183ce7c9a2 (patch) | |
tree | 6d6a8f556a9056d4ec155dc3c0a9e78cf217d73d /wqflask/utility | |
parent | 01bbbc1ee82b43505e65446e4657ca7790453fdf (diff) | |
download | genenetwork2-b39ef1e464208cf8806dc73cfe9684183ce7c9a2.tar.gz |
Simplify normalize_values
* wqflask/utility/corr_result_helpers.py(normalize_values): Replace loop with
zip form
Diffstat (limited to 'wqflask/utility')
-rw-r--r-- | wqflask/utility/corr_result_helpers.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/wqflask/utility/corr_result_helpers.py b/wqflask/utility/corr_result_helpers.py index b543c589..69c6fe1b 100644 --- a/wqflask/utility/corr_result_helpers.py +++ b/wqflask/utility/corr_result_helpers.py @@ -14,15 +14,11 @@ def normalize_values(a_values, b_values): min_length = min(len(a_values), len(b_values)) a_new = [] b_new = [] - for counter in range(min_length): - if (a_values[counter] or a_values[counter] == 0) and (b_values[counter] or b_values[counter] == 0): - a_new.append(a_values[counter]) - b_new.append(b_values[counter]) - - num_overlap = len(a_new) - assert num_overlap == len(b_new), "Lengths should be the same" - - return a_new, b_new, num_overlap + for a, b in zip(a_values, b_values): + if not (a == None or b == None): + a_new.append(a) + b_new.append(b) + return a_new, b_new, len(a_new) def common_keys(a_samples, b_samples): |