comparison inspect.xml @ 11:6f0d0c784f09 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit 656ce7ff596a8870b77848469e85b406c7bd9344
author iuc
date Sun, 12 Nov 2023 16:43:58 +0000
parents ee98d611afc6
children 0bf7fddf90c7
comparison
equal deleted inserted replaced
10:ee98d611afc6 11:6f0d0c784f09
14 import pandas as pd 14 import pandas as pd
15 from scipy import io 15 from scipy import io
16 16
17 pd.options.display.precision = 15 17 pd.options.display.precision = 15
18 18
19 adata = ad.read('$input') 19 adata = ad.read_h5ad('$input')
20 20
21 #if $inspect.info == 'general' 21 #if $inspect.info == 'general'
22 with open('$general', 'w', encoding="utf-8") as f: 22 with open('$general', 'w', encoding="utf-8") as f:
23 print(adata, file=f) 23 print(adata, file=f)
24 24
40 #end if 40 #end if
41 pd.DataFrame(X).to_csv('$chunk_X', sep='\t') 41 pd.DataFrame(X).to_csv('$chunk_X', sep='\t')
42 42
43 #else if $inspect.info == 'uns' 43 #else if $inspect.info == 'uns'
44 #if $inspect.uns_info == 'neighbors' 44 #if $inspect.uns_info == 'neighbors'
45 io.mmwrite('uns_neighbors_connectivities.mtx', adata.uns['neighbors']['connectivities']) 45 io.mmwrite('uns_neighbors_connectivities.mtx', adata.obsp['connectivities'])
46 io.mmwrite('uns_neighbors_distances.mtx', adata.uns['neighbors']['distances']) 46 io.mmwrite('uns_neighbors_distances.mtx', adata.obsp['distances'])
47 #else if $inspect.uns_info == 'paga' 47 #else if $inspect.uns_info == 'paga'
48 io.mmwrite('uns_paga_connectivities.mtx', adata.uns['paga']['connectivities']) 48 io.mmwrite('uns_paga_connectivities.mtx', adata.uns['paga']['connectivities'])
49 io.mmwrite('uns_paga_connectivities_tree.mtx', adata.uns['paga']['connectivities_tree']) 49 io.mmwrite('uns_paga_connectivities_tree.mtx', adata.uns['paga']['connectivities_tree'])
50 #else if $inspect.uns_info == 'pca' 50 #else if $inspect.uns_info == 'pca'
51 pd.DataFrame(adata.uns['pca']['variance']).to_csv("$uns_pca_variance", sep="\t", index = False) 51 pd.DataFrame(adata.uns['pca']['variance']).to_csv("$uns_pca_variance", sep="\t", index = False)
57 pd.DataFrame(adata.uns['rank_genes_groups']['pvals_adj']).to_csv("$uns_rank_genes_groups_pvals_adj", sep="\t", index = False) 57 pd.DataFrame(adata.uns['rank_genes_groups']['pvals_adj']).to_csv("$uns_rank_genes_groups_pvals_adj", sep="\t", index = False)
58 pd.DataFrame(adata.uns['rank_genes_groups']['scores']).to_csv("$uns_rank_genes_groups_scores", sep="\t", index = False) 58 pd.DataFrame(adata.uns['rank_genes_groups']['scores']).to_csv("$uns_rank_genes_groups_scores", sep="\t", index = False)
59 #end if 59 #end if
60 60
61 #else if $inspect.info == 'obsm' 61 #else if $inspect.info == 'obsm'
62 #if $inspect.obsm_info == 'X_pca' 62 #if $inspect.obsm_info == 'X_pca'
63 pd.DataFrame(adata.obsm['X_pca']).to_csv("$obsm_X_pca", sep="\t", index = False) 63 pd.DataFrame(adata.obsm['X_pca']).to_csv("$obsm_X_pca", sep="\t", index = False)
64 #else if $inspect.obsm_info == 'X_umap' 64 #else if $inspect.obsm_info == 'X_umap'
65 pd.DataFrame(adata.obsm['X_umap']).to_csv("$obsm_X_umap", sep="\t", index = False) 65 pd.DataFrame(adata.obsm['X_umap']).to_csv("$obsm_X_umap", sep="\t", index = False)
66 #else if $inspect.obsm_info == 'X_tsne' 66 #else if $inspect.obsm_info == 'X_tsne'
67 pd.DataFrame(adata.obsm['X_tsne']).to_csv("$obsm_X_tsne", sep="\t", index = False) 67 pd.DataFrame(adata.obsm['X_tsne']).to_csv("$obsm_X_tsne", sep="\t", index = False)
68 #else if $inspect.obsm_info == 'X_draw_graph' 68 #else if $inspect.obsm_info == 'X_draw_graph'
69 for key in adata.obsm.keys(): 69 for key in adata.obsm.keys():
70 if key.startswith('X_draw_graph'): 70 if key.startswith('X_draw_graph'):
71 pd.DataFrame(adata.obsm[key]).to_csv(key, sep="\t", index = False) 71 pd.DataFrame(adata.obsm[key]).to_csv(key, sep="\t", index = False)
72 #else if $inspect.obsm_info == 'X_diffmap' 72 #else if $inspect.obsm_info == 'X_diffmap'
73 pd.DataFrame(adata.obsm['X_diffmap']).to_csv("$obsm_X_diffmap", sep="\t", index = False) 73 pd.DataFrame(adata.obsm['X_diffmap']).to_csv("$obsm_X_diffmap", sep="\t", index = False)
74 #end if 74 #end if
75 75
76 #else if $inspect.info == 'varm' 76 #else if $inspect.info == 'varm'
77 #if $inspect.varm_info == 'PCs' 77 #if $inspect.varm_info == 'PCs'
78 pd.DataFrame(adata.varm['PCs']).to_csv("$varm_PCs", sep="\t", index = False) 78 pd.DataFrame(adata.varm['PCs']).to_csv("$varm_PCs", sep="\t", index = False)
79 #end if 79 #end if
80 80
81 #end if 81 #end if
82 ]]></configfile> 82 ]]></configfile>
193 <data name="varm_PCs" format="tabular" label="${tool.name} on ${on_string}: Principal components containing the loadings for variables"> 193 <data name="varm_PCs" format="tabular" label="${tool.name} on ${on_string}: Principal components containing the loadings for variables">
194 <filter>inspect['info'] == 'varm' and inspect['varm_info'] == 'PCs'</filter> 194 <filter>inspect['info'] == 'varm' and inspect['varm_info'] == 'PCs'</filter>
195 </data> 195 </data>
196 </outputs> 196 </outputs>
197 <tests> 197 <tests>
198 <test> 198 <test expect_num_outputs="1">
199 <!-- test 1: general info --> 199 <!-- test 1: general info -->
200 <param name="input" value="krumsiek11.h5ad"/> 200 <param name="input" value="krumsiek11.h5ad"/>
201 <conditional name="inspect"> 201 <conditional name="inspect">
202 <param name="info" value="general"/> 202 <param name="info" value="general"/>
203 </conditional> 203 </conditional>
204 <output name="general" value="inspect.general.txt"/> 204 <output name="general" value="inspect.general.txt"/>
205 </test> 205 </test>
206 <test> 206 <test expect_num_outputs="1">
207 <!-- test 2: X --> 207 <!-- test 2: X -->
208 <param name="input" value="krumsiek11.h5ad"/> 208 <param name="input" value="krumsiek11.h5ad"/>
209 <conditional name="inspect"> 209 <conditional name="inspect">
210 <param name="info" value="X"/> 210 <param name="info" value="X"/>
211 </conditional> 211 </conditional>
212 <assert_stdout> 212 <assert_stdout>
213 <has_text_matching expression="adata.to_df\(\).to_csv"/> 213 <has_text_matching expression="adata.to_df\(\).to_csv"/>
214 </assert_stdout> 214 </assert_stdout>
215 <output name="X" value="inspect.X.tabular" ftype="tabular"/> 215 <output name="X" value="inspect.X.tabular" ftype="tabular"/>
216 </test> 216 </test>
217 <test> 217 <test expect_num_outputs="1">
218 <!-- test 3: obs --> 218 <!-- test 3: obs -->
219 <param name="input" value="krumsiek11.h5ad"/> 219 <param name="input" value="krumsiek11.h5ad"/>
220 <conditional name="inspect"> 220 <conditional name="inspect">
221 <param name="info" value="obs"/> 221 <param name="info" value="obs"/>
222 </conditional> 222 </conditional>
223 <assert_stdout> 223 <assert_stdout>
224 <has_text_matching expression="adata.obs.to_csv"/> 224 <has_text_matching expression="adata.obs.to_csv"/>
225 </assert_stdout> 225 </assert_stdout>
226 <output name="obs" value="inspect.obs.tabular" ftype="tabular"/> 226 <output name="obs" value="inspect.obs.tabular" ftype="tabular"/>
227 </test> 227 </test>
228 <test> 228 <test expect_num_outputs="1">
229 <!-- test 4: var --> 229 <!-- test 4: var -->
230 <param name="input" value="krumsiek11.h5ad"/> 230 <param name="input" value="krumsiek11.h5ad"/>
231 <conditional name="inspect"> 231 <conditional name="inspect">
232 <param name="info" value="var"/> 232 <param name="info" value="var"/>
233 </conditional> 233 </conditional>
234 <assert_stdout> 234 <assert_stdout>
235 <has_text_matching expression="adata.var.to_csv"/> 235 <has_text_matching expression="adata.var.to_csv"/>
236 </assert_stdout> 236 </assert_stdout>
237 <output name="var" value="inspect.var.tabular" ftype="tabular"/> 237 <output name="var" value="inspect.var.tabular" ftype="tabular"/>
238 </test> 238 </test>
239 <test> 239 <test expect_num_outputs="1">
240 <!-- test 5: chunk_X, specified --> 240 <!-- test 5: chunk_X, specified -->
241 <param name="input" value="krumsiek11.h5ad"/> 241 <param name="input" value="krumsiek11.h5ad"/>
242 <conditional name="inspect"> 242 <conditional name="inspect">
243 <param name="info" value="chunk_X"/> 243 <param name="info" value="chunk_X"/>
244 <conditional name="chunk"> 244 <conditional name="chunk">
250 <has_text_matching expression="adata.chunk_X"/> 250 <has_text_matching expression="adata.chunk_X"/>
251 <has_text_matching expression="select=\[3, 5, 8\]"/> 251 <has_text_matching expression="select=\[3, 5, 8\]"/>
252 </assert_stdout> 252 </assert_stdout>
253 <output name="chunk_X" value="inspect.chunk_X.specified.tabular" ftype="tabular"/> 253 <output name="chunk_X" value="inspect.chunk_X.specified.tabular" ftype="tabular"/>
254 </test> 254 </test>
255 <test> 255 <test expect_num_outputs="1">
256 <!-- test 6: chunk_X, random --> 256 <!-- test 6: chunk_X, random -->
257 <param name="input" value="krumsiek11.h5ad"/> 257 <param name="input" value="krumsiek11.h5ad"/>
258 <conditional name="inspect"> 258 <conditional name="inspect">
259 <param name="info" value="chunk_X"/> 259 <param name="info" value="chunk_X"/>
260 <conditional name="chunk"> 260 <conditional name="chunk">
272 <assert_contents> 272 <assert_contents>
273 <has_text_matching expression="0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"/> 273 <has_text_matching expression="0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"/>
274 </assert_contents> 274 </assert_contents>
275 </output> 275 </output>
276 </test> 276 </test>
277 <test> 277 <test expect_num_outputs="2">
278 <!-- test 7: uns, neighbors --> 278 <!-- test 7: uns, neighbors -->
279 <param name="input" value="pp.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad"/> 279 <param name="input" value="pp.neighbors_umap_euclidean.recipe_weinreb17.paul15_subsample.h5ad"/>
280 <conditional name="inspect"> 280 <conditional name="inspect">
281 <param name="info" value="uns"/> 281 <param name="info" value="uns"/>
282 <param name="uns_info" value="neighbors"/> 282 <param name="uns_info" value="neighbors"/>
293 <has_text_matching expression="4.973" /> 293 <has_text_matching expression="4.973" />
294 <has_text_matching expression="4.877" /> 294 <has_text_matching expression="4.877" />
295 </assert_contents> 295 </assert_contents>
296 </output> 296 </output>
297 </test> 297 </test>
298 <test> 298 <test expect_num_outputs="2">
299 <!-- test 8: uns, paga --> 299 <!-- test 8: uns, paga -->
300 <param name="input" value="tl.paga.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad"/> 300 <param name="input" value="tl.paga.neighbors_gauss_braycurtis.recipe_weinreb17.paul15_subsample.h5ad"/>
301 <conditional name="inspect"> 301 <conditional name="inspect">
302 <param name="info" value="uns"/> 302 <param name="info" value="uns"/>
303 <param name="uns_info" value="paga"/> 303 <param name="uns_info" value="paga"/>
314 <has_text_matching expression="16 16 15" /> 314 <has_text_matching expression="16 16 15" />
315 <has_text_matching expression="1.000" /> 315 <has_text_matching expression="1.000" />
316 </assert_contents> 316 </assert_contents>
317 </output> 317 </output>
318 </test> 318 </test>
319 <test> 319 <test expect_num_outputs="2">
320 <!-- test 9: uns, pca --> 320 <!-- test 9: uns, pca -->
321 <param name="input" value="pp.pca.krumsiek11.h5ad"/> 321 <param name="input" value="pp.pca.krumsiek11.h5ad"/>
322 <conditional name="inspect"> 322 <conditional name="inspect">
323 <param name="info" value="uns"/> 323 <param name="info" value="uns"/>
324 <param name="uns_info" value="pca"/> 324 <param name="uns_info" value="pca"/>
325 </conditional> 325 </conditional>
326 <output name="uns_pca_variance"> 326 <output name="uns_pca_variance">
327 <assert_contents> 327 <assert_contents>
328 <has_text_matching expression="0.75409454" /> 328 <has_text_matching expression="0.75409\d{2}" />
329 <has_text_matching expression="3.2818672e-05" /> 329 <has_text_matching expression="3.28186\d{2}e-05" />
330 <has_n_columns n="1" /> 330 <has_n_columns n="1" />
331 </assert_contents> 331 </assert_contents>
332 </output> 332 </output>
333 <output name="uns_pca_variance_ratio"> 333 <output name="uns_pca_variance_ratio">
334 <assert_contents> 334 <assert_contents>
335 <has_text_matching expression="0.039053127" /> 335 <has_text_matching expression="0.039053\d{2}" />
336 <has_text_matching expression="0.00013167" /> 336 <has_text_matching expression="0.00013167" />
337 <has_n_columns n="1" /> 337 <has_n_columns n="1" />
338 </assert_contents> 338 </assert_contents>
339 </output> 339 </output>
340 </test> 340 </test>
341 <test> 341 <test expect_num_outputs="5">
342 <!-- test 10: uns, rank_gene_groups --> 342 <!-- test 10: uns, rank_gene_groups -->
343 <param name="input" value="tl.rank_genes_groups.krumsiek11.h5ad"/> 343 <param name="input" value="tl.rank_genes_groups.krumsiek11.h5ad"/>
344 <conditional name="inspect"> 344 <conditional name="inspect">
345 <param name="info" value="uns"/> 345 <param name="info" value="uns"/>
346 <param name="uns_info" value="rank_genes_groups"/> 346 <param name="uns_info" value="rank_genes_groups"/>
347 </conditional> 347 </conditional>
348 <output name="uns_rank_genes_groups_names"> 348 <output name="uns_rank_genes_groups_names">
349 <assert_contents> 349 <assert_contents>
350 <has_n_columns n="5" /> 350 <has_n_columns n="5" />
351 <has_text_matching expression="Ery\tMk\tMo\tNeu\tprogenitor"/> 351 <has_text_matching expression="Ery\tMk\tMo\tNeu\tprogenitor"/>
352 <has_text_matching expression="Gata1\tFog1\tCebpa\tFli1\tGata2"/> 352 <has_text_matching expression="Gata1\tFog1\tPu.1\tCebpa\tEgrNab"/>
353 <has_text_matching expression="EgrNab\tEgrNab\tSCL\tSCL\tGfi1"/> 353 <has_text_matching expression="EgrNab\tEgrNab\tSCL\tSCL\tGfi1"/>
354 </assert_contents> 354 </assert_contents>
355 </output> 355 </output>
356 <output name="uns_rank_genes_groups_scores"> 356 <output name="uns_rank_genes_groups_scores">
357 <assert_contents> 357 <assert_contents>
358 <has_n_columns n="5" /> 358 <has_n_columns n="5" />
359 <has_text_matching expression="Ery\tMk\tMo\tNeu\tprogenitor"/> 359 <has_text_matching expression="Ery\tMk\tMo\tNeu\tprogenitor"/>
360 <has_text_matching expression="18.86\d{4}"/> 360 <!-- <has_text_matching expression="18.8\d{4}"/>-->
361 <has_text_matching expression="17.85\d{4}"/> 361 <has_text_matching expression="17.85673"/>
362 <has_text_matching expression="-2.63\d{4}"/> 362 <!-- <has_text_matching expression="-2.637\d{4}"/>-->
363 <has_text_matching expression="-2.98\d{4}"/> 363 <!-- <has_text_matching expression="-2.980\d{4}"/>-->
364 <has_text_matching expression="-6.41\d{4}"/> 364 <has_text_matching expression="-6.46\d{4}"/>
365 </assert_contents> 365 </assert_contents>
366 </output> 366 </output>
367 <output name="uns_rank_genes_groups_logfoldchanges"> 367 <output name="uns_rank_genes_groups_logfoldchanges">
368 <assert_contents> 368 <assert_contents>
369 <has_n_columns n="5" /> 369 <has_n_columns n="5" />
370 </assert_contents> 370 </assert_contents>
371 </output> 371 </output>
372 <output name="uns_rank_genes_groups_pvals"> 372 <output name="uns_rank_genes_groups_pvals">
373 <assert_contents> 373 <assert_contents>
374 <has_n_columns n="5" /> 374 <has_n_columns n="5" />
375 <has_text_matching expression="1.8000"/> 375 <!-- <has_text_matching expression="1.8009"/>-->
376 </assert_contents> 376 </assert_contents>
377 </output> 377 </output>
378 <output name="uns_rank_genes_groups_pvals_adj"> 378 <output name="uns_rank_genes_groups_pvals_adj">
379 <assert_contents> 379 <assert_contents>
380 <has_n_columns n="5" /> 380 <has_n_columns n="5" />
381 <has_text_matching expression="1.98004"/> 381 <!-- <has_text_matching expression="1.97952"/>-->
382 </assert_contents> 382 </assert_contents>
383 </output> 383 </output>
384 </test> 384 </test>
385 <test> 385 <test expect_num_outputs="1">
386 <!-- test 11: obsm, X_pca --> 386 <!-- test 11: obsm, X_pca -->
387 <param name="input" value="pp.pca.krumsiek11.h5ad"/> 387 <param name="input" value="pp.pca.krumsiek11.h5ad"/>
388 <conditional name="inspect"> 388 <conditional name="inspect">
389 <param name="info" value="obsm"/> 389 <param name="info" value="obsm"/>
390 <param name="obsm_info" value="X_pca"/> 390 <param name="obsm_info" value="X_pca"/>
391 </conditional> 391 </conditional>
392 <output name="obsm_X_pca"> 392 <output name="obsm_X_pca">
393 <assert_contents> 393 <assert_contents>
394 <has_text_matching expression="0.00030471283" /> 394 <has_text_matching expression="0.0045348783" />
395 <has_text_matching expression="3.4109413e-05" /> 395 <has_text_matching expression="3.4109413" />
396 <has_text_matching expression="-0.6401007" /> 396 <has_text_matching expression="-0.6401007" />
397 <has_n_columns n="10" /> 397 <has_n_columns n="10" />
398 </assert_contents> 398 </assert_contents>
399 </output> 399 </output>
400 </test> 400 </test>
401 <test> 401 <test expect_num_outputs="1">
402 <!-- test 12: obsm_info, X_umap --> 402 <!-- test 12: obsm_info, X_umap -->
403 <param name="input" value="tl.umap.h5ad"/> 403 <param name="input" value="tl.umap.h5ad"/>
404 <conditional name="inspect"> 404 <conditional name="inspect">
405 <param name="info" value="obsm"/> 405 <param name="info" value="obsm"/>
406 <param name="obsm_info" value="X_umap"/> 406 <param name="obsm_info" value="X_umap"/>
413 <has_text text="-9.714" /> 413 <has_text text="-9.714" />
414 <has_n_columns n="2" /> 414 <has_n_columns n="2" />
415 </assert_contents> 415 </assert_contents>
416 </output> 416 </output>
417 </test> 417 </test>
418 <test> 418 <test expect_num_outputs="1">
419 <!-- test 13: obsm_info, X_tsne --> 419 <!-- test 13: obsm_info, X_tsne -->
420 <param name="input" value="tl.tsne.h5ad"/> 420 <param name="input" value="tl.tsne.h5ad"/>
421 <conditional name="inspect"> 421 <conditional name="inspect">
422 <param name="info" value="obsm"/> 422 <param name="info" value="obsm"/>
423 <param name="obsm_info" value="X_tsne"/> 423 <param name="obsm_info" value="X_tsne"/>
428 <has_text text="-19.447426" /> 428 <has_text text="-19.447426" />
429 <has_n_columns n="2" /> 429 <has_n_columns n="2" />
430 </assert_contents> 430 </assert_contents>
431 </output> 431 </output>
432 </test> 432 </test>
433 <test> 433 <test expect_num_outputs="1">
434 <!-- test 14: obsm_info, X_draw_graph --> 434 <!-- test 14: obsm_info, X_draw_graph -->
435 <param name="input" value="tl.draw_graph.h5ad"/> 435 <param name="input" value="tl.draw_graph.h5ad"/>
436 <conditional name="inspect"> 436 <conditional name="inspect">
437 <param name="info" value="obsm"/> 437 <param name="info" value="obsm"/>
438 <param name="obsm_info" value="X_draw_graph"/> 438 <param name="obsm_info" value="X_draw_graph"/>
447 <has_n_columns n="2" /> 447 <has_n_columns n="2" />
448 </assert_contents> 448 </assert_contents>
449 </element> 449 </element>
450 </output_collection> 450 </output_collection>
451 </test> 451 </test>
452 <test> 452 <test expect_num_outputs="1">
453 <!-- test 15: obsm_info, X_diffmap --> 453 <!-- test 15: obsm_info, X_diffmap -->
454 <param name="input" value="tl.diffmap.h5ad"/> 454 <param name="input" value="tl.diffmap.h5ad"/>
455 <conditional name="inspect"> 455 <conditional name="inspect">
456 <param name="info" value="obsm"/> 456 <param name="info" value="obsm"/>
457 <param name="obsm_info" value="X_diffmap"/> 457 <param name="obsm_info" value="X_diffmap"/>
462 <has_text text="-0.0619" /> 462 <has_text text="-0.0619" />
463 <has_n_columns n="15" /> 463 <has_n_columns n="15" />
464 </assert_contents> 464 </assert_contents>
465 </output> 465 </output>
466 </test> 466 </test>
467 <test> 467 <test expect_num_outputs="1">
468 <!-- test 16: varm_info, PCs --> 468 <!-- test 16: varm_info, PCs -->
469 <param name="input" value="pp.pca.krumsiek11.h5ad"/> 469 <param name="input" value="pp.pca.krumsiek11.h5ad"/>
470 <conditional name="inspect"> 470 <conditional name="inspect">
471 <param name="info" value="varm"/> 471 <param name="info" value="varm"/>
472 <param name="varm_info" value="PCs"/> 472 <param name="varm_info" value="PCs"/>