From 476b146562070cee6a55c55c03c37ef3e19a1474 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 18 Jun 2021 20:54:18 +0000 Subject: Resolve mypy errors in computations/rqtl.py --- gn3/computations/rqtl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gn3/computations/rqtl.py b/gn3/computations/rqtl.py index 22d9faf..7b1a35c 100644 --- a/gn3/computations/rqtl.py +++ b/gn3/computations/rqtl.py @@ -1,8 +1,7 @@ """Procedures related rqtl computations""" import os import numpy as np -from typing import Dict -from typing import List +from typing import Dict, List, Union from flask import current_app @@ -55,7 +54,7 @@ def process_rqtl_output(file_name: str) -> List: marker_obs = [] # Later I should probably redo this using csv.read to avoid the # awkwardness with removing quotes with [1:-1] - with open(os.path.join(current_app.config.get("TMPDIR"), "output", file_name), "r") as the_file: + with open(os.path.join(current_app.config.get("TMPDIR", "/tmp"), "output", file_name), "r") as the_file: for line in the_file: line_items = line.split(",") if line_items[1][1:-1] == "chr" or not line_items: @@ -63,6 +62,7 @@ def process_rqtl_output(file_name: str) -> List: continue else: # Convert chr to int if possible + the_chr: Union[int, str] try: the_chr = int(line_items[1][1:-1]) except: @@ -85,7 +85,7 @@ def process_perm_output(file_name: str): """ perm_results = [] - with open(os.path.join(current_app.config.get("TMPDIR"), "output", "PERM_" + file_name), "r") as the_file: + with open(os.path.join(current_app.config.get("TMPDIR", "/tmp"), "output", "PERM_" + file_name), "r") as the_file: for i, line in enumerate(the_file): if i == 0: # Skip header line -- cgit v1.2.3