changeset 0:3658cf4b6fd2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_staramr commit 45daaecba3332d984a900727bf348ffb07a07154
author iuc
date Thu, 16 Jan 2025 08:28:55 +0000
parents
children 0b367fda55da
files data_manager/data_manager_build_staramr_download.xml data_manager_conf.xml test-data/staramr_database.loc.test tool-data/staramr_database.loc.sample tool_data_table_conf.xml.sample tool_data_table_conf.xml.test
diffstat 6 files changed, 172 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/data_manager_build_staramr_download.xml	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,117 @@
+<tool id="data_manager_build_staramr" name="Download and build StarAMR database" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" tool_type="manage_data" profile="@PROFILE@">
+    <description></description>
+    <macros>
+        <token name="@TOOL_VERSION@">0.10.0</token>
+        <token name="@VERSION_SUFFIX@">0</token>
+        <token name="@PROFILE@">22.05</token>
+        <xml name="element_assert" token_name="" token_text="">
+            <element name="@NAME@">
+                <assert_contents>
+                    <has_text text="@TEXT@"/>
+                    <yield/>
+                </assert_contents>
+            </element>
+        </xml>
+    </macros>
+    <requirements>
+        <requirement type="package" version="@TOOL_VERSION@">staramr</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+#set $resfinder_commit = str($resfinder_database_select).split('_')[-2]
+
+#set $plasmidfinder_commit = str($plasmidfinder_database_select).split('_')[-2]
+
+#set $pointfinder_commit = str($pointfinder_database_select).split('_')[-2]
+mkdir -p '$out_file.extra_files_path' &&
+staramr db build 
+    --dir resfinder_${resfinder_commit}_pointfinder_${pointfinder_commit}_plasmidfinder_${plasmidfinder_commit}
+    --resfinder-commit $resfinder_commit
+    --pointfinder-commit $pointfinder_commit
+    --plasmidfinder-commit $plasmidfinder_commit &&
+mv resfinder_${resfinder_commit}_pointfinder_${pointfinder_commit}_plasmidfinder_${plasmidfinder_commit} '$out_file.extra_files_path' &&
+cp '$dmjson' '$out_file'
+    ]]></command>
+    <configfiles>
+        <configfile name="dmjson"><![CDATA[
+#from datetime import date
+
+#set $resfinder_commit = str($resfinder_database_select).split('_')[-2]
+#set $resfinder_tag_commit_date = str($resfinder_database_select).split('_', 1)[1]
+
+#set $plasmidfinder_commit = str($plasmidfinder_database_select).split('_')[-2]
+#set $plasmidfinder_tag_commit_date = str($plasmidfinder_database_select).split('_', 1)[1]
+
+#set $pointfinder_commit = str($pointfinder_database_select).split('_')[-2]
+#set $pointfinder_tag_commit_date = str($pointfinder_database_select).split('_', 1)[1]
+
+{
+    "data_tables":{
+    "staramr_database":[
+    {
+        "value": "staramr_downloaded_#echo date.today().strftime('%d%m%Y')#_resfinder_${resfinder_commit}_pointfinder_${pointfinder_commit}_plasmidfinder_${plasmidfinder_commit}",
+        "name": "starAMR databases with ResFinder: ${resfinder_tag_commit_date}, PointFinder: ${pointfinder_tag_commit_date}, PlasmidFinder: ${plasmidfinder_tag_commit_date}",
+        "path": "resfinder_${resfinder_commit}_pointfinder_${pointfinder_commit}_plasmidfinder_${plasmidfinder_commit}",
+        "resfinder_commit": "${resfinder_commit}",
+        "pointfinder_commit": "${pointfinder_commit}",
+        "plasmidfinder_commit": "${plasmidfinder_commit}"
+    }
+    ]
+}
+        }]]></configfile>
+    </configfiles>
+    <inputs>
+        <param name="resfinder_database_select" type="select" label="Database version" help="Choose a database version to download">                   
+            <option value="resfinder_2.4.0_d1e607b_2024-08-06">ResFinder tag 2.4.0 (commit d1e607b) 2024-08-06</option>
+            <option value="resfinder_2.3.1_c8c38c3_2024-03-22">ResFinder tag 2.3.1 (commit c8c38c3) 2024-03-22</option>
+            <option value="resfinder_2.3.0_16d7fd3_2023-03-08">ResFinder tag 2.3.0 (commit 16d7fd3) 2023-03-08</option>
+            <option value="resfinder_2.2.1_208efbd_2023-10-27">ResFinder tag 2.2.1 (commit 208efbd) 2023-10-27</option>
+            <option value="resfinder_2.1.1_1a53e55_2023-05-31">ResFinder tag 2.1.1 (commit 1a53e55) 2023-05-31</option>
+            <option value="resfinder_2.1.0_c0cab25_2023-03-03">ResFinder tag 2.1.0 (commit c0cab25) 2023-03-03</option>
+            <option value="resfinder_2.0.2_18e3988_2023-02-08">ResFinder tag 2.0.2 (commit 18e3988) 2023-02-08</option>
+            <option value="resfinder_2.0.1_8306696_2023-01-16">ResFinder tag 2.0.1 (commit 8306696) 2023-01-16</option>
+            <option value="resfinder_2.0.0_585ec75_2022-10-13">ResFinder tag 2.0.0 (commit 585ec75) 2022-10-13</option>
+        </param>
+        <param name="pointfinder_database_select" type="select" label="Database version" help="Choose a database version to download">                   
+            <option value="pointfinder_4.1.1_694919f_2024-08-08">PointFinder tag 4.1.1 (commit 694919f) 2024-08-08</option>
+            <option value="pointfinder_4.1.0_9d55d02_2024-03-08">PointFinder tag 4.1.0 (commit 9d55d02) 2024-03-08</option>
+            <option value="pointfinder_4.0.1_b6e9e0b_2023-11-02">PointFinder tag 4.0.1 (commit b6e9e0b) 2023-11-02</option>
+            <option value="pointfinder_3.0.1_cb7806f_2023-05-31">PointFinder tag 3.0.1 (commit cb7806f) 2023-05-31</option>
+            <option value="pointfinder_3.0.0_3556bad_2023-01-18">PointFinder tag 3.0.0 (commit 3556bad) 2023-01-18</option>
+            <option value="pointfinder_2.0.1_0b281b0_2023-01-18">PointFinder tag 2.0.1 (commit 0b281b0) 2023-01-18</option>
+            <option value="pointfinder_2.0.0_afbc82d_2022-10-13">PointFinder tag 2.0.0 (commit afbc82d) 2022-10-13</option>
+        </param>
+        <param name="plasmidfinder_database_select" type="select" label="Database version" help="Choose a database version to download">                   
+            <option value="plasmidfinder_3e77502_2024-03-07">PlasmidFinder (commit 3e77502) 2024-03-07</option>
+            <option value="plasmidfinder_81c11f4_2023-12-04">PlasmidFinder (commit 81c11f4) 2024-12-04</option>
+            <option value="plasmidfinder_314d85f_2023-03-17">PlasmidFinder (commit 314d85f) 2023-03-17</option>
+            <option value="plasmidfinder_2.1_1307168_2019-08-28">PlasmidFinder tag 2.1 (commit 1307168) 2019-08-28</option>
+        </param>
+    </inputs>
+    <outputs>
+        <data name="out_file" format="data_manager_json" label="${tool.name}"/>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="1">
+            <param name="resfinder_database_select" value="resfinder_2.4.0_d1e607b_2024-08-06" />
+            <param name="pointfinder_database_select" value="pointfinder_4.1.1_694919f_2024-08-08" />
+            <param name="plasmidfinder_database_select" value="plasmidfinder_3e77502_2024-03-07" />
+            <output name="out_file">
+                <assert_contents>
+                    <has_text text='"staramr_database":'/>
+                    <has_text_matching expression='"value": "staramr_downloaded_[0-9]{8}_resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502"'/>
+                    <has_text text='"name": "starAMR databases with ResFinder: 2.4.0_d1e607b_2024-08-06, PointFinder: 4.1.1_694919f_2024-08-08, PlasmidFinder: 3e77502_2024-03-07"'/>
+                    <has_text_matching expression='"path": "resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502"'/>
+                    <has_text text='"resfinder_commit": "d1e607b"'/>
+                    <has_text text='"pointfinder_commit": "694919f"'/>
+                    <has_text text='"plasmidfinder_commit": "3e77502"'/>
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+    <help><![CDATA[
+This tool downloads and builds the StarAMR databases.
+    ]]></help>
+    <citations>
+        <citation type="doi">10.3390/microorganisms10020292</citation>
+    </citations>
+</tool>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_conf.xml	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<data_managers>
+    <data_manager tool_file="data_manager/data_manager_build_staramr_download.xml" id="data_manager_build_staramr_download">
+        <data_table name="staramr_database">  <!-- Defines a Data Table to be modified. -->
+            <output> <!-- Handle the output of the Data Manager Tool -->
+                <column name="value"/>  <!-- columns that are going to be specified by the Data Manager Tool -->
+                <column name="name"/>  <!-- columns that are going to be specified by the Data Manager Tool -->
+                <column name="path" output_ref="out_file">
+                    <move type="directory">
+                        <source>${path}</source>
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">staramr/${path}</target>
+                    </move>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/staramr/${path}</value_translation>
+                    <value_translation type="function">abspath</value_translation>
+                </column>
+                <column name="resfinder_commit"/> <!-- columns that are going to be specified by the Data Manager Tool -->
+                <column name="pointfinder_commit"/> <!-- columns that are going to be specified by the Data Manager Tool -->
+                <column name="plasmidfinder_commit"/> <!-- columns that are going to be specified by the Data Manager Tool -->
+            </output>
+        </data_table>
+    </data_manager>
+</data_managers>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/staramr_database.loc.test	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,11 @@
+#This is a tab separated file describing the location of StarAMR databases 
+#used for the StarAMR tool
+#
+#file has this format (white space characters are TAB characters)
+#
+#The columns are:
+#value	name	path	resfinder_commit	pointfinder_commit	plasmidfinder_commit
+#
+#For example
+#staramr_downloaded_20241004_resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502	ResFinder: tag 4.6.0, commit d1e607b, 2024-08-06 - PointFinder: tag 4.1.1, commit 694919f, 2024-08-08 - PlasmidFinder: commit 3e77502, 2024-03-07 (downloaded 20241004)	/path/to/data	d1e607b	694919f	3e77502
+staramr_downloaded_13012025_resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502	starAMR databases with ResFinder: 2.4.0_d1e607b_2024-08-06, PointFinder: 4.1.1_694919f_2024-08-08, PlasmidFinder: 3e77502_2024-03-07	/tmp/tmpc6qeamum/galaxy-dev/tool-data/staramr/resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502	d1e607b	694919f	3e77502
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/staramr_database.loc.sample	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,10 @@
+#This is a tab separated file describing the location of StarAMR databases 
+#used for the StarAMR tool
+#
+#file has this format (white space characters are TAB characters)
+#
+#The columns are:
+#value	name	path	resfinder_commit	pointfinder_commit	plasmidfinder_commit
+#
+#For example
+#staramr_downloaded_20241004_resfinder_d1e607b_pointfinder_694919f_plasmidfinder_3e77502	ResFinder: tag 4.6.0, commit d1e607b, 2024-08-06 - PointFinder: tag 4.1.1, commit 694919f, 2024-08-08 - PlasmidFinder: commit 3e77502, 2024-03-07 (downloaded 20241004)	/path/to/data	d1e607b	694919f	3e77502
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,6 @@
+<tables>
+    <table name="staramr_database" comment_char="#">
+        <columns>value, name, path, resfinder_commit, pointfinder_commit, plasmidfinder_commit</columns>
+        <file path="tool-data/staramr_database.loc"/>
+    </table>
+</tables>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.test	Thu Jan 16 08:28:55 2025 +0000
@@ -0,0 +1,6 @@
+<tables>
+    <table name="staramr_database" comment_char="#">
+        <columns>value, name, path, resfinder_commit, pointfinder_commit, plasmidfinder_commit</columns>
+        <file path="${__HERE__}/test-data/staramr_database.loc.test"/>
+    </table>
+</tables>
\ No newline at end of file