Repository 'data_manager_fetch_ncbi_taxonomy'
hg clone https://toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_ncbi_taxonomy

Changeset 5:9de2fb1ce1fb (2020-11-22)
Previous changeset 4:d6acd5cd497b (2020-07-06) Next changeset 6:6dd9e00dea95 (2021-03-19)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_fetch_ncbi_taxonomy/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
modified:
data_manager/data_manager.py
data_manager/ncbi_taxonomy_fetcher.xml
tool-data/ncbi_taxonomy.loc.sample
added:
test-data/ncbi_taxonomy.loc
test-data/taxonomy.json
tool_data_table_conf.xml.test
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb data_manager/data_manager.py
--- a/data_manager/data_manager.py Mon Jul 06 20:06:21 2020 -0400
+++ b/data_manager/data_manager.py Sun Nov 22 12:48:48 2020 +0000
[
@@ -5,12 +5,7 @@
 import shutil
 import tarfile
 import zipfile
-try:
-    # For Python 3.0 and later
-    from urllib.request import Request, urlopen
-except ImportError:
-    # Fall back to Python 2 imports
-    from urllib2 import Request, urlopen
+from urllib.request import Request, urlopen
 
 
 def url_download(url, workdir):
@@ -50,14 +45,15 @@
     data_manager_entry['name'] = args.name
     data_manager_entry['path'] = '.'
     data_manager_json = dict(data_tables=dict(ncbi_taxonomy=data_manager_entry))
-    params = json.loads(open(args.output).read())
+    with open(args.output) as fh:
+        params = json.load(fh)
     target_directory = params['output_data'][0]['extra_files_path']
     os.mkdir(target_directory)
     output_path = os.path.abspath(os.path.join(os.getcwd(), 'taxonomy'))
     for filename in os.listdir(workdir):
         shutil.move(os.path.join(output_path, filename), target_directory)
-    with open(args.output, 'w') as out:
-        out.write(json.dumps(data_manager_json, sort_keys=True))
+    with open(args.output, 'w') as fh:
+        json.dump(data_manager_json, fh, sort_keys=True)
 
 
 if __name__ == '__main__':
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb data_manager/ncbi_taxonomy_fetcher.xml
--- a/data_manager/ncbi_taxonomy_fetcher.xml Mon Jul 06 20:06:21 2020 -0400
+++ b/data_manager/ncbi_taxonomy_fetcher.xml Sun Nov 22 12:48:48 2020 +0000
[
@@ -1,6 +1,9 @@
 <?xml version="1.0"?>
-<tool id="ncbi_taxonomy_fetcher" name="NCBI" tool_type="manage_data" version="1.0.1">
+<tool id="ncbi_taxonomy_fetcher" name="NCBI" tool_type="manage_data" version="1.0.2">
     <description>taxonomy downloader</description>
+    <requirements>
+        <requirement type="package" version="3.7">python</requirement>
+    </requirements>
     <command detect_errors="exit_code">
     <![CDATA[
         python '$__tool_directory__/data_manager.py' --out '${out_file}'
@@ -19,4 +22,15 @@
     <outputs>
         <data name="out_file" format="data_manager_json" />
     </outputs>
+    <tests>
+        <test>
+            <param name="database_name" value="tax_name"/>
+            <param name="database_id" value="tax_id"/>
+            <output name="out_file" value="taxonomy.json"/>
+        </test>
+    </tests>
+    <help>
+        Download a taxonomy dump from a provided URL.
+        The default URL is the latest dump from NCBI taxonomy.
+    </help>
 </tool>
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb test-data/ncbi_taxonomy.loc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/ncbi_taxonomy.loc Sun Nov 22 12:48:48 2020 +0000
b
@@ -0,0 +1,5 @@
+# Tab separated fields where
+# value is unique key
+# name is descriptive name
+# path is path to directory containing names.dmp and nodes.dmp files
+#value name path
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb test-data/taxonomy.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/taxonomy.json Sun Nov 22 12:48:48 2020 +0000
b
@@ -0,0 +1,1 @@
+{"data_tables": {"ncbi_taxonomy": {"name": "tax_name", "path": ".", "value": "tax_name"}}}
\ No newline at end of file
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb tool-data/ncbi_taxonomy.loc.sample
--- a/tool-data/ncbi_taxonomy.loc.sample Mon Jul 06 20:06:21 2020 -0400
+++ b/tool-data/ncbi_taxonomy.loc.sample Sun Nov 22 12:48:48 2020 +0000
b
@@ -2,4 +2,4 @@
 # value is unique key
 # name is descriptive name
 # path is path to directory containing names.dmp and nodes.dmp files
-#value name path
+#value name path
b
diff -r d6acd5cd497b -r 9de2fb1ce1fb tool_data_table_conf.xml.test
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test Sun Nov 22 12:48:48 2020 +0000
b
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<tables>
+    <!-- Locations of taxonomy data downloaded from NCBI -->
+    <table name="ncbi_taxonomy" comment_char="#">
+        <columns>value, name, path</columns>
+        <file path="${__HERE__}/test-data/ncbi_taxonomy.loc" />
+    </table>
+</tables>