about summary refs log tree commit diff
path: root/scripts/run_qtlreaper.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-12-17 12:44:52 -0600
committerFrederick Muriuki Muriithi2025-12-17 12:44:52 -0600
commitecdc6dbd73cd7aeb83eeb866378ef42cd8979131 (patch)
tree484525345cd4ba11460aaac0ac43e4e99515d127 /scripts/run_qtlreaper.py
parentfd4fde868727a2779a11c38ef7cda300d4288030 (diff)
downloadgn-uploader-ecdc6dbd73cd7aeb83eeb866378ef42cd8979131.tar.gz
Fix linting problems.
Diffstat (limited to 'scripts/run_qtlreaper.py')
-rw-r--r--scripts/run_qtlreaper.py15
1 files changed, 7 insertions, 8 deletions
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())