Exemplo n.º 1
0
def argument_parser(args):
    parser = argparse.ArgumentParser()  # pragma: no cover
    parser.add_argument(
        '-molecular_phenotypes',
        action='store_true',
        help='List all the molecular_phenotypes')  # pragma: no cover
    parser.add_argument('-molecular_phenotype',
                        help='List all the studies for a molecular_phenotype'
                        )  # pragma: no cover
    parser.add_argument('-studies',
                        action='store_true',
                        help='List all the studies')  # pragma: no cover
    parser.add_argument(
        '-study',
        help='Will list \'trait: study\' if it exists')  # pragma: no cover
    parser.add_argument('-tissues',
                        action='store_true',
                        help='List all the tissues')  # pragma: no cover
    parser.add_argument(
        '-tissue',
        help='Will list \'study: tissue\' if it exists')  # pragma: no cover
    parser.add_argument(
        '-chromosomes',
        action='store_true',
        help='Will list all the chromosomes')  # pragma: no cover
    parser.add_argument('-genes',
                        action='store_true',
                        help='List all the genes')  # pragma: no cover
    properties_handler.set_properties()  # pragma: no cover

    return parser.parse_args(args)  # pragma: no cover
Exemplo n.º 2
0
def argument_parser(args):
    parser = argparse.ArgumentParser()  # pragma: no cover
    parser.add_argument('-study',
                        help='The study to be deleted')  # pragma: no cover
    properties_handler.set_properties()  # pragma: no cover

    return parser.parse_args(args)  # pragma: no cover
Exemplo n.º 3
0
def argument_parser(args):
    parser = argparse.ArgumentParser()  # pragma: no cover
    parser.add_argument(
        '-path', help='Full path to the dir where the h5files will be stored'
    )  # pragma: no cover
    parser.add_argument(
        '-all',
        action='store_true',
        help='Use argument if you want to search for all associations'
    )  # pragma: no cover
    parser.add_argument(
        '-start',
        help='Index of the first association retrieved')  # pragma: no cover
    parser.add_argument(
        '-size', help='Number of retrieved associations')  # pragma: no cover
    parser.add_argument('-trait',
                        help='The trait I am looking for')  # pragma: no cover
    parser.add_argument('-study',
                        help='The study I am looking for')  # pragma: no cover
    parser.add_argument('-snp',
                        help='The SNP I am looking for')  # pragma: no cover
    parser.add_argument(
        '-chr', help='The chromosome I am looking for')  # pragma: no cover
    parser.add_argument(
        '-pval',
        help='Filter by pval threshold: -pval floor:ceil')  # pragma: no cover
    parser.add_argument(
        '-bp',
        help='Filter with baise pair location threshold: -bp floor:ceil'
    )  # pragma: no cover

    properties_handler.set_properties()  # pragma: no cover

    return parser.parse_args(args)  # pragma: no cover
def register(logger_name):
    set_p.set_properties()

    properties.LOG_CONF['loggers'][logger_name] = {
        'handlers': ['logger'],
        'propagate': False
    }
    LOG_CONF = set_log_path(properties)
    logging.config.dictConfig(LOG_CONF)
Exemplo n.º 5
0
def argument_parser(args):
    parser = argparse.ArgumentParser()  # pragma: no cover
    parser.add_argument(
        '-path', help='Full path to the dir where the h5files will be stored'
    )  # pragma: no cover
    parser.add_argument(
        '-all',
        action='store_true',
        help='Use argument if you want to search for all associations'
    )  # pragma: no cover
    parser.add_argument(
        '-start',
        help='Index of the first association retrieved')  # pragma: no cover
    parser.add_argument(
        '-size', help='Number of retrieved associations')  # pragma: no cover
    parser.add_argument('-trait',
                        help='The trait I am looking for')  # pragma: no cover
    parser.add_argument('-gene',
                        help='The gene I am looking for')  # pragma: no cover
    parser.add_argument('-study',
                        help='The study I am looking for')  # pragma: no cover
    parser.add_argument('-tissue',
                        help='The tissue I am looking for')  # pragma: no cover
    parser.add_argument(
        '-qtl_group',
        help='The QTL group/context I am looking for')  # pragma: no cover
    parser.add_argument('-snp',
                        help='The SNP I am looking for')  # pragma: no cover
    parser.add_argument(
        '-chr', help='The chromosome I am looking for')  # pragma: no cover
    parser.add_argument(
        '-pval',
        help='Filter by pval threshold: -pval floor:ceil')  # pragma: no cover
    parser.add_argument(
        '-bp',
        help='Filter with baise pair location threshold: -bp floor:ceil'
    )  # pragma: no cover
    parser.add_argument('-quant_method',
                        help='The quantification method',
                        choices=['ge', 'tx', 'txrev', 'microarray', 'exon'],
                        default='ge',
                        required=False)  # pragma: no cover
    parser.add_argument(
        '-paginate',
        help=
        'Sets paginate to "False" if you would like to fetch all associations for your query',
        type=au.str2bool,
        nargs='?',
        const=True,
        default=True)  # pragma: no cover

    properties_handler.set_properties()  # pragma: no cover

    return parser.parse_args(args)  # pragma: no cover
Exemplo n.º 6
0
def argument_parser(args):
    parser = argparse.ArgumentParser()  # pragma: no cover
    parser.add_argument('-traits',
                        action='store_true',
                        help='List all the traits')  # pragma: no cover
    parser.add_argument('-studies',
                        action='store_true',
                        help='List all the studies')  # pragma: no cover
    parser.add_argument(
        '-study',
        help='Will list \'trait: study\' if it exists')  # pragma: no cover
    properties_handler.set_properties()  # pragma: no cover

    return parser.parse_args(args)  # pragma: no cover
Exemplo n.º 7
0
def set_properties():
    set_p.set_properties()
Exemplo n.º 8
0
def main():
    argparser = argparse.ArgumentParser()
    argparser.add_argument(
        '-f',
        help='The path to the summary statistics file to be processed',
        required=False)
    argparser.add_argument(
        '-var',
        help='The path to the variant/genotype metadata file',
        required=False)
    argparser.add_argument(
        '-phen',
        help='The path to the trait/phenotype metadata file',
        required=False)
    argparser.add_argument('-expr',
                           help='The path to the gene expression file',
                           default=None,
                           required=False)
    argparser.add_argument('-study',
                           help='The study identifier',
                           required=False)
    argparser.add_argument('-qtl_group',
                           help='The qtl group e.g. "LCL"',
                           required=False)
    argparser.add_argument('-quant',
                           help='The quantification method e.g. "gene counts"',
                           required=False)
    argparser.add_argument('-tissue', help='The tissue', required=False)
    argparser.add_argument('-chr',
                           help='The chromosome the data belongs to',
                           required=False)
    argparser.add_argument('-loader',
                           help='The loader type',
                           choices=['study', 'trait', 'study_info'],
                           default=None,
                           required=True)
    argparser.add_argument('-tissue_ont',
                           help='The tissue ontology term',
                           required=False)
    argparser.add_argument('-treatment', help='The treatment', required=False)
    argparser.add_argument('-treatment_ont',
                           help='The treatment ontology term',
                           required=False)
    argparser.add_argument('-condition_label',
                           help='The condition label e.g. "naive"',
                           required=False)
    argparser.add_argument(
        '-metadata',
        help=
        'path to tsv containing metadata for the study. Columns "filename", "study", "qtl_group", "tissue_ont", "quant" must be present and will override/replace and of the cmd line arguments given. "filename" refers the basename of the summary statistics file that was passed to the "-f" parameter',
        required=False)

    args = argparser.parse_args()

    properties_handler.set_properties()  # pragma: no cover
    h5files_path = properties.h5files_path  # pragma: no cover
    tsvfiles_path = properties.tsvfiles_path  # pragma: no cover
    database = properties.sqlite_path
    chr_dir = properties.chr_dir
    trait_dir = properties.trait_dir
    study_dir = properties.study_dir

    ss_file = args.f
    var_file = args.var
    phen_file = args.phen
    study = args.study
    qtl_group = args.qtl_group
    quant_method = args.quant
    tissue = args.tissue
    expr_file = args.expr
    loader_type = args.loader
    chromosome = args.chr
    tissue_ont = args.tissue_ont
    treatment = args.treatment
    treatment_ont = args.treatment_ont
    condition_label = args.condition_label
    metadata = args.metadata

    if metadata is not None:
        study, qtl_group, quant_method, tissue_ont = update_metadate_from_tsv(
            metadata, ss_file)

    print(study, qtl_group, quant_method, tissue_ont)

    if loader_type == 'study':
        if chromosome is None:
            print("You must specify the '-chr'...exiting")
        else:
            loader = Loader(tsv=ss_file,
                            expr_file=expr_file,
                            var_file=var_file,
                            qtl_group=qtl_group,
                            quant_method=quant_method,
                            study_dir=study_dir,
                            study=study,
                            trait=phen_file,
                            hdf_path=h5files_path,
                            chromosome=chromosome,
                            sqldb=database,
                            loader=loader_type)
            #loader = Loader(filename, tsvfiles_path, chr_dir, study_dir, study, traits, h5files_path, chromosome, database, loader_type)
            loader.load_bystudy()
    elif loader_type == 'trait':
        loader = Loader(trait=phen_file,
                        hdf_path=h5files_path,
                        loader=loader_type,
                        trait_dir=trait_dir)
        loader.load_traits()
    elif loader_type == "study_info":
        loader = Loader(qtl_group=qtl_group,
                        quant_method=quant_method,
                        study=study,
                        sqldb=database,
                        trait=phen_file,
                        loader=loader_type,
                        tissue=tissue,
                        tissue_ont=tissue_ont,
                        treatment=treatment,
                        treatment_ont=treatment_ont,
                        condition_label=condition_label)
        #loader = Loader(filename, tsvfiles_path, chr_dir, study_dir, study, traits, h5files_path, chromosome, database, loader_type)
        loader.load_study_info()
    else:
        print("You must specify the '-loader'...exiting")