diff options
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, |
