Mercurial > repos > iuc > anndata_inspect
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inspect.xml Wed Apr 10 03:25:39 2019 -0400 @@ -0,0 +1,164 @@ +<tool id="anndata_inspect" name="Inspect AnnData" version="@VERSION@+@GALAXY_VERSION@"> + <description>object</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="requirements"/> + <expand macro="version_command"/> + <command detect_errors="exit_code"><![CDATA[ +@CMD@ + ]]></command> + <configfiles> + <configfile name="script_file"><![CDATA[ +@CMD_imports@ + +adata = ad.read('$input') + +#if $inspect.info == 'general' +with open('$general', 'w') as f: + print(adata, file=f) +#else if $inspect.info == 'X' +adata.to_df().to_csv('$X', sep='\t') +#else if $inspect.info == 'obs' +adata.obs.to_csv('$obs', sep='\t') +#else if $inspect.info == 'var' +adata.var.to_csv('$var', sep='\t') +#else if $inspect.info == 'chunk_X' +import pandas as pd + #if $inspect.chunk.info == 'random' +X = adata.chunk_X(select=$inspect.chunk.size, replace=$inspect.chunk.replace) + #else + #set $select = [int(x.strip()) for x in str($inspect.chunk.list).split(',')] +X = adata.chunk_X(select=$select) + #end if +pd.DataFrame(X).to_csv('$chunk_X', sep='\t') +#end if +]]></configfile> + </configfiles> + <inputs> + <param name="input" type="data" format="h5ad" label="Annotated data matrix"/> + <conditional name="inspect"> + <param name="info" type="select" label="What to inspect?"> + <option value="general">General information about the object</option> + <option value="X">The full data matrix</option> + <option value="chunk_X">A chunk of the data matrix</option> + <option value="obs">Key-indexed observations annotation</option> + <option value="var">Key-indexed annotation of variables/features</option> + <!--<option value="uns">Unstructured annotation</option>!--> + </param> + <when value="general"/> + <when value="X"/> + <when value="obs"/> + <when value="var"/> + <when value="chunk_X"> + <expand macro="params_chunk_X"/> + </when> + </conditional> + </inputs> + <outputs> + <data name="general" format="txt" label="${tool.name} on ${on_string}: General information"> + <filter>inspect['info'] == 'general'</filter> + </data> + <data name="X" format="tabular" label="${tool.name} on ${on_string}: Key-indexed observations annotation (X)"> + <filter>inspect['info'] == 'X'</filter> + </data> + <data name="obs" format="tabular" label="${tool.name} on ${on_string}: Key-indexed observations annotation (obs)"> + <filter>inspect['info'] == 'obs'</filter> + </data> + <data name="var" format="tabular" label="${tool.name} on ${on_string}: Key-indexed annotation of variables/features (var)"> + <filter>inspect['info'] == 'var'</filter> + </data> + <data name="chunk_X" format="tabular" label="${tool.name} on ${on_string}: Observations annotation"> + <filter>inspect['info'] == 'chunk_X'</filter> + </data> + </outputs> + <tests> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="general"/> + </conditional> + <output name="general" value="inspect.general.txt"/> + </test> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="X"/> + </conditional> + <assert_stdout> + <has_text_matching expression="adata.to_df\(\).to_csv"/> + </assert_stdout> + <output name="X" value="inspect.X.tabular" ftype="tabular"/> + </test> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="obs"/> + </conditional> + <assert_stdout> + <has_text_matching expression="adata.obs.to_csv"/> + </assert_stdout> + <output name="obs" value="inspect.obs.tabular" ftype="tabular"/> + </test> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="var"/> + </conditional> + <assert_stdout> + <has_text_matching expression="adata.var.to_csv"/> + </assert_stdout> + <output name="var" value="inspect.var.tabular" ftype="tabular"/> + </test> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="chunk_X"/> + <conditional name="chunk"> + <param name="info" value="specified"/> + <param name="list" value="3,5,8"/> + </conditional> + </conditional> + <assert_stdout> + <has_text_matching expression="adata.chunk_X"/> + <has_text_matching expression="select=\[3, 5, 8\]"/> + </assert_stdout> + <output name="chunk_X" value="inspect.chunk_X.specified.tabular" ftype="tabular"/> + </test> + <test> + <param name="input" value="krumsiek11.h5ad"/> + <conditional name="inspect"> + <param name="info" value="chunk_X"/> + <conditional name="chunk"> + <param name="info" value="random"/> + <param name="list" value="10"/> + <param name="replace" value="true"/> + </conditional> + </conditional> + <assert_stdout> + <has_text_matching expression="adata.chunk_X"/> + <has_text_matching expression="select=10"/> + <has_text_matching expression="replace=True"/> + </assert_stdout> + <output name="chunk_X"> + <assert_contents> + <has_text_matching expression="0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"/> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ +**What it does** + +This tool inspects a AnnData dataset and returns: + +- General information about the object as text +- The full data matrix (`X`) as a Tabular +- 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>`__ +- Key-indexed observations annotation (`obs`) as a Tabular +- Key-indexed annotation of variables/features (`var`) as a Tabular + +@HELP@ + ]]></help> + <expand macro="citations"/> +</tool>