aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-10-29 08:38:48 +0300
committerFrederick Muriuki Muriithi2021-10-29 08:38:48 +0300
commit116006464a61edcfa354b729ea40a7af28c08d61 (patch)
treefe7d2d3e72eae4cc81a4fcc3c3af5e7273a2bc0a /gn3/computations
parent37f7fee32604e9ae752a33b473dd1abe22b05906 (diff)
downloadgenenetwork3-116006464a61edcfa354b729ea40a7af28c08d61.tar.gz
Specify ten (10) decimal places
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: specify 10 decimal places * tests/unit/computations/test_partial_correlations.py: update examples Slight differences in python implementations, possibly hardware and operating systems could cause the value of float (double) values to be different in the less significant parts of the decimal places. This commit limits the usable part of the decimals to the first 10 decimal places for now.
Diffstat (limited to 'gn3/computations')
-rw-r--r--gn3/computations/partial_correlations.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py
index fce6ad2..8a00931 100644
--- a/gn3/computations/partial_correlations.py
+++ b/gn3/computations/partial_correlations.py
@@ -148,7 +148,9 @@ def tissue_correlation(
assert method in method_fns.keys(), (
"Method must be one of: {}".format(",".join(method_fns.keys())))
- return method_fns[method](primary_trait_values, target_trait_values)
+ return tuple(
+ round(n, 10) for n in
+ method_fns[method](primary_trait_values, target_trait_values))
def batch_computed_tissue_correlation(
primary_trait_values: Tuple[float, ...], target_traits_dict: dict,