diff export.xml @ 3:8623710d083c draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit dc9d19d1f902f3ed54009cd0e68c8518c284b856"
author iuc
date Mon, 06 Jan 2020 13:44:46 -0500
parents fcb7370e827f
children 707023fa62fe
line wrap: on
line diff
--- a/export.xml	Thu Dec 12 09:23:01 2019 -0500
+++ b/export.xml	Mon Jan 06 13:44:46 2020 -0500
@@ -1,54 +1,79 @@
-<tool id="anndata_export" name="Export AnnData" version="@VERSION@+@GALAXY_VERSION@">
-    <description>to different formats</description>
+<tool id="anndata_export" name="Export AnnData and loom files" version="@VERSION@+@GALAXY_VERSION@">
+    <description>Interconvert AnnData and Loom formats</description>
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="requirements"/>
     <expand macro="version_command"/>
     <command detect_errors="exit_code"><![CDATA[
-@CMD@
+#if $hd5_format.filetype == 'anndata':
+    @CMD@
+#else:
+    @LOOMCMD@
+#end if
       ]]></command>
     <configfiles>
         <configfile name="script_file"><![CDATA[
 @CMD_imports@
-
-adata = ad.read('$input')
-#if $output_format == 'loom'
+#if $hd5_format.filetype == 'anndata':
+adata = ad.read('$hd5_format.input')
+    #if $hd5_format.output_format == 'loom':
 adata.write_loom('anndata.loom')
-#else if $output_format == 'tabular'
+    #else if $hd5_format.output_format == 'tabular':
 adata.write_csvs('.', sep="\t", skip_data = False)
+    #end if
 #end if
-]]></configfile>
-    </configfiles>
+    ]]></configfile>
+</configfiles>
     <inputs>
-        <param name="input" type="data" format="h5ad" label="Annotated data matrix"/>
-        <param name="output_format" type="select" label="Format to write the annotated data matrix">
-            <option value="loom">loom</option>
-            <option value="tabular">Tabular</option>
-        </param>
+        <conditional name="hd5_format">
+            <param name="filetype" type="select" label="hd5 format">
+                <option value="anndata" selected="true">Anndata file</option>
+                <option value="loom">Loom file</option>
+            </param>
+            <when value="anndata">
+                <param name="input" type="data" format="h5ad" label="Annotated data matrix"/>
+                <param name="output_format" type="select" label="Format to write the annotated data matrix">
+                    <option value="loom">loom</option>
+                    <option value="tabular">Tabular</option>
+                </param>
+            </when>
+            <when value="loom">
+                <param name="input" type="data" format="loom" label="Loom file to be exported to a series of tabular files."/>
+            </when>
+        </conditional>
     </inputs>
     <outputs>
         <data name="loom_output" format="loom" from_work_dir="anndata.loom" label="${tool.name} on ${on_string}: Annotated data matrix">
-            <filter>output_format == 'loom'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'loom'</filter>
         </data>
         <data name="tabular_x" format="tabular" from_work_dir="X.csv" label="${tool.name} on ${on_string}: Matrix table (X)">
-            <filter>output_format == 'tabular'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
         </data>
         <data name="tabular_obs" format="tabular" from_work_dir="obs.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional observations annotation (obs)">
-            <filter>output_format == 'tabular'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
         </data>
         <data name="tabular_obsm" format="tabular" from_work_dir="obsm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional observations annotation (obsm)">
-            <filter>output_format == 'tabular'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
         </data>
         <data name="tabular_var" format="tabular" from_work_dir="var.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional variables annotation (var)">
-            <filter>output_format == 'tabular'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
         </data>
         <data name="tabular_varm" format="tabular" from_work_dir="varm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional variables annotation (varm)">
-            <filter>output_format == 'tabular'</filter>
+            <filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
         </data>
+        <collection name="layer_tsvs" type="list" label="Layer matrices" >
+            <filter>hd5_format['filetype'] == 'loom'</filter>
+            <discover_datasets pattern="__designation__" format="tabular" directory="output" visible="false" />
+        </collection>
+        <collection name="attribute_tsvs" type="list" label="Attribute matrices" >
+            <filter>hd5_format['filetype'] == 'loom'</filter>
+            <discover_datasets pattern="__designation__" format="tabular" directory="attributes" visible="false" />
+        </collection>
     </outputs>
     <tests>
-        <test>
+        <test expect_num_outputs="1">
+            <param name="filetype" value="anndata"/>
             <param name="input" value="krumsiek11.h5ad"/>
             <param name="output_format" value="loom"/>
             <assert_stdout>
@@ -56,7 +81,8 @@
             </assert_stdout>
             <output name="loom_output" value="export.krumsiek11.loom" ftype="loom" compare="sim_size"/>
         </test>
-        <test>
+        <test expect_num_outputs="5">
+            <param name="filetype" value="anndata"/>
             <param name="input" value="krumsiek11.h5ad"/>
             <param name="output_format" value="tabular"/>
             <assert_stdout>
@@ -68,13 +94,26 @@
             <output name="tabular_var" value="export.krumsiek11.var.tabular" ftype="tabular"/>
             <output name="tabular_varm" value="export.krumsiek11.varm.tabular" ftype="tabular"/>
         </test>
+        <test expect_num_outputs="2">
+            <param name="filetype" value="loom"/>
+            <param name="input" value="loomtest.loom"/>
+            <output_collection name="layer_tsvs" type="list">
+                <element name="mainmatrix.tsv" value="firstlayer.tsv" ftype="tabular"/>
+                <element name="extralayer.tsv" value="secondlayer.tsv" ftype="tabular"/>
+                <element name="thirdlayer.tsv" value="finallayer.tsv" ftype="tabular"/>
+            </output_collection>
+            <output_collection name="attribute_tsvs" type="list">
+                <element name="row_attr.tsv" value="rows.tsv" ftype="tabular"/>
+                <element name="col_attr.tsv" value="cols.tsv" ftype="tabular"/>
+            </output_collection>
+        </test>
     </tests>
     <help><![CDATA[
-**What it does**
+This tool exports an AnnData dataset to a Loom file
+(`write_loom method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.write_loom.html>`__)
+or a Tabular file (`write_csvs method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.write_csvs.html>`__)
 
-This tool exports a AnnData dataset to a Loom file 
-(`write_loom method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.write_loom.html>`__) 
-or a Tabular file (`write_csvs method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.write_csvs.html>`__)
+It can also create a series of tabular files from an input loom dataset.
 
 @HELP@
     ]]></help>