# HG changeset patch
# User iuc
# Date 1727959342 0
# Node ID 3b1d503c6260a7fdb805f263b568eac63dc13ef1
# Parent df84aaed476965ce0e03ab8383d3f27c76210760
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_gtdbtk_database_installer commit 671e8c706fa211b6ec1c476d3d1a36d098822fe5
diff -r df84aaed4769 -r 3b1d503c6260 data_manager/gtdbtk_database_installer.py
--- a/data_manager/gtdbtk_database_installer.py Mon Sep 09 09:01:39 2024 +0000
+++ b/data_manager/gtdbtk_database_installer.py Thu Oct 03 12:42:22 2024 +0000
@@ -7,7 +7,7 @@
import shutil
import sys
import tarfile
-from datetime import datetime
+from datetime import date
from urllib.parse import urlparse
from urllib.request import HTTPError, Request, urlopen
@@ -118,7 +118,19 @@
return target_directory
-def download(database_name, release, meta, test, out_file):
+def create_data_manager_entry(database_name, release, file_path):
+ time = date.today().strftime("%Y-%m-%d")
+ data_manager_entry = {}
+ data_manager_entry["value"] = (
+ f"{database_name.replace(' ', '_').lower()}_release_{release}_downloaded_{time}"
+ )
+ data_manager_entry["name"] = f"{database_name} - release {release} ({time})"
+ data_manager_entry["path"] = file_path
+ data_manager_entry["version"] = release
+ return data_manager_entry
+
+
+def download(release, meta, test, out_file):
with open(out_file) as fh:
params = json.load(fh)
@@ -137,72 +149,56 @@
for url in items.values():
assert is_urlfile(url)
- # download both taxonomy metadata tables
+ data_manager_json = {"data_tables": {}}
+
+ # download taxonomy metadata tables
if meta:
url = urls[release]["meta_ar"]
- file_path = url_download(url, target_directory, meta)
+ url_download(url, target_directory, meta)
url = urls[release]["meta_bac"]
file_path = url_download(url, target_directory, meta)
+
+ data_manager_json["data_tables"]["gtdbtk_database_metadata_versioned"] = [
+ create_data_manager_entry("Metadata Tables", release, file_path)
+ ]
# download the full DB
else:
url = urls[release]["full"]
file_path = url_download(url, target_directory, meta)
-
- time = datetime.utcnow().strftime("%Y-%m-%d")
-
- data_manager_json = {"data_tables": {}}
- data_manager_entry = {}
- data_manager_entry["value"] = f"{database_name}_release_{release}_downloaded_{time}"
- data_manager_entry["name"] = database_name
- data_manager_entry["path"] = file_path
- data_manager_entry["version"] = release
+ data_manager_json["data_tables"]["gtdbtk_database_versioned"] = [
+ create_data_manager_entry("Full Database", release, file_path)
+ ]
# store in dedicated metadata table
- if meta:
- data_manager_json["data_tables"][
- "gtdbtk_database_metadata_versioned"
- ] = data_manager_entry
- else:
- data_manager_json["data_tables"][
- "gtdbtk_database_versioned"
- ] = data_manager_entry
-
with open(out_file, "w") as fh:
json.dump(data_manager_json, fh, sort_keys=True)
-parser = argparse.ArgumentParser()
-
-parser.add_argument(
- "--database_name", dest="database_name", help="GTDB-Tk database display name"
-)
-
-parser.add_argument("--version", dest="version", help="DB version")
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
-parser.add_argument(
- "--release", dest="release", help="Release of the GTDB-Tk database version"
-)
-parser.add_argument("--out_file", dest="out_file", help="JSON output file")
-parser.add_argument(
- "--meta",
- dest="meta",
- action="store_true",
- help="Store meta data flag",
-)
+ parser.add_argument("--version", dest="version", help="DB version")
+ parser.add_argument(
+ "--release", dest="release", help="Release of the GTDB-Tk database version"
+ )
+ parser.add_argument("--out_file", dest="out_file", help="JSON output file")
+ parser.add_argument(
+ "--meta",
+ dest="meta",
+ action="store_true",
+ help="Store meta data flag",
+ )
+ parser.add_argument(
+ "--test",
+ dest="test",
+ action="store_true",
+ help="Run test",
+ )
+ args = parser.parse_args()
-parser.add_argument(
- "--test",
- dest="test",
- action="store_true",
- help="Run test",
-)
-
-args = parser.parse_args()
-
-download(
- args.database_name,
- args.release,
- args.meta,
- args.test,
- args.out_file,
-)
+ download(
+ args.release,
+ args.meta,
+ args.test,
+ args.out_file,
+ )
diff -r df84aaed4769 -r 3b1d503c6260 data_manager/gtdbtk_database_installer.xml
--- a/data_manager/gtdbtk_database_installer.xml Mon Sep 09 09:01:39 2024 +0000
+++ b/data_manager/gtdbtk_database_installer.xml Thu Oct 03 12:42:22 2024 +0000
@@ -2,7 +2,7 @@
202
- 2
+ 3
20.09
@@ -10,18 +10,16 @@
-
-
-
+
+
@@ -34,40 +32,36 @@
-
-
-
-
diff -r df84aaed4769 -r 3b1d503c6260 test-data/gtdbtk_database_metadata_versioned.loc
--- a/test-data/gtdbtk_database_metadata_versioned.loc Mon Sep 09 09:01:39 2024 +0000
+++ b/test-data/gtdbtk_database_metadata_versioned.loc Thu Oct 03 12:42:22 2024 +0000
@@ -2,4 +2,4 @@
# to use a directory of GTDB-Tk databases. The gtdbtk_databases.loc
# file has this format (longer white space characters are TAB characters):
#
-#
+#
\ No newline at end of file
diff -r df84aaed4769 -r 3b1d503c6260 test-data/gtdbtk_database_versioned.loc