# HG changeset patch
# User iuc
# Date 1708543613 0
# Node ID e1502e4f872546731217a97ec9130648434e2240
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_omamer commit 8ff9ada22d22cb94ddfff51bcdd3ab7d30104f1a
diff -r 000000000000 -r e1502e4f8725 data_manager/macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/macros.xml Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,8 @@
+
+
+
+ python
+ requests
+
+
+
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 data_manager/omamer.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/omamer.py Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+
+import argparse
+import json
+import os
+import sys
+from pathlib import Path
+
+import requests
+
+# URL for downloading OMAmer datasets
+OMAMER_DATASETS_URL = "https://omabrowser.org/All/{dataset}"
+
+# List of OMAmer data sets with versions
+OMAMER_DATASETS = {
+ "Primates": "Primates-v2.0.0.h5",
+ "Viridiplantae": "Viridiplantae-v2.0.0.h5",
+ "Metazoa": "Metazoa-v2.0.0.h5",
+ "LUCA": "LUCA-v0.2.5.h5",
+}
+
+
+DEFAULT_OUTPUT_DIR = "database_omamer"
+
+
+def download_file(url, dest):
+ try:
+ with requests.get(url, stream=True) as r:
+ r.raise_for_status()
+ with open(dest, 'wb') as f:
+ for chunk in r.iter_content(chunk_size=8192):
+ f.write(chunk)
+ print(f"Downloaded: {url} to {dest}")
+ except requests.exceptions.RequestException as e:
+ print(f"Error downloading {url}: {e}")
+ sys.exit(1)
+
+
+def main(args):
+ # Set output directory to default
+ output_dir = DEFAULT_OUTPUT_DIR
+
+ # Create output directory if none exists
+ if not os.path.exists(output_dir):
+ os.makedirs(output_dir)
+
+ # Check if the selected dataset exists
+ if args.name not in OMAMER_DATASETS:
+ print(f"Error: Selected dataset '{args.name}' not found.")
+ sys.exit(1)
+
+ # Download the selected OMAmer dataset
+ dataset = OMAMER_DATASETS[args.name]
+ url = OMAMER_DATASETS_URL.format(dataset=dataset)
+ base_name = os.path.splitext(dataset)[0]
+ destination_path = os.path.join(output_dir, base_name)
+ download_file(url, destination_path)
+
+ data_manager_entry = {
+ "value": os.path.splitext(os.path.basename(base_name))[0],
+ "name": os.path.splitext(os.path.basename(base_name))[0],
+ "version": "2.0.2",
+ "path": str(Path(output_dir)),
+ }
+
+ # Creates a JSON dictionary representing the Data Manager configuration
+ data_manager_json = {"data_tables": {"omamer_data": [data_manager_entry]}}
+
+ # Writes this JSON dictionary to the specified output file
+ with open(args.json, "w") as fh:
+ json.dump(data_manager_json, fh, indent=2, sort_keys=True)
+
+
+if __name__ == "__main__":
+ # Set up argparse to specify expected command line arguments
+ parser = argparse.ArgumentParser(description='Download data for OMAmer')
+ parser.add_argument('--name', default='Primates', choices=OMAMER_DATASETS.keys(), help='Select dataset to download')
+ parser.add_argument('--json', help='Path to JSON file')
+
+ args = parser.parse_args()
+
+ main(args)
diff -r 000000000000 -r e1502e4f8725 data_manager/omamer.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/omamer.xml Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,46 @@
+
+
+ macros.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10.1093/bioinformatics/btab219
+
+
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 data_manager/test.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/test.json Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,12 @@
+{
+ "data_tables": {
+ "omamer_data": [
+ {
+ "name": "Primates-v2.0",
+ "path": "database_omamer",
+ "value": "Primates-v2.0",
+ "version": "2.0.2"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 data_manager_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_conf.xml Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 test-data/omamer.loc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/omamer.loc Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,8 @@
+# this is a tab separated file describing the location of OMAmer databases used for the
+# OMAmer annotation tool
+#
+# the columns are:
+# value name version path
+#
+# for example
+# Primates-v2.0.0 Primates 2.0.2 /tmp/database/omamer/database_omamer/Primates-v2.0.0
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 tool-data/omamer.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/omamer.loc.sample Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,8 @@
+# this is a tab separated file describing the location of OMAmer databases used for the
+# OMAmer annotation tool
+#
+# the columns are:
+# value name version path
+#
+# for example
+# Primates-v2.0.0 Primates 2.0.2 /tmp/database/omamer/database_omamer/Primates-v2.0.0
\ No newline at end of file
diff -r 000000000000 -r e1502e4f8725 tool_data_table_conf.xml.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,6 @@
+
+
+ value, name, version, path
+
+
+
diff -r 000000000000 -r e1502e4f8725 tool_data_table_conf.xml.test
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test Wed Feb 21 19:26:53 2024 +0000
@@ -0,0 +1,6 @@
+
+
+ value, name, version, path
+
+
+
\ No newline at end of file