diff options
author | Muriithi Frederick Muriuki | 2021-08-17 11:43:32 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2021-08-17 11:43:32 +0300 |
commit | 41fc5136914548710529cbed7ef370dfb5b4a5c8 (patch) | |
tree | 53991e24c494420514e054335cf661ca3cfba46f /gn3/computations/heatmap.py | |
parent | d491be2057843921cc67bd1c4b1ae612d9f15d34 (diff) | |
download | genenetwork3-41fc5136914548710529cbed7ef370dfb5b4a5c8.tar.gz |
Test the clustering
Issue:
https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi
* gn3/computations/heatmap.py: Fix clustering bugs
* tests/unit/computations/test_heatmap.py: Add new tests. Fix linting issues.
Test and fix the clustering function.
Diffstat (limited to 'gn3/computations/heatmap.py')
-rw-r--r-- | gn3/computations/heatmap.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gn3/computations/heatmap.py b/gn3/computations/heatmap.py index 8a86fe8..3c35029 100644 --- a/gn3/computations/heatmap.py +++ b/gn3/computations/heatmap.py @@ -110,13 +110,13 @@ def cluster_traits(traits_data_list: Sequence[Dict]): https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/heatmap/Heatmap.py#L138-L162 """ def __compute_corr(tdata_i, tdata_j): - if tdata_j[0] < tdata_i[0]: - corr_vals = compute_correlation(tdata_i, tdata_j) - corr = corr_vals[0] - if (1 - corr) < 0: - return 0.0 - return 1 - corr - return 0.0 + if tdata_i[0] == tdata_j[0]: + return 0.0 + corr_vals = compute_correlation(tdata_i[1], tdata_j[1]) + corr = corr_vals[0] + if (1 - corr) < 0: + return 0.0 + return 1 - corr def __cluster(tdata_i): return tuple( |