aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2021-05-03 19:07:53 +0000
committerzsloan2021-05-03 19:07:53 +0000
commit6ae31c151d7e47e4c63ec2f460426793172c0a1e (patch)
tree30db2919df6f8d4992655fbdeda5e52185150095
parent21b2e2a552b8b6bedb789263543a4d6d039ac8a9 (diff)
downloadgenenetwork2-6ae31c151d7e47e4c63ec2f460426793172c0a1e.tar.gz
Account for the possibility of the R being returned as 0.999... by scipy when a trait is correlated against itself - before the 0.999... was preventing it from switching to calculating Spearman for the values above the diagonal in the correlation matrix
-rw-r--r--wqflask/wqflask/correlation_matrix/show_corr_matrix.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
index 3a54a218..155b725f 100644
--- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
+++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py
@@ -40,7 +40,6 @@ from utility.redis_tools import get_redis_conn
Redis = get_redis_conn()
THIRTY_DAYS = 60 * 60 * 24 * 30
-
class CorrelationMatrix:
def __init__(self, start_vars):
@@ -129,7 +128,7 @@ class CorrelationMatrix:
this_trait_vals, target_vals)
if is_spearman == False:
sample_r, sample_p = pearson_r, pearson_p
- if sample_r == 1:
+ if sample_r > 0.999:
is_spearman = True
else:
sample_r, sample_p = scipy.stats.spearmanr(