def install_annotation_files(anno_root_dir, dl_files=False, extra=None): """Download required annotation files. """ # create the full gemini data path based on # the root dir the user provided if anno_root_dir.endswith(("gemini/data", "gemini/data/", "gemini_data")): anno_dir = anno_root_dir elif anno_root_dir.endswith(("gemini", "gemini/")): anno_dir = os.path.join(anno_root_dir, "data") else: anno_dir = os.path.join(anno_root_dir, "gemini", "data") cur_config = read_gemini_config(allow_missing=True) cur_config["annotation_dir"] = os.path.abspath(anno_dir) cur_config["versions"] = anno_versions write_gemini_config(cur_config) if dl_files: if not os.path.exists(anno_dir): os.makedirs(anno_dir) if not os.path.isdir(anno_dir): sys.exit(anno_dir + " is not a valid directory.") _check_dependencies() to_dl = anno_files[:] if extra: to_dl += [extra_anno_files[x] for x in extra] _download_anno_files("https://s3.amazonaws.com/gemini-annotations", to_dl, anno_dir, cur_config)
def install_annotation_files(anno_root_dir): """Download required annotation files. """ # create the full gemini data path based on # the root dir the user provided if anno_root_dir.endswith(("gemini", "gemini/")): anno_dir = os.path.join(anno_root_dir, "data") else: anno_dir = os.path.join(anno_root_dir, "gemini", "data") if not os.path.exists(anno_dir): os.makedirs(anno_dir) cur_config = read_gemini_config(allow_missing=True) # download and install each of the annotation files for orig in anno_files: if orig.endswith(".gz"): dls = [orig, "%s.tbi" % orig] else: dls = [orig] for dl in dls: url = "http://people.virginia.edu/~arq5x/files/gemini/annotations/{fname}".format(fname=dl) _download_to_dir(url, anno_dir, anno_versions.get(orig, 1), cur_config.get("versions", {}).get(orig, 1)) cur_config["annotation_dir"] = anno_dir cur_config["versions"] = anno_versions write_gemini_config(cur_config)
def _download_anno_files(base_url, file_names, anno_dir, cur_config): """Download and install each of the annotation files """ for orig in file_names: if orig.endswith(".gz"): dls = [orig, "%s.tbi" % orig] else: dls = [orig] for dl in dls: url = "{base_url}/{fname}".format(fname=dl, base_url=base_url) _download_to_dir(url, anno_dir, anno_versions.get(orig, 1), cur_config.get("versions", {}).get(orig, 1)) cur_config["annotation_dir"] = anno_dir cur_config["versions"] = anno_versions write_gemini_config(cur_config)
def _download_anno_files(base_url, file_names, anno_dir, cur_config): """Download and install each of the annotation files """ cur_config["annotation_dir"] = os.path.abspath(anno_dir) cur_config["versions"] = anno_versions write_gemini_config(cur_config) for orig in file_names: if orig.endswith(".gz"): dls = [orig, "%s.tbi" % orig] else: dls = [orig] for dl in dls: url = "{base_url}/{fname}".format(fname=dl, base_url=base_url) _download_to_dir(url, anno_dir, anno_versions.get(orig, 1), cur_config.get("versions", {}).get(orig, 1))
def install_annotation_files(anno_root_dir): """Download required annotation files. """ # create the full gemini data path based on # the root dir the user provided if anno_root_dir.endswith(("gemini", "gemini/")): anno_dir = os.path.join(anno_root_dir, "data") else: anno_dir = os.path.join(anno_root_dir, "gemini", "data") if not os.path.exists(anno_dir): os.makedirs(anno_dir) cur_config = read_gemini_config(allow_missing=True) cur_config["annotation_dir"] = anno_dir write_gemini_config(cur_config) # download and install each of the annotation files for dl in anno_files: url = "http://people.virginia.edu/~arq5x/files/gemini/annotations/{fname}".format( fname=dl) _download_to_dir(url, anno_dir)