diff dynamic_tool_wrappers_macros.xml @ 0:d79569f269c7 draft

planemo upload
author mingchen0919
date Fri, 23 Mar 2018 01:53:24 -0400
parents
children ddc3c3527f49
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dynamic_tool_wrappers_macros.xml	Fri Mar 23 01:53:24 2018 -0400
@@ -0,0 +1,186 @@
+<macros>
+
+    <xml name="rmarkdown_requirements">
+        <requirement type="package" version="1.15.0.6-0">pandoc</requirement>
+        <requirement type="package" version="1.6">r-rmarkdown</requirement>
+        <requirement type="package" version="2.54a">star</requirement>
+    </xml>
+
+    <xml name="stdio">
+        <stdio>
+            <regex match="XXX" source="stderr" level="warning"
+                   description="Check the tool log output file for more details."/>
+        </stdio>
+    </xml>
+
+    <!--Tool name-->
+    <xml name="tool_name">
+        <param type="select" name="tool_name" multiple="false" label="Tool name">
+            <option value="STAR" selected="false">STAR</option>
+        </param>
+    </xml>
+
+    <!--OPTION/ARGUMENT PAIRS and INPUT types-->
+    <!--input files-->
+    <xml name="option_argument_one_dataset">
+        <repeat name="option_argument_one_dataset_repeat" title="OPTION and ARGUMENT: input one dataset" min="0" default="0">
+            <param type="text" name="flag" optional="true" label="flag" />
+            <param name="value" type="data" optional="true" multiple="false" label="value"/>
+        </repeat>
+    </xml>
+    <xml name="option_argument_multiple_datasets">
+        <repeat name="option_argument_multiple_datasets_repeat" title="OPTION and ARGUMENT: input multiple datasets" min="0" default="0">
+            <param type="text" name="flag" optional="true" label="flag" />
+            <param name="value" type="data" optional="true" multiple="true" label="value" />
+        </repeat>
+    </xml>
+    <xml name="option_argument_path_relative_to_upstream_tool">
+        <repeat name="option_argument_path_relative_to_upstream_tool_repeat" title="OPTION and ARGUMENT: path relative to upstream tool" min="0" default="0">
+            <param type="text" name="flag" optional="true" label="flag"  />
+            <param name="upstream_tool_output_dir" type="data" optional="true" multiple="false" label="upstream tool output directory"/>
+            <param type="text" name="value" optional="true" label="value"  />
+        </repeat>
+    </xml>
+
+    <!--input values: string, float and integer-->
+    <xml name="option_argument_string">
+        <repeat name="option_argument_string_repeat" title="OPTION and ARGUMENT: input string" min="0" default="0">
+            <param type="text" name="flag" label="flag"  />
+            <param type="text" name="value"  label="value"  />
+        </repeat>
+    </xml>
+    <xml name="option_argument_float">
+        <repeat name="option_argument_float_repeat" title="OPTION and ARGUMENT: input float" min="0" default="0">
+            <param type="text" name="flag" label="flag"  />
+            <param type="text" name="value" label="value"  />
+        </repeat>
+    </xml>
+    <xml name="option_argument_integer">
+        <repeat name="option_argument_integer_repeat" title="OPTION and ARGUMENT: input integer" min="0" default="0">
+            <param type="text" name="flag" label="flag"  />
+            <param type="text" name="value"  label="value"  />
+        </repeat>
+    </xml>
+
+    <!--output set-->
+    <xml name="output_set">
+        <data format="html" name="report" label="${tool.name} report"/>
+        <data format="txt" name="tool_help_doc" label="${tool.name} help doc"/>
+        <data format="txt" name="tool_output_dir" label="${tool.name} output directory"/>
+        <data format="txt" name="tool_log" label="${tool.name} log" />
+    </xml>
+
+
+    <!--shell command fragment-->
+    <xml name="shell_command">
+        <command><![CDATA[
+
+        ############ first, create a directory to store all files
+        mkdir -p $report.files_path && cd $report.files_path &&
+
+
+        ############ save the tool installation directory to an environment variable
+        export TOOL_INSTALL_DIR='${__tool_directory__}' &&
+
+
+        #########################
+        ##
+        ## save user input option/argument pairs into a file
+        ##
+        #########################
+
+        ## first line will be the header
+        echo 'type|flag|value' > options_and_arguments.txt &&
+
+        ############ tool_name
+        ##-t '$tool_name'
+        echo "tool_name|tool_flag|${tool_name}" >> options_and_arguments.txt &&
+
+        ####################################################
+        ## loop through repeats to get option/argument pairs
+        ####################################################
+
+        ############ option_argument_one_dataset
+        #for i in $option_argument_one_dataset_repeat:
+            #set $item = 'one_dataset|' + str($i.flag) + "|" + str($i.value)
+            echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+        ############ option_argument_multiple_datasets
+        #for i in $option_argument_multiple_datasets_repeat:
+            #set $item = 'multiple_datasets|' + str($i.flag) + "|" + str($i.value)
+            echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+        ############ option_argument_path_relative_to_upstream_tool
+        #for i in $option_argument_path_relative_to_upstream_tool_repeat:
+             #set $item = 'path_relative_to_upstream_tool|' + str($i.flag) + "|" + str($i.value)
+             echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+        ############ option_argument_string
+        #for i in $option_argument_string_repeat:
+             #set $item = 'string|' + str($i.flag) + "|" + str($i.value)
+             echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+        ############ option_argument_float
+        #for i in $option_argument_float_repeat:
+             #set $item = 'float|' + str($i.flag) + "|" + str($i.value)
+             echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+
+        ############ option_argument_integer
+        #for i in $option_argument_integer_repeat:
+             #set $item = 'integer|' + str($i.flag) + "|" + str($i.value)
+             echo '$item' >> options_and_arguments.txt &&
+        #end for
+
+
+        ############ output_set
+        ## '$report'
+        ## '$report.files_path'
+        ## '$tool_help_doc'
+        ## '$tool_output_dir'
+        ## '$tool_log'
+        #######################
+        export REPORT='$report' &&
+        export REPORT_FILES_PATH='$report.files_path' &&
+        export TOOL_HELP_DOC='$tool_help_doc' &&
+        export TOOL_OUTPUT_DIR='$tool_output_dir' &&
+        export TOOL_LOG='$tool_log' &&
+
+
+        ############ save tool files path to a tool output so that it can be accessed from galaxy history
+        echo '$report.files_path' > $tool_output_dir &&
+
+        ############ run render R script to render R markdowns
+        Rscript '${__tool_directory__}/dynamic_tool_render.R'
+
+        ]]></command>
+    </xml>
+
+    <!--tool citations-->
+    <xml name="citations">
+        <citation type="bibtex"><![CDATA[
+            @article{allaire2016rmarkdown,
+            title={rmarkdown: Dynamic Documents for R, 2016},
+            author={Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff
+            and Wickham, Hadley and Atkins, Aron and Hyndman, Rob},
+            journal={R package version 0.9},
+            volume={6},
+            year={2016}
+            }
+        ]]></citation>
+        <citation type="bibtex"><![CDATA[
+            @book{xie2015dynamic,
+            title={Dynamic Documents with R and knitr},
+            author={Xie, Yihui},
+            volume={29},
+            year={2015},
+            publisher={CRC Press}
+            }
+        ]]></citation>
+    </xml>
+</macros>
\ No newline at end of file