aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cli/options.py2
-rw-r--r--scripts/run_qtlreaper.py15
2 files changed, 8 insertions, 9 deletions
diff --git a/scripts/cli/options.py b/scripts/cli/options.py
index 67f35dc..70d2a27 100644
--- a/scripts/cli/options.py
+++ b/scripts/cli/options.py
@@ -13,7 +13,7 @@ def add_logging(parser: ArgumentParser) -> ArgumentParser:
type=str,
default="INFO",
choices=loglevels,
- help=(f"Controls the severity of events to log. Valid values are: " +
+ help=("Controls the severity of events to log. Valid values are: " +
", ".join(f"'{level}'" for level in loglevels)))
return parser
diff --git a/scripts/run_qtlreaper.py b/scripts/run_qtlreaper.py
index ab58203..89cc3ec 100644
--- a/scripts/run_qtlreaper.py
+++ b/scripts/run_qtlreaper.py
@@ -4,7 +4,6 @@ import csv
import time
import secrets
import logging
-import traceback
import subprocess
from pathlib import Path
from typing import Union
@@ -86,8 +85,7 @@ def parse_tsv_file(results_file: Path) -> list[dict]:
_dialect = csv.unix_dialect()
_dialect.delimiter = "\t"
reader = csv.DictReader(readptr, dialect=_dialect)
- for row in reader:
- yield row
+ yield from reader
def __qtls_by_trait__(qtls, current):
@@ -99,6 +97,7 @@ def __qtls_by_trait__(qtls, current):
def save_qtl_values_to_db(conn, qtls: dict):
+ """Save computed QTLs to the database."""
with conn.cursor() as cursor:
cursor.executemany(
"UPDATE PublishXRef SET "
@@ -167,16 +166,16 @@ def dispatch(args: Namespace) -> int:
_traitsfile.unlink()
_qtlreaper_main_output.unlink()
logger.info("Successfully computed p values for %s traits.", len(_traitsdata))
- exitcode = 0
+ return 0
except FileNotFoundError as fnf:
logger.error(", ".join(fnf.args), exc_info=False)
except AssertionError as aserr:
logger.error(", ".join(aserr.args), exc_info=False)
- except Exception as _exc:
+ except Exception as _exc:# pylint: disable=[broad-exception-caught]
logger.debug("Type of exception: %s", type(_exc))
logger.error("General exception!", exc_info=True)
- finally:
- return exitcode
+
+ return exitcode
if __name__ == "__main__":
@@ -205,7 +204,7 @@ if __name__ == "__main__":
"in the population."))
args = parser.parse_args()
setup_logging(logger, args.log_level)
-
+
return dispatch(args)
sys.exit(main())