aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/qtlreaper.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2021-09-06 08:06:14 +0300
committerMuriithi Frederick Muriuki2021-09-06 08:06:14 +0300
commit679a1af832ad9585c7cf72996043edb08e1b0d10 (patch)
tree638a27a1f40d9391aefe88097e7dc67b2ce1ba3a /gn3/computations/qtlreaper.py
parent4ce5695a35e92a704add8d497266bb2986a593f6 (diff)
downloadgenenetwork3-679a1af832ad9585c7cf72996043edb08e1b0d10.tar.gz
Leave "Chr" value as string when parsing
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * The "Chr" value seems to be mostly a name of some sort, despite it being, seemingly an number. This commit parses the "Chr" value as a string. It also updates the tests to expec a string, rather than a number for "Chr" values.
Diffstat (limited to 'gn3/computations/qtlreaper.py')
-rw-r--r--gn3/computations/qtlreaper.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gn3/computations/qtlreaper.py b/gn3/computations/qtlreaper.py
index eff2a80..9b20309 100644
--- a/gn3/computations/qtlreaper.py
+++ b/gn3/computations/qtlreaper.py
@@ -94,7 +94,7 @@ def parse_reaper_main_results(results_file):
with open(results_file, "r") as infile:
lines = infile.readlines()
- def __parse_column_value(value):
+ def __parse_column_float_value(value):
try:
return float(value)
except:
@@ -102,7 +102,8 @@ def parse_reaper_main_results(results_file):
def __parse_line(line):
items = line.strip().split("\t")
- return items[0:2] + [__parse_column_value(item) for item in items[2:]]
+ return items[0:3] + [
+ __parse_column_float_value(item) for item in items[3:]]
header = lines[0].strip().split("\t")
return [dict(zip(header, __parse_line(line))) for line in lines[1:]]