Ejemplo n.º 1
0
def get_arguments(program):
    """ Get arguments for specified program """
    if program == 'species':
        args = species_arguments()
    elif program == 'genes':
        args = gene_arguments()
    elif program == 'snps':
        args = snp_arguments()
    else:
        sys.exit("\nError: Unrecognized program: '%s'\n" % program)
    utility.add_executables(args)
    return args
Ejemplo n.º 2
0
        "Maximum number of genomes to process per species (use all).\nUseful for quick tests"
    )
    args = vars(parser.parse_args())
    return args


def check_args(args):
    if not os.path.isdir(args['outdir']):
        os.mkdir(args['outdir'])
    if not os.path.isdir(args['indir']):
        sys.exit(
            "\nError: could not locate directory specified by --genomes: %s\n"
            % args['indir'])
    if not os.path.isfile(args['mapfile']):
        sys.exit(
            "\nError: could not locate file specified by --mapping: %s\n" %
            args['mapfile'])
    for program in ['hmmsearch', 'vsearch']:
        if not utility.which(program):
            error = "\nError: program '%s' not found in your PATH" % program
            error += "\nMake sure that you've installed the program and added it's location to your PATH\n"
            sys.exit(error)


if __name__ == "__main__":
    args = fetch_arguments()
    utility.add_executables(args)
    check_args(args)
    utility.print_copyright()
    build_db.run_pipeline(args)