Mercurial > repos > iuc > anndata_manipulate
comparison manipulate.xml @ 0:0ef28c0963c8 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:05 -0400 |
parents | |
children | 19592ec717ef |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0ef28c0963c8 |
---|---|
1 <tool id="anndata_manipulate" name="Manipulate AnnData" version="@VERSION@+@GALAXY_VERSION@"> | |
2 <description>object</description> | |
3 <macros> | |
4 <import>macros.xml</import> | |
5 <xml name="param_join"> | |
6 <param name="join" type="select" label="The connecting string between name and integer"> | |
7 <option value="-">-</option> | |
8 <option value="_">_</option> | |
9 <option value=" "> </option> | |
10 <option value="/">/</option> | |
11 </param> | |
12 </xml> | |
13 </macros> | |
14 <expand macro="requirements"/> | |
15 <expand macro="version_command"/> | |
16 <command detect_errors="exit_code"><![CDATA[ | |
17 @CMD@ | |
18 ]]></command> | |
19 <configfiles> | |
20 <configfile name="script_file"><![CDATA[ | |
21 @CMD_imports@ | |
22 | |
23 adata = ad.read('$input') | |
24 | |
25 #if $manipulate.function == 'concatenate' | |
26 #for i, filepath in enumerate($manipulate.other_adatas) | |
27 adata_$i = ad.read('$filepath') | |
28 #end for | |
29 adata.concatenate( | |
30 #for i, filepath in enumerate($manipulate.other_adatas) | |
31 adata_$i, | |
32 #end for | |
33 join='$manipulate.join', | |
34 #if str($manipulate.index_unique) != '' | |
35 index_unique='$manipulate.index_unique', | |
36 #else | |
37 index_unique=None, | |
38 #end if | |
39 batch_key='$manipulate.batch_key') | |
40 | |
41 #else if $manipulate.function == 'var_names_make_unique' | |
42 adata.var_names_make_unique(join='$manipulate.join') | |
43 | |
44 #else if $manipulate.function == 'obs_names_make_unique' | |
45 adata.obs_names_make_unique(join='$manipulate.join') | |
46 | |
47 #else if $manipulate.function == 'rename_categories' | |
48 #set $categories = [x.strip() for x in str($manipulate.categories).split(',')] | |
49 adata.rename_categories( | |
50 key='$manipulate.key', | |
51 categories=$categories) | |
52 | |
53 #else if $manipulate.function == 'transpose' | |
54 adata.transpose() | |
55 | |
56 #else if $manipulate.function == 'strings_to_categoricals' | |
57 adata.strings_to_categoricals() | |
58 #end if | |
59 | |
60 adata.write('anndata.h5ad') | |
61 ]]></configfile> | |
62 </configfiles> | |
63 <inputs> | |
64 <param name="input" type="data" format="h5ad" label="Annotated data matrix"/> | |
65 <conditional name="manipulate"> | |
66 <param name="function" type="select" label="Function of manipulate the object"> | |
67 <option value="concatenate">Concatenate along the observations axis</option> | |
68 <option value="obs_names_make_unique">Makes the obs index unique by appending '1', '2', etc</option> | |
69 <option value="var_names_make_unique">Makes the var index unique by appending '1', '2', etc</option> | |
70 <option value="rename_categories">Rename categories of annotation</option> | |
71 <option value="strings_to_categoricals">Transform string annotations to categoricals</option> | |
72 <option value="transpose">Transpose the data matrix, leaving observations and variables interchanged</option> | |
73 </param> | |
74 <when value="concatenate"> | |
75 <param name="other_adatas" type="data" format="h5ad" multiple="true" label="Annotated data matrix to add"/> | |
76 <param name="join" type="select" label="Join method"> | |
77 <option value="inner">Intersection of variables</option> | |
78 <option value="outer">Union of variables</option> | |
79 </param> | |
80 <param name="batch_key" type="text" value="batch" label="Key to add the batch annotation to obs"/> | |
81 <param name="index_unique" type="select" label="Separator to join the existing index names with the batch category" help="Leave it empty to keep existing indices"> | |
82 <option value="-">-</option> | |
83 <option value="_">_</option> | |
84 <option value=" "> </option> | |
85 <option value="/">/</option> | |
86 </param> | |
87 </when> | |
88 <when value="obs_names_make_unique"> | |
89 <expand macro="param_join"/> | |
90 </when> | |
91 <when value="var_names_make_unique"> | |
92 <expand macro="param_join"/> | |
93 </when> | |
94 <when value="rename_categories"> | |
95 <param name="key" type="text" value="" label="Key for observations or variables annotation" help="Annotation key in obs or var"/> | |
96 <param name="categories" type="text" value="" label="Comma-separated list of new categories" help="It should be the same number as the old categories"/> | |
97 </when> | |
98 <when value="strings_to_categoricals"/> | |
99 <when value="transpose"/> | |
100 </conditional> | |
101 </inputs> | |
102 <outputs> | |
103 <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} on ${on_string}"/> | |
104 </outputs> | |
105 <tests> | |
106 <test> | |
107 <param name="input" value="krumsiek11.h5ad"/> | |
108 <conditional name="manipulate"> | |
109 <param name="function" value="concatenate"/> | |
110 <param name="other_adatas" value="import.csv.h5ad"/> | |
111 <param name="join" value="inner"/> | |
112 <param name="batch_key" value="batch"/> | |
113 <param name="index_unique" value="-"/> | |
114 </conditional> | |
115 <assert_stdout> | |
116 <has_text_matching expression="adata_0"/> | |
117 <has_text_matching expression="adata.concatenate"/> | |
118 <has_text_matching expression="join='inner'"/> | |
119 <has_text_matching expression="index_unique='-'"/> | |
120 <has_text_matching expression="batch_key='batch'"/> | |
121 </assert_stdout> | |
122 <output name="anndata" value="manipulate.concatenate.h5ad" ftype="h5ad" compare="sim_size"/> | |
123 </test> | |
124 <test> | |
125 <param name="input" value="krumsiek11.h5ad"/> | |
126 <conditional name="manipulate"> | |
127 <param name="function" value="obs_names_make_unique"/> | |
128 <param name="join" value="-"/> | |
129 </conditional> | |
130 <assert_stdout> | |
131 <has_text_matching expression="adata.obs_names_make_unique\(join='-'\)"/> | |
132 </assert_stdout> | |
133 <output name="anndata" value="manipulate.obs_names_make_unique.h5ad" ftype="h5ad" compare="sim_size"/> | |
134 </test> | |
135 <test> | |
136 <param name="input" value="krumsiek11.h5ad"/> | |
137 <conditional name="manipulate"> | |
138 <param name="function" value="var_names_make_unique"/> | |
139 <param name="join" value="-"/> | |
140 </conditional> | |
141 <assert_stdout> | |
142 <has_text_matching expression="adata.var_names_make_unique\(join='-'\)"/> | |
143 </assert_stdout> | |
144 <output name="anndata" value="manipulate.var_names_make_unique.h5ad" ftype="h5ad" compare="sim_size"/> | |
145 </test> | |
146 <test> | |
147 <param name="input" value="krumsiek11.h5ad"/> | |
148 <conditional name="manipulate"> | |
149 <param name="function" value="rename_categories"/> | |
150 <param name="key" value="cell_type"/> | |
151 <param name="categories" value="Er,Ml,Mt, Ne, pr"/> | |
152 </conditional> | |
153 <assert_stdout> | |
154 <has_text_matching expression="adata.rename_categories"/> | |
155 <has_text_matching expression="key='cell_type'"/> | |
156 <has_text_matching expression="categories=\['Er', 'Ml', 'Mt', 'Ne', 'pr'\]"/> | |
157 </assert_stdout> | |
158 <output name="anndata" value="manipulate.rename_categories.h5ad" ftype="h5ad" compare="sim_size"/> | |
159 </test> | |
160 <test> | |
161 <param name="input" value="krumsiek11.h5ad"/> | |
162 <conditional name="manipulate"> | |
163 <param name="function" value="strings_to_categoricals"/> | |
164 </conditional> | |
165 <assert_stdout> | |
166 <has_text_matching expression="adata.strings_to_categoricals"/> | |
167 </assert_stdout> | |
168 <output name="anndata" value="manipulate.strings_to_categoricals.h5ad" ftype="h5ad" compare="sim_size"/> | |
169 </test> | |
170 <test> | |
171 <param name="input" value="krumsiek11.h5ad"/> | |
172 <conditional name="manipulate"> | |
173 <param name="function" value="transpose"/> | |
174 </conditional> | |
175 <assert_stdout> | |
176 <has_text_matching expression="adata.transpose"/> | |
177 </assert_stdout> | |
178 <output name="anndata" value="manipulate.transpose.h5ad" ftype="h5ad" compare="sim_size"/> | |
179 </test> | |
180 </tests> | |
181 <help><![CDATA[ | |
182 **What it does** | |
183 | |
184 This tool takes a AnnData dataset, manipulates it and returns it. | |
185 | |
186 The possible manipulations are: | |
187 | |
188 - Concatenate along the observations axis (`concatenate method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.concatenate.html>`__) | |
189 | |
190 The `uns`, `varm` and `obsm` attributes are ignored. | |
191 | |
192 If you use `join='outer'` this fills 0s for sparse data when variables are absent in a batch. Use this with care. Dense data is filled with `NaN` | |
193 | |
194 - Makes the obs index unique by appending '1', '2', etc (`obs_names_make_unique method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.obs_names_make_unique.html>`__) | |
195 | |
196 The first occurance of a non-unique value is ignored. | |
197 | |
198 - Makes the var index unique by appending '1', '2', etc (`var_names_make_unique method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.var_names_make_unique.html>`__) | |
199 | |
200 The first occurance of a non-unique value is ignored. | |
201 | |
202 - Rename categories of annotation `key` in `obs`, `var` and `uns` (`rename_categories method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.rename_categories.html>`__) | |
203 | |
204 Besides calling `self.obs[key].cat.categories = categories` - similar for `var` - this also renames categories in unstructured annotation that uses the categorical annotation `key` | |
205 | |
206 - Transform string annotations to categoricals (`strings_to_categoricals method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.strings_to_categoricals.html>`__) | |
207 | |
208 Only affects string annotations that lead to less categories than the total number of observations. | |
209 | |
210 - Transpose the data matrix, leaving observations and variables interchanged (`transpose method <https://anndata.readthedocs.io/en/latest/anndata.AnnData.transpose.html>`__) | |
211 | |
212 Data matrix is transposed, observations and variables are interchanged. | |
213 | |
214 @HELP@ | |
215 ]]></help> | |
216 <expand macro="citations"/> | |
217 </tool> |