about summary refs log tree commit diff
diff options
context:
space:
mode:
authorzsloan2025-04-14 18:39:44 +0000
committerzsloan2025-04-14 18:43:17 +0000
commit3f344ef7aea901b9b5a1a569483b746031e9795d (patch)
tree23ed5a689076297704285d5d32144996b9fc5ce6
parent757fce9fc0e08941983113157edaf6e1d552aebd (diff)
downloadgenenetwork3-3f344ef7aea901b9b5a1a569483b746031e9795d.tar.gz
Include effect mean/SE for 4-way crosses in R/qtl results
-rw-r--r--gn3/computations/rqtl.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py
index 941a19b..3dd8fb2 100644
--- a/gn3/computations/rqtl.py
+++ b/gn3/computations/rqtl.py
@@ -69,6 +69,7 @@ def process_rqtl_mapping(file_name: str) -> List:
     # awkwardness with removing quotes with [1:-1]
     outdir = os.path.join(get_tmpdir(),"gn3")
     with open(os.path.join(outdir,file_name),"r",encoding="utf-8") as the_file:
+        column_count = len(the_file.readline().strip().split(","))
         for line in the_file:
             line_items = line.split(",")
             if line_items[1][1:-1] == "chr" or not line_items:
@@ -88,6 +89,16 @@ def process_rqtl_mapping(file_name: str) -> List:
                 "Mb": float(line_items[2]),
                 "lod_score": float(line_items[3]),
             }
+            # If 4-way, get extra effect columns
+            if column_count > 4:
+                this_marker['mean1'] = line_items[4][1:-1].split(' ± ')[0]
+                this_marker['se1'] = line_items[4][1:-1].split(' ± ')[1]
+                this_marker['mean2'] = line_items[5][1:-1].split(' ± ')[0]
+                this_marker['se2'] = line_items[5][1:-1].split(' ± ')[1]
+                this_marker['mean3'] = line_items[6][1:-1].split(' ± ')[0]
+                this_marker['se3'] = line_items[6][1:-1].split(' ± ')[1]
+                this_marker['mean4'] = line_items[7][1:-1].split(' ± ')[0]
+                this_marker['se4'] = line_items[7][1:-1].split(' ± ')[1]
             marker_obs.append(this_marker)
 
     return marker_obs