Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
""" Primary workflow """
parser = logmuse.add_logging_options(build_argparser())
args, remaining_args = parser.parse_known_args()
global _LOGGER
_LOGGER = logmuse.logger_via_cli(args, make_root=True)
_LOGGER.debug("refgenie {}".format(__version__))
_LOGGER.debug("Args: {}".format(args))
if not args.command:
parser.print_help()
_LOGGER.error("No command given")
sys.exit(1)
gencfg = refgenconf.select_genome_config(filename=args.genome_config, check_exist=not args.command == INIT_CMD,
on_missing=lambda fp: fp, strict_env=True)
if gencfg is None:
raise MissingGenomeConfigError(args.genome_config)
_LOGGER.debug("Determined genome config: {}".format(gencfg))
# From user input we want to construct a list of asset dicts, where each
# asset has a genome name, asset name, and tag
def build_argparser():
"""
Builds argument parser.
:return argparse.ArgumentParser
"""
banner = "%(prog)s - reference genome asset manager"
additional_description = "\nhttps://refgenie.databio.org"
parser = VersionInHelpParser(
prog="refgenie",
version=__version__,
description=banner,
epilog=additional_description)
subparsers = parser.add_subparsers(dest="command")
def add_subparser(cmd, description):
return subparsers.add_parser(
cmd, description=description, help=description)
sps = {}
for cmd, desc in SUBPARSER_MESSAGES.items():
sps[cmd] = add_subparser(cmd, desc)
# It's required for init
sps[cmd].add_argument(
'-c', '--genome-config', required=(cmd == INIT_CMD), dest="genome_config",
help="Path to local genome configuration file. Optional if {} environment variable is set."