about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-11-05 14:47:59 -0600
committerFrederick Muriuki Muriithi2025-11-05 14:57:44 -0600
commitfa57e53e0fe8db4f05f04c3b9fdb286a39daff62 (patch)
treee1878cdd9a01657d862017aaa51e80899566fbab /scripts
parentbe454227c89dd1cbbed7deaec258afb752ce442f (diff)
downloadgn-uploader-main.tar.gz
Fix issues caught by linter. HEAD main
Diffstat (limited to 'scripts')
-rw-r--r--scripts/compute_phenotype_means.py (renamed from scripts/compute-phenotype-means.py)20
1 files changed, 8 insertions, 12 deletions
diff --git a/scripts/compute-phenotype-means.py b/scripts/compute_phenotype_means.py
index 3b876b7..ef2fabc 100644
--- a/scripts/compute-phenotype-means.py
+++ b/scripts/compute_phenotype_means.py
@@ -9,6 +9,8 @@ import MySQLdb
 
 from gn_libs import mysqldb
 from uploader import setup_modules_logging
+
+from .cli_parser import add_logging_option
 from .load_phenotypes_to_db import update_means
 
 logger = logging.getLogger(__name__)
@@ -40,19 +42,18 @@ def run(args) -> int:
                          len(xref_ids))
             return 0
         _reasons = (
-            "no population exists with the ID '%s'",
+            f"no population exists with the ID {args.population_id}",
             "the population exists but it has no phenotypes linked to it yet")
         logger.error(
-            ("No cross-reference IDs to run against. Likely causes are: "
-             + " OR ".join(_reasons) + "."),
-            args.population_id)
+            "No cross-reference IDs to run against. Likely causes are: %s",
+            " OR ".join(_reasons) + ".")
         return 1
 
 
 T = TypeVar("T")
 def comma_separated_list(val: str, itemstype: T = str) -> tuple[T, ...]:
-        """Convert val into a list of items of type 'itemstype'."""
-        return tuple(itemstype(item.strip()) for item in val.split(","))
+    """Convert val into a list of items of type 'itemstype'."""
+    return tuple(itemstype(item.strip()) for item in val.split(","))
 
 
 def comma_separated_list_of_integers(val: str) -> tuple[int, ...]:
@@ -80,12 +81,7 @@ if __name__ == "__main__":
                             help=("Identifier for the InbredSet group/"
                                   "population to run means against."))
         ## Optional arguments
-        parser.add_argument(
-            "--log-level",
-            type=str,
-            help="Determines what is logged out.",
-            choices=("debug", "info", "warning", "error", "critical"),
-            default="info")
+        parser = add_logging_option(parser)
         parser.add_argument(
             "--cross-ref-ids",
             type=comma_separated_list_of_integers,