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():
""" main workflow """
parser = build_argparser()
args, remaining_args = parser.parse_known_args()
cfg = select_config(args.config, refgenconf.CFG_ENV_VARS, check_exist=True, strict_env=True)
if not cfg:
raise MissingGenomeConfigError(args.config)
rgc = refgenconf.RefGenConf(filepath=cfg, writable=True)
pths = [args.path, mkabs(args.path, rgc.genome_folder)]
if not untar_or_copy(pths[0], os.path.join(rgc.genome_folder, args.genome)) \
and not untar_or_copy(pths[1], os.path.join(rgc.genome_folder, args.genome)):
rgc.unlock()
raise OSError("Path '{}' does not exist. Tried: {}".format(args.path, " and ".join(pths)))
path_components = [rgc.genome_folder] + [args.genome] + ["*"] * 3 + ["Sequence"]
assets_paths = glob(os.path.join(*path_components))
assert len(assets_paths) > 0, OSError("Your iGenomes directory is corrupted, more than one directory matched by {}."
"\nMatched dirs: {}".format(os.path.join(*path_components),
", ".join(assets_paths)))
assets_path = assets_paths[0]
asset_names = [d for d in os.listdir(assets_path) if os.path.isdir(assets_path)]
processed = []