Repository 'scanpy_filter'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/scanpy_filter

Changeset 6:a97abb8cd15b (2020-02-20)
Previous changeset 5:8b9610ab366a (2020-02-10) Next changeset 7:3c86f71498bc (2020-05-20)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scanpy/ commit 5a90fd345b43ca12366f4475f4cfd88ef197e452"
modified:
filter.xml
macros.xml
b
diff -r 8b9610ab366a -r a97abb8cd15b filter.xml
--- a/filter.xml Mon Feb 10 05:29:59 2020 -0500
+++ b/filter.xml Thu Feb 20 08:26:18 2020 -0500
b
b'@@ -215,13 +215,14 @@\n                 <param argument="replace" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Sample the counts with replacement?"/>\n             </when>\n         </conditional>\n+        <expand macro="inputs_common_advanced"/>\n     </inputs>\n     <outputs>\n         <expand macro="anndata_outputs"/>\n     </outputs>\n     <tests>\n         <test>\n-            <!-- test 1 -->\n+            <!-- test 0 -->\n             <param name="adata" value="krumsiek11.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.filter_cells"/>\n@@ -231,13 +232,21 @@\n                 </conditional>\n             </conditional>\n             <assert_stdout>\n-                <has_text_matching expression="sc.pp.filter_cells"/>\n-                <has_text_matching expression="min_counts=3"/>\n+                <has_text_matching expression="336 \xc3\x97 11"/>\n             </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.filter_cells"/>\n+                    <has_text_matching expression="min_counts=3"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.filter_cells.krumsiek11-min_counts.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n         <test>\n-            <!-- test 2 -->\n+            <!-- test 1 -->\n             <param name="adata" value="krumsiek11.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.filter_cells"/>\n@@ -246,15 +255,20 @@\n                     <param name="max_genes" value="100"/>\n                 </conditional>\n             </conditional>\n-            <assert_stdout>\n-                <has_text_matching expression="sc.pp.filter_cells"/>\n-                <has_text_matching expression="adata"/>\n-                <has_text_matching expression="max_genes=100"/>\n-            </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.filter_cells"/>\n+                    <has_text_matching expression="adata"/>\n+                    <has_text_matching expression="max_genes=100"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.filter_cells.krumsiek11-max_genes.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n         <test>\n-            <!-- test 3 -->\n+            <!-- test 2 -->\n             <param name="adata" value="krumsiek11.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.filter_genes"/>\n@@ -263,39 +277,47 @@\n                     <param name="min_counts" value="3"/>\n                 </conditional>\n             </conditional>\n-            <assert_stdout>\n-                <has_text_matching expression="sc.pp.filter_genes"/>\n-                <has_text_matching expression="min_counts=3"/>\n-            </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.filter_genes"/>\n+                    <has_text_matching expression="min_counts=3"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.filter_genes.krumsiek11-min_counts.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n+        <!-- <test> -->\n+        <!--     <!-\\- test 3 -\\-> -->\n+        <!--     <!-\\- Input dataset appears to be missing rank_genes_groups key.'..b's.krumsiek11-cell_ranger.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n         <test>\n-            <!-- test 7 -->\n+            <!-- test 6 -->\n             <param name="adata" value="krumsiek11.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.subsample"/>\n@@ -351,15 +383,20 @@\n                 </conditional>\n                 <param name="random_state" value="0"/>\n             </conditional>\n-            <assert_stdout>\n-                <has_text_matching expression="sc.pp.subsample"/>\n-                <has_text_matching expression="fraction=0.5"/>\n-                <has_text_matching expression="random_state=0"/>\n-            </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.subsample"/>\n+                    <has_text_matching expression="fraction=0.5"/>\n+                    <has_text_matching expression="random_state=0"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.subsample.krumsiek11_fraction.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n         <test>\n-            <!-- test 8 -->\n+            <!-- test 7 -->\n             <param name="adata" value="krumsiek11.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.subsample"/>\n@@ -369,15 +406,20 @@\n                 </conditional>\n                 <param name="random_state" value="0"/>\n             </conditional>\n-            <assert_stdout>\n-                <has_text_matching expression="sc.pp.subsample"/>\n-                <has_text_matching expression="n_obs=10"/>\n-                <has_text_matching expression="random_state=0"/>\n-            </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.subsample"/>\n+                    <has_text_matching expression="n_obs=10"/>\n+                    <has_text_matching expression="random_state=0"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.subsample.krumsiek11_n_obs.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n         <test>\n-            <!-- test 9 -->\n+            <!-- test 8 -->\n             <param name="adata" value="random-randint.h5ad" />\n             <conditional name="method">\n                 <param name="method" value="pp.downsample_counts"/>\n@@ -385,12 +427,17 @@\n                 <param name="random_state" value="0"/>\n                 <param name="replace" value="false"/>\n             </conditional>\n-            <assert_stdout>\n-                <has_text_matching expression="sc.pp.downsample_counts"/>\n-                <has_text_matching expression="total_counts=20000"/>\n-                <has_text_matching expression="random_state=0"/>\n-                <has_text_matching expression="replace=False"/>\n-            </assert_stdout>\n+            <section name="advanced_common">\n+                <param name="show_log" value="true" />\n+            </section>\n+            <output name="hidden_output">\n+                <assert_contents>\n+                    <has_text_matching expression="sc.pp.downsample_counts"/>\n+                    <has_text_matching expression="total_counts=20000"/>\n+                    <has_text_matching expression="random_state=0"/>\n+                    <has_text_matching expression="replace=False"/>\n+                </assert_contents>\n+            </output>\n             <output name="anndata_out" file="pp.downsample_counts.random-randint.h5ad" ftype="h5ad" compare="sim_size"/>\n         </test>\n     </tests>\n'
b
diff -r 8b9610ab366a -r a97abb8cd15b macros.xml
--- a/macros.xml Mon Feb 10 05:29:59 2020 -0500
+++ b/macros.xml Thu Feb 20 08:26:18 2020 -0500
[
@@ -21,12 +21,17 @@
     </xml>
     <token name="@CMD@"><![CDATA[
 cp '$adata' 'anndata.h5ad' &&
-cat '$script_file' &&
-python '$script_file' &&
-ls .
+cat '$script_file' > '$hidden_output' &&
+python '$script_file' >> '$hidden_output' &&
+ls . >> '$hidden_output' &&
+touch 'anndata_info.txt' &&
+cat 'anndata_info.txt' @CMD_prettify_stdout@
     ]]>
     </token>
     <token name="@CMD_imports@"><![CDATA[
+import sys
+sys.stderr = open('$hidden_output', 'a')
+
 import scanpy as sc
 import pandas as pd
 import numpy as np
@@ -39,13 +44,25 @@
 adata = sc.read('anndata.h5ad')
 ]]>
     </token>
+    <xml name="inputs_common_advanced">
+        <section name="advanced_common" title="Advanced Options" expanded="false">
+            <param name="show_log" type="boolean" checked="false" label="Output Log?" />
+        </section>
+    </xml>
     <xml name="anndata_outputs">
         <data name="anndata_out" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} (${method.method}) on ${on_string}: Annotated data matrix"/>
+        <data name="hidden_output" format="txt" label="Log file" >
+            <filter>advanced_common['show_log']</filter>
+        </data>
     </xml>
     <token name="@CMD_anndata_write_outputs@"><![CDATA[
 adata.write('anndata.h5ad')
+with open('anndata_info.txt','w', encoding='utf-8') as ainfo:
+    print(adata, file=ainfo)
 ]]>
     </token>
+    <token name="@CMD_prettify_stdout@"><![CDATA[ | sed -r '1 s|AnnData object with (.+) = (.*)\s*|\1: \2|g' | sed "s|'||g"  | sed -r 's|^\s*(.*):\s(.*)|[\1]\n-    \2|g' | sed 's|, |\n-    |g'
+    ]]></token>
     <xml name="svd_solver">
         <param name="svd_solver" type="select" label="SVD solver to use" help="">
             <option value="auto">Automatically chosen depending on the size of the problem</option>