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
if "asset_registry_paths" in args and args.asset_registry_paths:
_LOGGER.debug("Found registry_path: {}".format(args.asset_registry_paths))
asset_list = [parse_registry_path(x) for x in args.asset_registry_paths]
for a in asset_list:
# every asset must have a genome, either provided via registry path
# or the args.genome arg.
if not a["genome"]:
def _add_resources(args, res, asset_dict=None):
"""
Add additional resources needed for pipeline.
:param argparse.Namespace args: binding between option name and argument,
e.g. from parsing command-line options
:param pm.config.resources res: pipeline manager resources list
:param asset_dict list: list of dictionary of assets to add
"""
rgc = RGC(select_genome_config(res.get("genome_config")))
key_errors = []
exist_errors = []
required_list = []
# Check that bowtie2 indicies exist for specified prealignments
for reference in args.prealignments:
for asset in [BT2_IDX_KEY]:
try:
res[asset] = rgc.seek(reference, asset)
except KeyError:
err_msg = "{} for {} is missing from REFGENIE config file."
pm.fail_pipeline(KeyError(err_msg.format(asset, reference)))
except:
err_msg = "{} for {} does not exist."
pm.fail_pipeline(IOError(err_msg.format(asset, reference)))