comparison inspect.xml @ 0:b2a6ce371781 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit 2e16aca90c4fc6f13bd024eed43bc4adbf5967da
author iuc
date Wed, 10 Apr 2019 03:25:39 -0400
parents
children 05304c5c195d
comparison
equal deleted inserted replaced
-1:000000000000 0:b2a6ce371781
1 <tool id="anndata_inspect" name="Inspect AnnData" version="@VERSION@+@GALAXY_VERSION@">
2 <description>object</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements"/>
7 <expand macro="version_command"/>
8 <command detect_errors="exit_code"><![CDATA[
9 @CMD@
10 ]]></command>
11 <configfiles>
12 <configfile name="script_file"><![CDATA[
13 @CMD_imports@
14
15 adata = ad.read('$input')
16
17 #if $inspect.info == 'general'
18 with open('$general', 'w') as f:
19 print(adata, file=f)
20 #else if $inspect.info == 'X'
21 adata.to_df().to_csv('$X', sep='\t')
22 #else if $inspect.info == 'obs'
23 adata.obs.to_csv('$obs', sep='\t')
24 #else if $inspect.info == 'var'
25 adata.var.to_csv('$var', sep='\t')
26 #else if $inspect.info == 'chunk_X'
27 import pandas as pd
28 #if $inspect.chunk.info == 'random'
29 X = adata.chunk_X(select=$inspect.chunk.size, replace=$inspect.chunk.replace)
30 #else
31 #set $select = [int(x.strip()) for x in str($inspect.chunk.list).split(',')]
32 X = adata.chunk_X(select=$select)
33 #end if
34 pd.DataFrame(X).to_csv('$chunk_X', sep='\t')
35 #end if
36 ]]></configfile>
37 </configfiles>
38 <inputs>
39 <param name="input" type="data" format="h5ad" label="Annotated data matrix"/>
40 <conditional name="inspect">
41 <param name="info" type="select" label="What to inspect?">
42 <option value="general">General information about the object</option>
43 <option value="X">The full data matrix</option>
44 <option value="chunk_X">A chunk of the data matrix</option>
45 <option value="obs">Key-indexed observations annotation</option>
46 <option value="var">Key-indexed annotation of variables/features</option>
47 <!--<option value="uns">Unstructured annotation</option>!-->
48 </param>
49 <when value="general"/>
50 <when value="X"/>
51 <when value="obs"/>
52 <when value="var"/>
53 <when value="chunk_X">
54 <expand macro="params_chunk_X"/>
55 </when>
56 </conditional>
57 </inputs>
58 <outputs>
59 <data name="general" format="txt" label="${tool.name} on ${on_string}: General information">
60 <filter>inspect['info'] == 'general'</filter>
61 </data>
62 <data name="X" format="tabular" label="${tool.name} on ${on_string}: Key-indexed observations annotation (X)">
63 <filter>inspect['info'] == 'X'</filter>
64 </data>
65 <data name="obs" format="tabular" label="${tool.name} on ${on_string}: Key-indexed observations annotation (obs)">
66 <filter>inspect['info'] == 'obs'</filter>
67 </data>
68 <data name="var" format="tabular" label="${tool.name} on ${on_string}: Key-indexed annotation of variables/features (var)">
69 <filter>inspect['info'] == 'var'</filter>
70 </data>
71 <data name="chunk_X" format="tabular" label="${tool.name} on ${on_string}: Observations annotation">
72 <filter>inspect['info'] == 'chunk_X'</filter>
73 </data>
74 </outputs>
75 <tests>
76 <test>
77 <param name="input" value="krumsiek11.h5ad"/>
78 <conditional name="inspect">
79 <param name="info" value="general"/>
80 </conditional>
81 <output name="general" value="inspect.general.txt"/>
82 </test>
83 <test>
84 <param name="input" value="krumsiek11.h5ad"/>
85 <conditional name="inspect">
86 <param name="info" value="X"/>
87 </conditional>
88 <assert_stdout>
89 <has_text_matching expression="adata.to_df\(\).to_csv"/>
90 </assert_stdout>
91 <output name="X" value="inspect.X.tabular" ftype="tabular"/>
92 </test>
93 <test>
94 <param name="input" value="krumsiek11.h5ad"/>
95 <conditional name="inspect">
96 <param name="info" value="obs"/>
97 </conditional>
98 <assert_stdout>
99 <has_text_matching expression="adata.obs.to_csv"/>
100 </assert_stdout>
101 <output name="obs" value="inspect.obs.tabular" ftype="tabular"/>
102 </test>
103 <test>
104 <param name="input" value="krumsiek11.h5ad"/>
105 <conditional name="inspect">
106 <param name="info" value="var"/>
107 </conditional>
108 <assert_stdout>
109 <has_text_matching expression="adata.var.to_csv"/>
110 </assert_stdout>
111 <output name="var" value="inspect.var.tabular" ftype="tabular"/>
112 </test>
113 <test>
114 <param name="input" value="krumsiek11.h5ad"/>
115 <conditional name="inspect">
116 <param name="info" value="chunk_X"/>
117 <conditional name="chunk">
118 <param name="info" value="specified"/>
119 <param name="list" value="3,5,8"/>
120 </conditional>
121 </conditional>
122 <assert_stdout>
123 <has_text_matching expression="adata.chunk_X"/>
124 <has_text_matching expression="select=\[3, 5, 8\]"/>
125 </assert_stdout>
126 <output name="chunk_X" value="inspect.chunk_X.specified.tabular" ftype="tabular"/>
127 </test>
128 <test>
129 <param name="input" value="krumsiek11.h5ad"/>
130 <conditional name="inspect">
131 <param name="info" value="chunk_X"/>
132 <conditional name="chunk">
133 <param name="info" value="random"/>
134 <param name="list" value="10"/>
135 <param name="replace" value="true"/>
136 </conditional>
137 </conditional>
138 <assert_stdout>
139 <has_text_matching expression="adata.chunk_X"/>
140 <has_text_matching expression="select=10"/>
141 <has_text_matching expression="replace=True"/>
142 </assert_stdout>
143 <output name="chunk_X">
144 <assert_contents>
145 <has_text_matching expression="0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"/>
146 </assert_contents>
147 </output>
148 </test>
149 </tests>
150 <help><![CDATA[
151 **What it does**
152
153 This tool inspects a AnnData dataset and returns:
154
155 - General information about the object as text
156 - The full data matrix (`X`) as a Tabular
157 - A chunk of the data matrix as a Tabular, using the `chunk_X method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.chunk_X.html>`__
158 - Key-indexed observations annotation (`obs`) as a Tabular
159 - Key-indexed annotation of variables/features (`var`) as a Tabular
160
161 @HELP@
162 ]]></help>
163 <expand macro="citations"/>
164 </tool>