aboutsummaryrefslogtreecommitdiff
path: root/scripts/rqtl2/install_phenos.py
blob: b532dadcdd89fa0c6cbab5d77cce2e1df6963140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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())