changeset 0:c31256419bf6 draft

Uploaded
author greg
date Thu, 30 Jun 2022 21:07:03 +0000
parents
children 1415d5b25926
files .shed.yml data_manager/data_manager_dram_download.py data_manager/data_manager_dram_download.xml data_manager_conf.xml test-data/dram_databases.loc tool-data/dram_databases.loc.sample tool_data_table_conf.xml.sample tool_data_table_conf.xml.test
diffstat 7 files changed, 136 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.shed.yml	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,16 @@
+name: data_manager_dram_database_downloader
+owner: iuc
+description: DRAM for distilling microbial metabolism to automate the curation of microbiome function
+homepage_url: https://github.com/WrightonLabCSU/DRAM
+long_description: |
+  DRAM (Distilled and Refined Annotation of Metabolism) is a tool for annotating metagenomic assembled genomes
+  and VirSorter identified viral contigs. DRAM annotates MAGs and viral contigs using KEGG (if provided by the
+  user), UniRef90, PFAM, dbCAN, RefSeq viral, VOGDB and the MEROPS peptidase database as well as custom user
+  databases. DRAM is run in two stages. First an annotation step to assign database identifiers to gene and then a
+  distill step to curate these annotations into useful functional categories. Additionally viral contigs are further
+  analyzed during to identify potential AMGs. This is done via assigning an auxiliary score and flags representing the
+  confidence that a gene is both metabolic and viral.
+remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_dram_database_downloader
+type: unrestricted
+categories:
+- Data Managers
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/data_manager_dram_download.py	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+import datetime
+import json
+import os
+import subprocess
+import sys
+
+today = datetime.date.today()
+with open(sys.argv[1]) as fh:
+    params = json.load(fh)
+target_directory = params['output_data'][0]['extra_files_path']
+os.mkdir(target_directory)
+param_dict = params['param_dict']
+
+# Now DRAM-setup.py can be called to download the data.
+cmd = 'DRAM-setup.py prepare_database --dbcan_version %d --threads %d' % (param_dict['--dbcan_version'], param_dict['--threads'])
+if '--skip_uniref' in param_dict:
+    cmd = '%s --skip_uniref' % cmd
+else:
+    cmd = '%s --uniref_version %d' % param_dict['--uniref_version']
+if '--keep_database_files' in param_dict:
+    cmd = '%s --keep_database_files' % cmd
+
+subprocess.check_call(cmd, shell=True)
+
+# Prepare the metadata for the new data table record.
+data_manager_dict = {
+    'data_tables': {
+        'dram_versioned_databases': [
+            {
+                'value': today.isoformat(),
+                'version': param_dict['dram_db_version'],
+                'name': 'DRAM databases version %s' % param_dict['dram_db_version'],
+                'path': None
+            }
+        ]
+    }
+}
+
+# Save it to the json results file.
+with open(sys.argv[1], 'w') as fh:
+    json.dump(data_manager_dict, fh, sort_keys=True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/data_manager_dram_download.xml	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,39 @@
+<tool id="data_manager_dram_download" name="DRAM Download" version="@VERSION@" tool_type="manage_data">
+    <description>the annotation files required by the DRAM suite of tools</description>
+    <macros>
+        <token name="@VERSION@">1.3.5</token>
+    </macros>
+    <requirements>
+        <requirement type="package" version="@VERSION@">dram</requirement>
+    </requirements>
+    <command detect_errors="exit_code">
+python '$__tool_directory__/data_manager_dram_download.py'
+'${out_file}'
+--skip_uniref
+--uniref_version $uniref_version
+--dbcan_version $dbcan_version
+--keep_database_files
+--threads \${GALAXY_SLOTS:-10}
+    </command>
+    <inputs>
+        <param argument="--skip_uniref" type="boolean" truevalue="--skip_uniref" falsevalue="" checked="false" label="Download and process uniref?" help="Choosing No saves time and memory and does not impact DRAM distillation"/>
+        <param argument="--uniref_version" type="integer" value="90" label="UniRef version to download" help="Ignored if uniref is not processed"/>
+        <param argument="--dbcan_version" type="integer" value="10" label="Version of dbCAN to use"/>
+        <param argument="--keep_database_files" type="boolean" truevalue="--keep_database_files" falsevalue="" checked="false" label="Keep unprocessed database files"/>
+    </inputs>
+    <outputs>
+        <data name="out_file" format="data_manager_json"/>
+    </outputs>
+    <tests>
+    </tests>
+    <help>
+This tool downloads downloads and processes DRAM databases for annotation and makes them available to
+corresponding versions of the DRAM suite of tools.
+
+See https://github.com/WrightonLabCSU/DRAM/wiki for details about DRAM.
+    </help>
+    <citations>
+        <citation type="doi">10.1093/nar/gkaa621</citation>
+    </citations>
+</tool>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_conf.xml	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,20 @@
+<data_managers>
+    <data_manager tool_file="data_manager/data_manager_dram_download.xml" id="data_manager_dram_download">
+        <data_table name="dram_versioned_databases">
+            <output>
+                <column name="value"/>
+                <column name="version"/>
+                <column name="name">
+                <column name="path" output_ref="out_file" >
+                    <move type="directory" relativize_symlinks="True">
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">dram/${version}/${value}</target>
+                    </move>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/dram/${version}/${value}/</value_translation>
+                    <value_translation type="function">abspath</value_translation>
+                </column>
+            </output>
+        </data_table>
+    </data_manager>
+</data_managers>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/dram_databases.loc.sample	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,3 @@
+## DRAM databases
+#Value	Version	Name    Path
+#2022-07-04	1.3.5	DRAM annotations (2022-07-04)   /depot/data2/galaxy/tool-data/dram_databases/1.3.5/2022-07-04
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,8 @@
+<tables>
+    <!-- Locations of DRAM databases version 1.3.5 and higher -->
+    <table name="dram_databases" comment_char="#">
+        <columns>value, version, name, path</columns>
+        <file path="tool-data/dram_databases.loc" />
+    </table>
+</tables>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test	Thu Jun 30 21:07:03 2022 +0000
@@ -0,0 +1,7 @@
+<tables>
+    <!-- Location of DRAM databases version 1.3.5 and higher -->
+    <table name="dram_databases" comment_char="#">
+        <columns>value, version, name, path</columns>
+        <file path="${__HERE__}/test-data/dram_databases.loc" />
+    </table>
+</tables>