Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = []
for a in asset_names:
asset_dict = {"genome": args.genome, "asset": a, "tag": None, "seek_key": None}
asset_path = os.path.relpath(os.path.join(assets_path, a), rgc.genome_folder)
if refgenie_add(rgc, asset_dict, asset_path):
processed.append("{}/{}".format(asset_dict["genome"], asset_dict["asset"]))
print("Added assets: \n- {}".format("\n- ".join(processed)))