diff biom_convert.xml @ 1:0de92f0b96ef draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/biom_format commit f726b353973996a1f59e2044e80ef7c9b75833ab"
author iuc
date Wed, 11 Sep 2019 12:40:19 -0400
parents 501c21cce614
children 584008e574b2
line wrap: on
line diff
--- a/biom_convert.xml	Tue Jun 07 17:26:00 2016 -0400
+++ b/biom_convert.xml	Wed Sep 11 12:40:19 2019 -0400
@@ -1,56 +1,63 @@
-<tool id="biom_convert" name="Convert BIOM" version="@VERSION@.0">
-    <description>formats</description>
+<tool id="biom_convert" name="Convert" version="@VERSION@.2">
+    <description>between BIOM table formats</description>
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="requirements" />
-    <expand macro="stdio" />
     <expand macro="version_command" />
-    <command>
+    <command detect_errors="exit_code">
         <![CDATA[
-            biom convert -i "${input_type.input_table}" -o "${output_table}"
-            #if str( $input_type.input_type_selector ) == "tsv": 
-                #if $input_type.process_obs_metadata:
-                    --process-obs-metadata "${input_type.process_obs_metadata}"
-                #end if
+            ## biom convert requires the header to start with a #
+            ## so we just add one if its missing
+            #if $input.type_selector == "tsv"
+                sed '1s/^\([^#].*\)/#\1/' '$input.input_fp' > input &&
+            #else
+                ln -s '$input.input_fp' input &&
             #end if
-
-            #if str( $output_type.output_type_selector ) == "tsv": 
-                --to-tsv
-                #if $output_type.header_key:
-                    --header-key "${output_type.header_key}"
-                    #if $output_type.output_metadata_id:
-                        --output-metadata-id "${output_type.output_metadata_id}"
+            biom convert 
+                --input-fp input
+                --output-fp '$output_fp'
+                #if str( $input.type_selector ) == "tsv"
+                    #if $input.process_obs_metadata:
+                        --process-obs-metadata '$input.process_obs_metadata'
                     #end if
-                    --tsv-metadata-formatter "${output_type.tsv_metadata_formatter}"
                 #end if
-            #else:
-                --table-type "${output_type.table_type}"
-                #if str( $output_type.biom_type.biom_type_selector ) == 'hdf5':
-                    --to-hdf5
-                    ${output_type.biom_type.collapsed_samples}
-                    ${output_type.biom_type.collapsed_observations}
+                #if str( $output.type_selector ) == "tsv"
+                    --to-tsv
+                    #if $output_type.header_key
+                        --header-key '$output.header_key'
+                        #if $output_type.output_metadata_id
+                            --output-metadata-id '$output.output_metadata_id'
+                        #end if
+                        --tsv-metadata-formatter '$output.tsv_metadata_formatter'
+                    #end if
                 #else:
-                    --to-json
-                #end if
-                #if $output_type.sample_metadata_fp:
-                    --sample-metadata-fp "${output_type.sample_metadata_fp}"
-                #end if
-                #if $output_type.observation_metadata_fp:
-                    --observation-metadata-fp "${output_type.observation_metadata_fp}"
-                #end if
-            #end if   
+                    --table-type '$output.table_type'
+                    #if str( $output.biom_type.selector ) == 'hdf5':
+                        --to-hdf5
+                        $output.biom_type.collapsed_samples
+                        $output.biom_type.collapsed_observations
+                    #else:
+                        --to-json
+                    #end if
+                    #if $output.sample_metadata_fp
+                        --sample-metadata-fp '$output.sample_metadata_fp'
+                    #end if
+                    #if $output.observation_metadata_fp
+                        --observation-metadata-fp '$output.observation_metadata_fp'
+                    #end if
+                #end if   
         ]]>
     </command>
     <inputs>
-        <conditional name="input_type">
-            <param name="input_type_selector" type="select" label="Choose the source BIOM format">
+        <conditional name="input">
+            <param name="type_selector" type="select" label="Choose the source BIOM format">
                 <option value="tsv" selected="True">Tabular File</option>
                 <option value="biom">BIOM File</option>
             </param>
             <when value="tsv">
-                <param name="input_table" type="data" format="tabular" label="Tabular File" argument="--input-fp"/>
-                <param name="process_obs_metadata" type="select" label="Process metadata associated with observations when converting" argument="--process-obs-metadata">
+                <param name="input_fp" argument="--input-fp" type="data" format="tabular" label="Input table" />
+                <param name="process_obs_metadata" argument="--process-obs-metadata" type="select" label="Process metadata associated with observations when converting">
                     <option value="" selected="True">Do Not process metadata</option>
                     <option value="taxonomy">taxonomy</option>
                     <option value="naive">naive</option>
@@ -58,24 +65,24 @@
                 </param>
             </when>
             <when value="biom">
-                <param name="input_table" type="data" format="biom1" label="Tabular File" argument="--input-fp"/>
+                <param name="input_fp" argument="--input-fp" type="data" format="biom1" label="Input BIOM table"/>
             </when>
         </conditional>
-        <conditional name="output_type">
-            <param name="output_type_selector" type="select" label="Choose the output type" argument="--to-tsv">
+        <conditional name="output">
+            <param name="type_selector" type="select" label="Choose the output type">
                 <option value="tsv">TSV-formatted (classic) table</option>
                 <option value="biom" selected="True">BIOM</option>
             </param>
             <when value="tsv">
-                <param name="header_key" type="text" value="" label="observation metadata to include" help="Leave empty to ignore" argument="--header-key"/>
-                <param name="output_metadata_id" type="text" value="" label="name to be given to the observation metadata column" help="Leave empty to ignore" argument="--output-metadata-id"/>
-                <param name="tsv_metadata_formatter" type="select" label="Method for formatting the observation metadata" argumet="--tsv-metadata-formatter">
+                <param name="header_key" argument="--header-key" type="text" value="" label="observation metadata to include" help="Leave empty to ignore" />
+                <param name="output_metadata_id" argument="--output-metadata-id" type="text" value="" label="name to be given to the observation metadata column" help="Leave empty to ignore" />
+                <param name="tsv_metadata_formatter" argument="--tsv-metadata-formatter" type="select" label="Method for formatting the observation metadata" >
                     <option value="naive" selected="True">naive</option>
                     <option value="sc_separated">Semi-colon separated</option>
                 </param>
             </when>
             <when value="biom">
-                <param name="table_type" type="select" label="Table Type" argument="--table-type">
+                <param name="table_type" argument="--table-type" type="select" label="Table Type" >
                     <option value="OTU table">OTU table</option>
                     <option value="Pathway table">Pathway table</option>
                     <option value="Function table">Function table</option>
@@ -86,64 +93,64 @@
                     <option value="Table" selected="True">Table</option>
                 </param>
                 <conditional name="biom_type">
-                    <param name="biom_type_selector" type="select" label="BIOM format type" argument="--to-json / --to-hdf5">
+                    <param name="selector" type="select" label="BIOM format type">
                         <option value="json" selected="True">JSON-formatted table (BIOM1)</option>
                         <option value="hdf5">HDF5-formatted table (BIOM2)</option>
                     </param>
                     <when value="json">
                     </when>
                     <when value="hdf5">
-                        <param name="collapsed_samples" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed samples" argument="--collapsed-observations"/>
-                        <param name="collapsed_observations" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed observations"/>
+                        <param name="collapsed_observations" argument="--collapsed-observations" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed samples"/>
+                        <param name="collapsed_samples" argument="--collapsed-samples" type="boolean" truevalue="" falsevalue="--collapsed-samples" checked="False" label="Use collapsed observations"/>
                     </when>
                 </conditional>
-                <param name="sample_metadata_fp" type="data" format="tabular" optional="True" label="Add sample metadata from metadata mapping file" argument="--sample-metadata-fp"/>
-                <param name="observation_metadata_fp" type="data" format="tabular" optional="True" label="Add observation metadata from mapping file" argument="--observation-metadata-fp"/>
+                <param name="sample_metadata_fp" argument="--sample-metadata-fp" type="data" format="tabular" optional="True" label="Add sample metadata from metadata mapping file" />
+                <param name="observation_metadata_fp" argument="--observation-metadata-fp" type="data" format="tabular" optional="True" label="Add observation metadata from mapping file" />
             </when>
         </conditional>
     </inputs>
     <outputs>
-        <data format="biom1" name="output_table">
+        <data format="biom1" name="output_fp">
             <change_format>
-                <when input="output_type.output_type_selector" value="tsv" format="tabular" />
-                <when input="output_type.biom_type" value="hdf5" format="biom2" />
+                <when input="output.type_selector" value="tsv" format="tabular" />
+                <when input="output.biom_type" value="hdf5" format="h5" />
             </change_format>
         </data>
     </outputs>
     <tests>
         <test>
-            <conditional name="input_type">
-                <param name="input_type_selector" value="tsv"/>
-                <param name="input_table" value="input_abundance_taxonomy_1.tabular" ftype="tabular"/>
+            <conditional name="input">
+                <param name="type_selector" value="tsv"/>
+                <param name="input_fp" value="input_abundance_taxonomy_1.tabular" ftype="tabular"/>
                 <param name="process_obs_metadata" value="taxonomy"/>
             </conditional>
-            <conditional name="output_type">
-                <param name="output_type_selector" value="biom"/>
+            <conditional name="output">
+                <param name="type_selector" value="biom"/>
                 <param name="table_type" value="OTU table"/>
                 <conditional name="biom_type">
-                    <param name="biom_type_selector" value="json"/>
+                    <param name="selector" value="json"/>
                 </conditional>
                 <param name="sample_metadata_fp"/>
                 <param name="observation_metadata_fp"/>
             </conditional>
-            <output name="output_table" file="output_taxonomy_1.biom1.re" ftype="biom1" compare="re_match"/>
+            <output name="output_fp" file="output_taxonomy_1.biom1.re" ftype="biom1" compare="re_match"/>
         </test>
         <test>
-            <conditional name="input_type">
-                <param name="input_type_selector" value="tsv"/>
-                <param name="input_table" value="input_abundance_1.tabular" ftype="tabular"/>
+            <conditional name="input">
+                <param name="type_selector" value="tsv"/>
+                <param name="input_fp" value="input_abundance_1.tabular" ftype="tabular"/>
                 <param name="process_obs_metadata" value=""/>
             </conditional>
-            <conditional name="output_type">
-                <param name="output_type_selector" value="biom"/>
+            <conditional name="output">
+                <param name="type_selector" value="biom"/>
                 <param name="table_type" value="OTU table"/>
                 <conditional name="biom_type">
-                    <param name="biom_type_selector" value="json"/>
+                    <param name="selector" value="json"/>
                 </conditional>
                 <param name="sample_metadata_fp"/>
                 <param name="observation_metadata_fp"/>
             </conditional>
-            <output name="output_table" file="output_1.biom1.re" ftype="biom1" compare="re_match"/>
+            <output name="output_fp" file="output_1.biom1.re" ftype="biom1" compare="re_match"/>
         </test>
     </tests>
     <help><![CDATA[