diff macros.xml @ 1:a9f14e2d1655 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scanpy/ commit 8ef5f7c6f8728608a3f05bb51e11b642b84a05f5"
author iuc
date Wed, 16 Oct 2019 06:31:10 -0400
parents ed64c90a9b93
children 8e0f141c8c66
line wrap: on
line diff
--- a/macros.xml	Mon Mar 04 10:16:12 2019 -0500
+++ b/macros.xml	Wed Oct 16 06:31:10 2019 -0400
@@ -1,10 +1,12 @@
 <macros>
-    <token name="@version@">1.4</token>
+    <token name="@version@">1.4.4</token>
     <token name="@galaxy_version@"><![CDATA[@version@+galaxy0]]></token>
     <xml name="requirements">
         <requirements>
             <requirement type="package" version="@version@">scanpy</requirement>
             <requirement type="package" version="2.0.17">loompy</requirement>
+            <requirement type="package" version="2.9.0">h5py</requirement>
+            <requirement type="package" version="0.7.0">leidenalg</requirement>
             <yield />
         </requirements>
     </xml>
@@ -14,102 +16,33 @@
         </citations>
     </xml>
     <xml name="version_command">
-        <version_command><![CDATA[python -c "import scanpy.api as sc;print('scanpy version: %s' % sc.__version__)"]]></version_command>
+        <version_command><![CDATA[python -c "import scanpy as sc;print('scanpy version: %s' % sc.__version__)"]]></version_command>
     </xml>
     <token name="@CMD@"><![CDATA[
+cp '$adata' 'anndata.h5ad' &&
 cat '$script_file' &&
-python '$script_file'
+python '$script_file' &&
+ls .
     ]]>
     </token>
     <token name="@CMD_imports@"><![CDATA[
-import scanpy.api as sc
+import scanpy as sc
 import pandas as pd
 import numpy as np
     ]]>
     </token>
     <xml name="inputs_anndata">
-        <conditional name="input">
-            <param name="format" type="select" label="Format for the annotated data matrix">
-                <option value="loom">loom</option>
-                <option value="h5ad">h5ad-formatted hdf5 (anndata)</option>
-            </param>
-            <when value="loom">
-                <param name="adata" type="data" format="loom" label="Annotated data matrix"/>
-                <param name="sparse" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Is the data matrix to read sparse?"/>
-                <param name="cleanup" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Cleanup?"/>
-                <param name="x_name" type="text" value="spliced" label="X_name"/>
-                <param name="obs_names" type="text" value="CellID" label="obs_names"/>
-                <param name="var_names" type="text" value="Gene" label="var_names"/>
-            </when>
-            <when value="h5ad">
-                <param name="adata" type="data" format="h5" label="Annotated data matrix"/>
-            </when>
-        </conditional>
+        <param name="adata" type="data" format="h5ad" label="Annotated data matrix"/>
     </xml>
     <token name="@CMD_read_inputs@"><![CDATA[
-#if $input.format == 'loom'
-adata = sc.read_loom(
-    '$input.adata',
-    sparse=$input.sparse,
-    cleanup=$input.cleanup,
-    X_name='$input.x_name',
-    obs_names='$input.obs_names',
-    var_names='$input.var_names')
-#else if $input.format == 'h5ad'
-adata = sc.read_h5ad('$input.adata')
-#end if
+adata = sc.read('anndata.h5ad')
 ]]>
     </token>
-    <xml name="anndata_output_format">
-        <param name="anndata_output_format" type="select" label="Format to write the annotated data matrix">
-            <option value="loom">loom</option>
-            <option value="h5ad">h5ad-formatted hdf5 (anndata)</option>
-        </param>
-    </xml>
-    <xml name="anndata_modify_output_input">
-        <conditional name="modify_anndata">
-            <param name="modify_anndata" type="select" label="Return modify annotate data matrix?">
-                <option value="true">Yes</option>
-                <option value="false">No</option>
-            </param>
-            <when value="true">
-                <expand macro="anndata_output_format"/>
-            </when>
-            <when value="false"/>
-        </conditional>
-    </xml>
     <xml name="anndata_outputs">
-        <data name="anndata_out_h5ad" format="h5" from_work_dir="anndata.h5ad" label="${tool.name} on ${on_string}: Annotated data matrix">
-            <filter>anndata_output_format == 'h5ad'</filter>
-        </data>
-        <data name="anndata_out_loom" format="loom" from_work_dir="anndata.loom" label="${tool.name} on ${on_string}: Annotated data matrix">
-            <filter>anndata_output_format == 'loom'</filter>
-        </data>
-    </xml>
-    <xml name="anndata_modify_outputs">
-        <data name="anndata_out_h5ad" format="h5" from_work_dir="anndata.h5ad" label="${tool.name} on ${on_string}: Annotated data matrix">
-            <filter>modify_anndata['modify_anndata'] == 'true' and modify_anndata['anndata_output_format'] == 'h5ad'</filter>
-        </data>
-        <data name="anndata_out_loom" format="loom" from_work_dir="anndata.loom" label="${tool.name} on ${on_string}: Annotated data matrix">
-            <filter>modify_anndata['modify_anndata'] == 'true' and modify_anndata['anndata_output_format'] == 'loom'</filter>
-        </data>
+        <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"/>
     </xml>
     <token name="@CMD_anndata_write_outputs@"><![CDATA[
-#if $anndata_output_format == 'loom'
-adata.write_loom('anndata.loom')
-#else if $anndata_output_format == 'h5ad'
 adata.write('anndata.h5ad')
-#end if
-]]>
-    </token>
-    <token name="@CMD_anndata_write_modify_outputs@"><![CDATA[
-#if $modify_anndata.modify_anndata == 'true'
-    #if $modify_anndata.anndata_output_format == 'loom'
-adata.write_loom('anndata.loom')
-    #elif $modify_anndata.anndata_output_format == 'h5ad'
-adata.write('anndata.h5ad')
-    #end if
-#end if
 ]]>
     </token>
     <xml name="svd_solver">
@@ -423,7 +356,7 @@
         <param argument="use_raw" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Use `raw` attribute of input if present" help=""/>
     </xml>
     <xml name="param_log">
-        <param argument="log" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Use the log of the values?" help=""/>
+        <param argument="log" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Use the log of the values?"/>
     </xml>
     <xml name="pl_figsize">
         <conditional name="figsize">
@@ -473,7 +406,7 @@
         <param argument="layer" type="text" value="" label="Name of the AnnData object layer that wants to be plotted" help="By default `adata.raw.X` is plotted. If `use_raw=False` is set, then `adata.X` is plotted. If layer is set to a valid layer name, then the layer is plotted. layer takes precedence over `use_raw`."/>
     </xml>
     <token name="@CMD_param_plot_inputs@"><![CDATA[
-    adata=adata,
+    adata,
     save='.$format',
     show=False,
     ]]></token>
@@ -512,9 +445,6 @@
         #end for
     var_group_positions=$var_group_positions,
     var_group_labels=$var_group_labels,
-    #else
-    var_group_positions=None,
-    var_group_labels=None,
     #end if
 #if $method.var_group_rotation
     var_group_rotation=$method.var_group_rotation,
@@ -729,44 +659,42 @@
     linewidths=$method.matplotlib_pyplot_scatter.linewidths,
     edgecolors='$method.matplotlib_pyplot_scatter.edgecolors'
     ]]></token>
-    <xml name="section_violin_plots">
-        <section name="violin_plot" title="Violin plot attributes">
-            <conditional name="stripplot">
-                <param argument="stripplot" type="select" label="Add a stripplot on top of the violin plot" help="">
-                    <option value="True">Yes</option>
-                    <option value="False">No</option>
-                </param>
-                <when value="True">
-                    <conditional name="jitter">
-                        <param argument="jitter" type="select" label="Add a jitter to the stripplot" help="">
-                            <option value="True">Yes</option>
-                            <option value="False">No</option>
-                        </param>
-                        <when value="True">
-                            <param argument="size" type="integer" min="0" value="1" label="Size of the jitter points" help=""/>
-                        </when>
-                        <when value="False"/>
-                    </conditional>
-                </when>
-                <when value="False"/>
-            </conditional>
-            <conditional name="multi_panel">
-                <param argument="multi_panel" type="select" label="Display keys in multiple panels" help="Also when `groupby is not provided">
-                    <option value="True">Yes</option>
-                    <option value="False" selected="true">No</option>
-                </param>
-                <when value="True">
-                    <param argument="width" type="integer" min="0" value="" optional="true" label="Width of the figure" help=""/>
-                    <param argument="height" type="integer" min="0" value="" optional="true" label="Height of the figure" help=""/>
-                </when>
-                <when value="False"/>
-            </conditional>
-            <param argument="scale" type="select" label="Method used to scale the width of each violin">
-                <option value="area">area: each violin will have the same area</option>
-                <option value="count">count: the width of the violins will be scaled by the number of observations in that bin</option>
-                <option value="width" selected="true">width: each violin will have the same width</option>
+    <xml name="conditional_stripplot">
+        <conditional name="stripplot">
+            <param argument="stripplot" type="select" label="Add a stripplot on top of the violin plot" help="">
+                <option value="True">Yes</option>
+                <option value="False">No</option>
             </param>
-        </section>
+            <when value="True">
+                <conditional name="jitter">
+                    <param argument="jitter" type="select" label="Add a jitter to the stripplot" help="">
+                        <option value="True">Yes</option>
+                        <option value="False">No</option>
+                    </param>
+                    <when value="True">
+                        <param argument="size" type="integer" min="0" value="1" label="Size of the jitter points" help=""/>
+                    </when>
+                    <when value="False"/>
+                </conditional>
+            </when>
+            <when value="False"/>
+        </conditional>
+    </xml>
+    <token name="@CMD_conditional_stripplot@"><![CDATA[
+    stripplot=$method.violin_plot.stripplot.stripplot,
+#if $method.violin_plot.stripplot.stripplot == "True"
+    jitter=$method.violin_plot.stripplot.jitter.jitter,
+    #if $method.violin_plot.stripplot.jitter.jitter == "True"
+    size=$method.violin_plot.stripplot.jitter.size,
+    #end if
+#end if
+    ]]></token>
+    <xml name="param_scale">
+        <param argument="scale" type="select" label="Method used to scale the width of each violin">
+            <option value="area">area: each violin will have the same area</option>
+            <option value="count">count: the width of the violins will be scaled by the number of observations in that bin</option>
+            <option value="width" selected="true">width: each violin will have the same width</option>
+        </param>
     </xml>
     <token name="@CMD_params_violin_plots@"><![CDATA[
     stripplot=$method.violin_plot.stripplot.stripplot,
@@ -777,7 +705,7 @@
     #end if
 #end if
     multi_panel=$method.violin_plot.multi_panel.multi_panel, 
-#if $method.multi_panel.violin_plot.multi_panel == "True" and $method.violin_plot.multi_panel.width and $method.violin_plot.multi_panel.height
+#if $method.multi_panel.violin_plot.multi_panel == "True" and str($method.violin_plot.multi_panel.width) != '' and str($method.violin_plot.multi_panel.height) != ''
     figsize=($method.violin_plot.multi_panel.width, $method.violin_plot.multi_panel.height)
 #end if
     scale='$method.violin_plot.scale',
@@ -813,14 +741,12 @@
     saturation=$method.seaborn_violinplot.saturation,
     ]]></token>
     <xml name="param_color">
-        <param argument="color" type="text" value="" optional="true" label="Keys for annotations of observations/cells or variables/genes`" help="One or a list of comma-separated index or key from either `.obs` or `.var`"/>
+        <param argument="color" type="text" value="" optional="true" label="Keys for annotations of observations/cells or variables/genes" help="One or a list of comma-separated index or key from either `.obs` or `.var`"/>
     </xml>
     <token name="@CMD_param_color@"><![CDATA[
 #if str($method.color) != ''
     #set $color = ([x.strip() for x in str($method.color).split(',')])
     color=$color,
-#else
-    color=None,
 #end if
     ]]></token>
     <xml name="pl_groups">
@@ -830,8 +756,6 @@
 #if str($method.groups) != ''
     #set $groups=([x.strip() for x in str($method.groups).split(',')])
     groups=$groups,
-#else
-    groups=None,
 #end if
     ]]></token>
     <xml name="pl_components">
@@ -847,8 +771,6 @@
         #silent $components.append(str($s.axis1) + ',' + str($s.axis2))
     #end for
     components=$components,
-#else
-    components=None,
 #end if
     ]]>
     </token>
@@ -877,7 +799,7 @@
         </param>
     </xml>
     <xml name="param_legend_fontsize">
-        <param argument="legend_fontsize" type="integer" min="0" value="1" label="Legend font size" help=""/>
+        <param argument="legend_fontsize" type="integer" optional="true" value="" label="Legend font size" help=""/>
     </xml>
     <xml name="param_legend_fontweight">
         <param argument="legend_fontweight" type="select" label="Legend font weight" help="">
@@ -910,7 +832,7 @@
         <param argument="left_margin" type="float" value="1" label="Width of the space left of each plotting panel" help=""/>
     </xml>
     <xml name="param_size">
-        <param argument="size" type="float" value="1" label="Point size" help=""/>
+        <param argument="size" type="float" optional="true" value="" label="Point size" help=""/>
     </xml>
     <xml name="param_title">
         <param argument="title" type="text" value="" optional="true" label="Title for panels" help="Titles must be separated by a comma"/>
@@ -937,8 +859,8 @@
                 <option value="False" selected="true">No</option>
             </param>
             <when value="True">
-                <param name="edges_width" type="float" min="0" value="0.1" label="Width of edges"/>
-                <param name="edges_color" type="select" label="Color of edges">
+                <param argument="edges_width" type="float" min="0" value="0.1" label="Width of edges"/>
+                <param argument="edges_color" type="select" label="Color of edges">
                     <expand macro="matplotlib_color"/>
                 </param>
             </when>
@@ -956,7 +878,7 @@
     ]]>
     </token>
     <xml name="param_arrows">
-        <param name="arrows" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Show arrows?" help="It requires to run `tl.rna_velocity` before."/>
+        <param argument="arrows" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Show arrows?" help="It requires to run `tl.rna_velocity` before."/>
     </xml>
     <xml name="param_cmap">
         <param argument="cmap" type="select" label="Colors to use for plotting categorical annotation groups" help="">
@@ -982,9 +904,13 @@
     <token name="@CMD_pl_attribute_section@"><![CDATA[
     projection='$method.plot.projection',
     legend_loc='$method.plot.legend_loc',
+    #if str($method.plot.legend_fontsize) != ''
     legend_fontsize=$method.plot.legend_fontsize,
+    #end if
     legend_fontweight='$method.plot.legend_fontweight',
+    #if str($method.plot.size) != ''
     size=$method.plot.size,
+    #end if
     palette='$method.plot.palette',
     frameon=$method.plot.frameon,
     ncols=$method.plot.ncols,
@@ -995,24 +921,39 @@
     #end if
     ]]>
     </token>
+    <xml name="options_layout">
+        <option value="fa">fa: ForceAtlas2</option>
+        <option value="fr">fr: Fruchterman-Reingold</option>
+        <option value="grid_fr">grid_fr: Grid Fruchterman Reingold, faster than "fr"</option>
+        <option value="kk">kk: Kamadi Kawai’, slower than "fr"</option>
+        <option value="drl">drl: Distributed Recursive Layout, pretty fast</option>
+        <option value="rt">rt: Reingold Tilford tree layout</option>
+        <option value="eq_tree">eq_tree: Equally spaced tree</option>
+    </xml>
+    <xml name="param_layout">
+        <param argument="layout" type="select" label="Plotting layout" help="">
+            <expand macro="options_layout"/>
+        </param>
+    </xml>
+    <xml name="param_root">
+        <param argument="root" type="text" value="" label="Comma-separated roots" help="If choosing a tree layout, this is the index of the root node or a list of root node indices. If this is a non-empty vector then the supplied node IDs are used as the roots of the trees (or a single tree if the graph is connected). If this is `None` or an empty list, the root vertices are automatically calculated based on topological sorting."/>
+    </xml>
+    <xml name="param_random_state">
+        <param argument="random_state" type="integer" value="0" label="Random state" help="For layouts with random initialization like 'fr', change this to use different intial states for the optimization. If `None`, the initial state is not reproducible."/>
+    </xml>
     <xml name="inputs_paga">
         <param argument="threshold" type="float" min="0" value="0.01" label="Threshold to draw edges" help="Do not draw edges for weights below this threshold. Set to 0 if you want all edges. Discarding low-connectivity edges helps in getting a much clearer picture of the graph."/>
         <expand macro="pl_groups"/>
         <param argument="color" type="text" value="" label="The node colors" help="Gene name or obs. annotation, and also plots the degree of the abstracted graph when passing 'degree_dashed', 'degree_solid'."/>
         <param argument="pos" type="data" format="tabular,csv,tsv" optional="true" label="Two-column tabular file storing the x and y coordinates for drawing" help=""/>
         <param argument="labels" type="text" value="" label="Comma-separated node labels" help="If none is provided, this defaults to the group labels stored in the categorical for which `tl.paga` has been computed."/>
-        <param argument="layout" type="select" value="" label="Plotting layout" help="">
-            <option value="fa">fa: ForceAtlas2</option>
-            <option value="fr">fr: Fruchterman-Reingold</option>
-            <option value="fr">rt: stands for Reingold Tilford</option>
-            <option value="fr">eq_tree: equally spaced tree</option>
-        </param>
+        <expand macro="param_layout"/>
         <param argument="init_pos" type="data" format="tabular,csv,tsv" optional="true" label="Two-column tabular file storing the x and y coordinates for initializing the layout" help=""/>
-        <param argument="random_state" type="integer" value="0" label="Random state" help="For layouts with random initialization like 'fr', change this to use different intial states for the optimization. If `None`, the initial state is not reproducible."/>
-        <param argument="root" type="text" value="" label="Comma-separated roots" help="If choosing a tree layout, this is the index of the root node or a list of root node indices. If this is a non-empty vector then the supplied node IDs are used as the roots of the trees (or a single tree if the graph is connected). If this is `None` or an empty list, the root vertices are automatically calculated based on topological sorting."/>
+        <expand macro="param_random_state"/>
+        <expand macro="param_root"/>
         <param argument="transitions" type="text" value="" label="Key corresponding to the matrix storing the arrows" help="Key for `.uns['paga']`, e.g. 'transistions_confidence'"/>
-        <param argument="solid_edges" type="text" value="paga_connectivities" label="Key corresponding to the matrix storing the edges to be drawn solid black" help="Key for `.uns['paga']`"/>
-        <param argument="dashed_edges" type="text" value="" optional="true" label="Key corresponding to the matrix storing the edges to be drawn dashed grey" help="Key for `.uns['paga']`. If not set, no dashed edges are drawn."/>
+        <param argument="solid_edges" type="text" value="connectivities" label="Key corresponding to the matrix storing the edges to be drawn solid black" help="Key for uns/paga"/>
+        <param argument="dashed_edges" type="text" value="" optional="true" label="Key corresponding to the matrix storing the edges to be drawn dashed grey" help="Key for uns/paga. If not set, no dashed edges are drawn."/>
         <param argument="single_component" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Restrict to largest connected component?" help=""/>
         <param argument="fontsize" type="integer" min="0" value="1" label="Font size for node labels" help=""/>
         <param argument="node_size_scale" type="float" min="0" value="1.0" label="Size of the nodes" help=""/>
@@ -1031,10 +972,11 @@
 #if str($method.groups) != ''
     #set $groups=([x.strip() for x in str($method.groups).split(',')])
     groups=$groups,
-#else
-    groups=None,
 #end if
-    color='$method.color',
+#if str($method.color) != ''
+    #set $color=([x.strip() for x in str($method.color).split(',')])
+    color=$color,
+#end if
 #if $method.pos
     pos=np.fromfile($method.pos, dtype=dt),
 #end if
@@ -1081,4 +1023,10 @@
     <xml name="param_swap_axes">
         <param argument="swap_axes" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Swap axes?" help="By default, the x axis contains `var_names` (e.g. genes) and the y axis the `groupby` categories (if any). By setting `swap_axes` then x are the `groupby` categories and y the `var_names`."/>
     </xml>
+    <xml name="gene_symbols">
+        <param argument="gene_symbols" type="text" value="" optional="true" label="Key for field in `.var` that stores gene symbols"/>
+    </xml>
+    <xml name="n_genes">
+        <param argument="n_genes" type="integer" min="0" value="20" label="Number of genes to show" help=""/>
+    </xml>               
 </macros>