aboutsummaryrefslogtreecommitdiff
path: root/scripts/rqtl2
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/rqtl2')
-rw-r--r--scripts/rqtl2/entry.py3
-rw-r--r--scripts/rqtl2/install_genotypes.py8
-rw-r--r--scripts/rqtl2/install_phenos.py8
3 files changed, 9 insertions, 10 deletions
diff --git a/scripts/rqtl2/entry.py b/scripts/rqtl2/entry.py
index e2d70a6..eccc19d 100644
--- a/scripts/rqtl2/entry.py
+++ b/scripts/rqtl2/entry.py
@@ -11,13 +11,12 @@ from qc_app.check_connections import check_db, check_redis
from scripts.redis_logger import setup_redis_logger
-def build_main(cli_args: Callable[[], Namespace],
+def build_main(args: Namespace,
run_fn: Callable[[Connection, Namespace], int],
logger: Logger,
loglevel: str = "INFO") -> Callable[[],int]:
"""Build a function to be used as an entry-point for scripts."""
def main():
- args = cli_args()
check_db(args.databaseuri)
check_redis(args.redisuri)
if not args.rqtl2bundle.exists():
diff --git a/scripts/rqtl2/install_genotypes.py b/scripts/rqtl2/install_genotypes.py
index 77e7163..733ccf9 100644
--- a/scripts/rqtl2/install_genotypes.py
+++ b/scripts/rqtl2/install_genotypes.py
@@ -15,8 +15,8 @@ from r_qtl import r_qtl2 as rqtl2
from functional_tools import take
from scripts.rqtl2.entry import build_main
-from scripts.cli_parser import init_cli_parser
from scripts.rqtl2.cli_parser import add_common_arguments
+from scripts.cli_parser import init_cli_parser, add_global_data_arguments
stderr_handler = logging.StreamHandler(stream=sys.stderr)
logger = logging.getLogger("install_genotypes")
@@ -217,14 +217,14 @@ if __name__ == "__main__":
def cli_args():
"""Process command-line arguments for install_genotypes"""
- parser = add_common_arguments(init_cli_parser(
+ parser = add_common_arguments(add_global_data_arguments(init_cli_parser(
"install_genotypes",
- "Parse genotypes from R/qtl2 bundle into the database."))
+ "Parse genotypes from R/qtl2 bundle into the database.")))
return parser.parse_args()
main = build_main(
- cli_args,
+ cli_args(),
lambda dbconn, args: install_genotypes(dbconn,
args.speciesid,
args.populationid,
diff --git a/scripts/rqtl2/install_phenos.py b/scripts/rqtl2/install_phenos.py
index 5c25866..21b5f00 100644
--- a/scripts/rqtl2/install_phenos.py
+++ b/scripts/rqtl2/install_phenos.py
@@ -10,8 +10,8 @@ import MySQLdb as mdb
from MySQLdb.cursors import DictCursor
from scripts.rqtl2.entry import build_main
-from scripts.cli_parser import init_cli_parser
from scripts.rqtl2.cli_parser import add_common_arguments
+from scripts.cli_parser import init_cli_parser, add_global_data_arguments
from r_qtl import r_qtl2 as rqtl2
@@ -143,9 +143,9 @@ if __name__ == "__main__":
def cli_args():
"""Process command-line arguments for `install_phenos`"""
- parser = init_cli_parser(
+ parser = add_global_data_arguments(init_cli_parser(
"install_genotypes",
- "Parse genotypes from R/qtl2 bundle into the database.")
+ "Parse genotypes from R/qtl2 bundle into the database."))
parser.add_argument(
"platformid",
@@ -156,7 +156,7 @@ if __name__ == "__main__":
return parser.parse_args()
main = build_main(
- cli_args,
+ cli_args(),
lambda dbconn, args: install_pheno_files(dbconn,
args.speciesid,
args.platformid,