aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/rqtl.py
diff options
context:
space:
mode:
authorzsloan2021-07-26 20:47:37 +0000
committerzsloan2021-07-26 20:47:37 +0000
commita675e25d885f385c6ecd708f186b2ee448b97cd1 (patch)
treeb6ba56fad8834e30770d79af115dce6d6b170ffb /gn3/computations/rqtl.py
parentb3e6105b5d8d2c2f30f2609290ef62fa17f32e62 (diff)
downloadgenenetwork3-a675e25d885f385c6ecd708f186b2ee448b97cd1.tar.gz
Added pairscan boolean kwarg and process_rqtl_pairscan function for reading in pairscan results + renamed process_rqtl_output to process_rqtl_mapping to distinguish between that and pairscan
Diffstat (limited to 'gn3/computations/rqtl.py')
-rw-r--r--gn3/computations/rqtl.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py
index 0433b3f..405b743 100644
--- a/gn3/computations/rqtl.py
+++ b/gn3/computations/rqtl.py
@@ -47,7 +47,7 @@ output filename generated from a hash of the genotype and phenotype files
}
-def process_rqtl_output(file_name: str) -> List:
+def process_rqtl_mapping(file_name: str) -> List:
"""Given an output file name, read in R/qtl results and return
a List of marker objects
@@ -80,6 +80,21 @@ def process_rqtl_output(file_name: str) -> List:
return marker_obs
+def process_rqtl_pairscan(file_name: str) -> List:
+ """Given an output file name, read in R/qtl pair-scan results and return
+ a List of Lists representing the matrix of results
+
+ """
+ results = []
+ with open(os.path.join(current_app.config.get("TMPDIR", "/tmp"),
+ "output", file_name), "r") as the_file:
+ for i, line in enumerate(the_file):
+ if i == 0: # Skip first line
+ continue
+ line_items = line.split(",")
+ results.append(line_items[1:]) # Append all but first item in line
+
+ return results
def process_perm_output(file_name: str):
"""Given base filename, read in R/qtl permutation output and calculate