aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2021-12-20 07:19:16 +0300
committerFrederick Muriuki Muriithi2021-12-24 14:36:14 +0300
commitac8528c5847f4a517c16b5283c06d3caeae8ef5e (patch)
tree214e4dc29d4562721e76b8dad8bacb5b7913a2b3
parentc813dd68230a027b1b5acdbe9d3dba46f6bd1ad0 (diff)
downloadgenenetwork3-ac8528c5847f4a517c16b5283c06d3caeae8ef5e.tar.gz
Replace `NaN` with `null` in JSON string
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * `NaN` is not a valid JSON value, and leads to errors in the code. This commit replaces all `NaN` values with `null`.
-rw-r--r--gn3/api/correlation.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py
index c0b5806..1caf31f 100644
--- a/gn3/api/correlation.py
+++ b/gn3/api/correlation.py
@@ -110,7 +110,7 @@ def partial_correlation():
tuple(trait_fullname(trait) for trait in args["control_traits"]),
args["method"], int(args["criteria"]), args["target_db"])
response = make_response(
- json.dumps(corr_results, cls=OutputEncoder),
+ json.dumps(corr_results, cls=OutputEncoder).replace(": NaN", ": null"),
400 if "error" in corr_results.keys() else 200)
response.headers["Content-Type"] = "application/json"
return response