aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2021-09-03 14:58:05 +0000
committerzsloan2021-09-03 14:58:05 +0000
commit5ebe36d5ff685e6b663b14c130606aa60b0123c2 (patch)
tree9cfc73e3f470600cdd5ac2bdb06ba64672fcf447
parentcc7c392198f73ac8e8419be1367ce566d85a873c (diff)
downloadgenenetwork2-5ebe36d5ff685e6b663b14c130606aa60b0123c2.tar.gz
Fix issue where values written to phenotype file for R/qtl sometimes had trailing decimal values by grounding to 3 places past the decimal
-rw-r--r--wqflask/wqflask/marker_regression/rqtl_mapping.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wqflask/wqflask/marker_regression/rqtl_mapping.py b/wqflask/wqflask/marker_regression/rqtl_mapping.py
index 09afb8d1..cd578870 100644
--- a/wqflask/wqflask/marker_regression/rqtl_mapping.py
+++ b/wqflask/wqflask/marker_regression/rqtl_mapping.py
@@ -89,7 +89,7 @@ def write_phenotype_file(trait_name: str,
for i, sample in enumerate(samples):
this_row = [sample]
if vals[i] != "x":
- this_row.append(vals[i])
+ this_row.append(str(round(float(vals[i]), 3)))
else:
this_row.append("NA")
for cofactor in cofactor_data:
@@ -126,7 +126,7 @@ def cofactors_to_dict(cofactors: str, dataset_ob, samples) -> Dict:
sample_data = trait_ob.data
for index, sample in enumerate(samples):
if sample in sample_data:
- sample_value = sample_data[sample].value
+ sample_value = str(round(float(sample_data[sample].value), 3))
cofactor_dict[cofactor_name].append(sample_value)
else:
cofactor_dict[cofactor_name].append("NA")