diff --git a/docs/changelog.md b/docs/changelog.md index fc6179f3..45f58ce9 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format. +## [0.9.2] - 2020-08-19 + +### Added +- in `pull` the genome description is fetched from the server + ## [0.9.1] - 2020-07-29 ### Added diff --git a/refgenconf/_version.py b/refgenconf/_version.py index d69d16e9..380d35b3 100644 --- a/refgenconf/_version.py +++ b/refgenconf/_version.py @@ -1 +1 @@ -__version__ = "0.9.1" +__version__ = "0.9.2" \ No newline at end of file diff --git a/refgenconf/const.py b/refgenconf/const.py index eed4c7f2..075a8d9a 100644 --- a/refgenconf/const.py +++ b/refgenconf/const.py @@ -28,6 +28,8 @@ API_ID_ARCHIVE = CUSTOM_PFX + "_archive" API_ID_DEFAULT_TAG = CUSTOM_PFX + "_default_tag" API_ID_ASSET_ATTRS = CUSTOM_PFX + "_asset_attrs" +API_ID_GENOME_ATTRS = "download_genome_attributes_v2_genome__genome__get" # temporary, default operation ID assigned by FastAPI. Switch to custom once refgenieserver supports it +# API_ID_GENOME_ATTRS = CUSTOM_PFX + "_genome_attrs" API_ID_DIGEST = CUSTOM_PFX + "_asset_digest" API_ID_RECIPE = CUSTOM_PFX + "_asset_recipe" API_ID_LOG = CUSTOM_PFX + "_asset_log" @@ -38,14 +40,16 @@ # for systematic links generation in the splash pages OPERATION_IDS = { "asset": { - API_ID_ARCHIVE: "archive", API_ID_ASSET_ATTRS: "attributes", API_ID_DIGEST: "asset digest", - API_ID_ARCHIVE_DIGEST: "archive digest", API_ID_RECIPE: "build recipe", API_ID_LOG: "build log" + API_ID_ARCHIVE: "archive", API_ID_ASSET_ATTRS: "attributes", + API_ID_DIGEST: "asset digest", API_ID_ARCHIVE_DIGEST: "archive digest", + API_ID_RECIPE: "build recipe", API_ID_LOG: "build log" } } API_IDS = [ - "API_ID_ASSETS", "API_ID_ARCHIVE", "API_ID_DEFAULT_TAG", "API_ID_ASSET_ATTRS", "API_ID_DIGEST", - "API_ID_RECIPE", "API_ID_LOG", "API_ID_SPLASH", "API_ID_ARCHIVE_DIGEST" + "API_ID_ASSETS", "API_ID_ARCHIVE", "API_ID_DEFAULT_TAG", "API_ID_LOG", + "API_ID_DIGEST", "API_ID_RECIPE", "API_ID_ASSET_ATTRS", "API_ID_SPLASH", + "API_ID_ARCHIVE_DIGEST", "API_ID_GENOME_ATTRS" ] CFG_FOLDER_KEY = "genome_folder" diff --git a/refgenconf/refgenconf.py b/refgenconf/refgenconf.py index aa9a441c..045e3322 100755 --- a/refgenconf/refgenconf.py +++ b/refgenconf/refgenconf.py @@ -715,12 +715,12 @@ def _raise_unpack_error(): _LOGGER.debug("Determined tag: {}".format(determined_tag)) unpack or _raise_unpack_error() gat = [genome, asset, determined_tag] - url_attrs = get_json_url(server_url, API_ID_ASSET_ATTRS).format(genome=genome, asset=asset) + url_asset_attrs = get_json_url(server_url, API_ID_ASSET_ATTRS).format(genome=genome, asset=asset) + url_genome_attrs = get_json_url(server_url, API_ID_GENOME_ATTRS).format(genome=genome) url_archive = get_json_url(server_url, API_ID_ARCHIVE).format(genome=genome, asset=asset) try: - archive_data = _download_json(url_attrs, params={"tag": determined_tag}) - _LOGGER.debug("Determined server URL: {}".format(server_url)) + archive_data = _download_json(url_asset_attrs, params={"tag": determined_tag}) except DownloadJsonError: no_asset_json.append(server_url) if num_servers == len(self[CFG_SERVERS_KEY]): @@ -728,6 +728,9 @@ def _raise_unpack_error(): format(genome, asset, determined_tag, ", ".join(self[CFG_SERVERS_KEY]))) return _null_return() continue + else: + _LOGGER.debug("Determined server URL: {}".format(server_url)) + genome_archive_data = _download_json(url_genome_attrs) if sys.version_info[0] == 2: archive_data = asciify_json_dict(archive_data) @@ -826,6 +829,7 @@ def preserve(): shutil.move(os.path.join(tmpdir, asset), tag_dir) if os.path.isfile(filepath): os.remove(filepath) + if self.file_path: with self as rgc: [rgc.chk_digest_update_child(gat[0], x, "{}/{}:{}".format(*gat), server_url) @@ -833,12 +837,14 @@ def preserve(): rgc.update_tags(*gat, data={attr: archive_data[attr] for attr in ATTRS_COPY_PULL if attr in archive_data}) rgc.set_default_pointer(*gat) + rgc.update_genomes(genome=genome, data=genome_archive_data) else: [self.chk_digest_update_child(gat[0], x, "{}/{}:{}".format(*gat), server_url) for x in archive_data[CFG_ASSET_PARENTS_KEY] if CFG_ASSET_PARENTS_KEY in archive_data] self.update_tags(*gat, data={attr: archive_data[attr] for attr in ATTRS_COPY_PULL if attr in archive_data}) self.set_default_pointer(*gat) + self.update_genomes(genome=genome, data=genome_archive_data) self.run_plugins(POST_PULL_HOOK) return gat, archive_data, server_url diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index e6e60d21..502c6c28 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -3,5 +3,4 @@ pyyaml requests tqdm>=4.38.0 yacman>=0.6.9 -future pyfaidx \ No newline at end of file