changeset 6:f2f6c703da06 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scanpy/ commit 5a90fd345b43ca12366f4475f4cfd88ef197e452"
author iuc
date Thu, 20 Feb 2020 08:24:15 -0500
parents 524aa62a6066
children 215733a383f2
files macros.xml remove_confounders.xml
diffstat 2 files changed, 41 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Mon Feb 10 05:27:49 2020 -0500
+++ b/macros.xml	Thu Feb 20 08:24:15 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>
--- a/remove_confounders.xml	Mon Feb 10 05:27:49 2020 -0500
+++ b/remove_confounders.xml	Thu Feb 20 08:24:15 2020 -0500
@@ -103,22 +103,28 @@
                 <param argument="key" type="text" value="batch" label="Key to a categorical annotation from adata.obs that will be used for batch effect removal"/>
             </when>
         </conditional>
+        <expand macro="inputs_common_advanced"/>
     </inputs>
     <outputs>
         <expand macro="anndata_outputs"/>
     </outputs>
     <tests>
         <test>
-            <!-- test 1 -->
+            <!-- test 0 -->
             <param name="adata" value="krumsiek11.h5ad" />
             <conditional name="method">
                 <param name="method" value="pp.regress_out"/>
                 <param name="keys" value="cell_type"/>
             </conditional>
-            <assert_stdout>
-                <has_text_matching expression="sc.pp.regress_out"/>
-                <has_text_matching expression="keys=\['cell_type'\]"/>
-            </assert_stdout>
+            <section name="advanced_common">
+                <param name="show_log" value="true" />
+            </section>
+            <output name="hidden_output">
+                <assert_contents>
+                    <has_text_matching expression="sc.pp.regress_out"/>
+                    <has_text_matching expression="keys=\['cell_type'\]"/>
+                </assert_contents>
+            </output>
             <output name="anndata_out" file="pp.regress_out.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/>
         </test>
         <!--<test>
@@ -135,16 +141,21 @@
             <output name="anndata_out" file="pp.mnn_correct.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/>
         </test>-->
         <test>
-            <!-- test 2 -->
+            <!-- test 1 -->
             <param name="adata" value="blobs.h5ad" />
             <conditional name="method">
                 <param name="method" value="pp.combat"/>
                 <param name="key" value="blobs"/>
             </conditional>
-            <assert_stdout>
-                <has_text_matching expression="sc.pp.combat"/>
-                <has_text_matching expression="key='blobs'"/>
-            </assert_stdout>
+            <section name="advanced_common">
+                <param name="show_log" value="true" />
+            </section>
+            <output name="hidden_output">
+                <assert_contents>
+                    <has_text_matching expression="sc.pp.combat"/>
+                    <has_text_matching expression="key='blobs'"/>
+                </assert_contents>
+            </output>
             <output name="anndata_out" file="pp.combat.blobs.h5ad" ftype="h5ad" compare="sim_size"/>
         </test>
     </tests>