aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-15 06:08:46 +0300
committerFrederick Muriuki Muriithi2024-01-15 06:08:46 +0300
commit84d736187c301332a72296caeb2bc68f1a3c4284 (patch)
tree80a8e9c8501922871e48bf43d15a1cb420aaf4d1 /scripts
parent8fe991c20f27702ee34ffcdd0cbc96e411db8c90 (diff)
downloadgn-uploader-84d736187c301332a72296caeb2bc68f1a3c4284.tar.gz
Initialise `install_phenos` script.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rqtl2/install_phenos.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/rqtl2/install_phenos.py b/scripts/rqtl2/install_phenos.py
new file mode 100644
index 0000000..b532dad
--- /dev/null
+++ b/scripts/rqtl2/install_phenos.py
@@ -0,0 +1,57 @@
+"""Load pheno from R/qtl2 bundle into the database."""
+import sys
+import logging
+# import traceback
+from pathlib import Path
+
+import MySQLdb as mdb
+
+from scripts.rqtl2.entry import build_main
+from scripts.cli_parser import init_cli_parser
+from scripts.rqtl2.cli_parser import add_common_arguments
+
+stderr_handler = logging.StreamHandler(stream=sys.stderr)
+logger = logging.getLogger("install_phenos")
+logger.addHandler(stderr_handler)
+
+def install_pheno_files(_dbconn: mdb.Connection,
+ _speciesid: int,
+ _populationid: int,
+ _platformid: int,
+ _studyid: int,
+ _datasetid: int,
+ _rqtl2bundle: Path) -> int:
+ """Load data in `pheno` files and other related files into the database."""
+ logger.debug("WE ARE HERE!!!")
+ return 5
+
+if __name__ == "__main__":
+
+ def cli_args():
+ """Process command-line arguments for install_genotypes"""
+ parser = init_cli_parser(
+ "install_genotypes",
+ "Parse genotypes from R/qtl2 bundle into the database.")
+
+ parser.add_argument(
+ "platformid",
+ help="The platform from which the data was generated.")
+ parser.add_argument("studyid",
+ help="The study to which the data belongs.")
+
+ parser = add_common_arguments(parser)
+
+ return parser.parse_args()
+
+ main = build_main(
+ cli_args,
+ lambda dbconn, args: install_pheno_files(dbconn,
+ args.speciesid,
+ args.populationid,
+ args.platformid,
+ args.studyid,
+ args.datasetid,
+ args.rqtl2bundle),
+ logger,
+ "DEBUG")
+ sys.exit(main())