Skip to content

Commit

Permalink
Merge pull request #6309 from pavanvidem/anndata-0.10.9
Browse files Browse the repository at this point in the history
Update Anndata to 0.10.9
  • Loading branch information
bgruening authored Sep 14, 2024
2 parents 7ea6e1e + 953f226 commit 67b3808
Show file tree
Hide file tree
Showing 37 changed files with 597 additions and 308 deletions.
96 changes: 11 additions & 85 deletions tools/anndata/export.xml
Original file line number Diff line number Diff line change
@@ -1,90 +1,33 @@
<tool id="anndata_export" name="Export AnnData and loom files" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
<description>Interconvert AnnData and Loom formats</description>
<tool id="anndata_export" name="Export AnnData" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>matrix and annotations</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements"/>
<expand macro="version_command"/>
<command detect_errors="exit_code"><![CDATA[
#if $hd5_format.filetype == 'anndata':
@CMD@
#else:
@LOOMCMD@
#end if
@CMD@
]]></command>
<configfiles>
<configfile name="script_file"><![CDATA[
@CMD_imports@
#if $hd5_format.filetype == 'anndata':
adata = ad.read_h5ad('$hd5_format.input')
#if $hd5_format.output_format == 'loom':
adata.write_loom('anndata.loom')
#else if $hd5_format.output_format == 'tabular':
adata = ad.read_h5ad('$input')
adata.write_csvs('.', sep="\t", skip_data = False)
#end if
#end if
]]></configfile>
</configfiles>
<inputs>
<conditional name="hd5_format">
<param name="filetype" type="select" label="hd5 format">
<option value="anndata" selected="true">Anndata file</option>
<option value="loom">Loom file</option>
</param>
<when value="anndata">
<param name="input" type="data" format="h5ad" label="Annotated data matrix"/>
<param name="output_format" type="select" label="Format to write the annotated data matrix">
<option value="loom">loom</option>
<option value="tabular">Tabular</option>
</param>
</when>
<when value="loom">
<param name="input" type="data" format="loom" label="Loom file to be exported to a series of tabular files."/>
</when>
</conditional>
<param name="input" type="data" format="h5ad" label="Annotated data matrix to export" help="Create individual tabular files for matrix, obs, obsm, var and varm annotations"/>
</inputs>
<outputs>
<data name="loom_output" format="loom" from_work_dir="anndata.loom" label="${tool.name} on ${on_string}: Annotated data matrix">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'loom'</filter>
</data>
<data name="tabular_x" format="tabular" from_work_dir="X.csv" label="${tool.name} on ${on_string}: Matrix table (X)">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
</data>
<data name="tabular_obs" format="tabular" from_work_dir="obs.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional observations annotation (obs)">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
</data>
<data name="tabular_obsm" format="tabular" from_work_dir="obsm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional observations annotation (obsm)">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
</data>
<data name="tabular_var" format="tabular" from_work_dir="var.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional variables annotation (var)">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
</data>
<data name="tabular_varm" format="tabular" from_work_dir="varm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional variables annotation (varm)">
<filter>hd5_format['filetype'] == 'anndata' and hd5_format['output_format'] == 'tabular'</filter>
</data>
<collection name="layer_tsvs" type="list" label="Layer matrices" >
<filter>hd5_format['filetype'] == 'loom'</filter>
<discover_datasets pattern="__designation__" format="tabular" directory="output" visible="false" />
</collection>
<collection name="attribute_tsvs" type="list" label="Attribute matrices" >
<filter>hd5_format['filetype'] == 'loom'</filter>
<discover_datasets pattern="__designation__" format="tabular" directory="attributes" visible="false" />
</collection>
<data name="tabular_x" format="tabular" from_work_dir="X.csv" label="${tool.name} on ${on_string}: Matrix table (X)"/>
<data name="tabular_obs" format="tabular" from_work_dir="obs.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional observations annotation (obs)"/>
<data name="tabular_obsm" format="tabular" from_work_dir="obsm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional observations annotation (obsm)"/>
<data name="tabular_var" format="tabular" from_work_dir="var.csv" label="${tool.name} on ${on_string}: Key-indexed one-dimensional variables annotation (var)"/>
<data name="tabular_varm" format="tabular" from_work_dir="varm.csv" label="${tool.name} on ${on_string}: Key-indexed multi-dimensional variables annotation (varm)"/>
</outputs>
<tests>
<test expect_num_outputs="1">
<param name="filetype" value="anndata"/>
<param name="input" value="krumsiek11.h5ad"/>
<param name="output_format" value="loom"/>
<assert_stdout>
<has_text_matching expression="adata.write_loom"/>
</assert_stdout>
<output name="loom_output" value="export.krumsiek11.loom" ftype="loom" compare="sim_size"/>
</test>
<test expect_num_outputs="5">
<param name="filetype" value="anndata"/>
<param name="input" value="krumsiek11.h5ad"/>
<param name="output_format" value="tabular"/>
<assert_stdout>
<has_text_matching expression="adata.write_csvs"/>
</assert_stdout>
Expand All @@ -94,26 +37,9 @@ adata.write_csvs('.', sep="\t", skip_data = False)
<output name="tabular_var" value="export.krumsiek11.var.tabular" ftype="tabular"/>
<output name="tabular_varm" value="export.krumsiek11.varm.tabular" ftype="tabular"/>
</test>
<test expect_num_outputs="2">
<param name="filetype" value="loom"/>
<param name="input" value="loomtest.loom"/>
<output_collection name="layer_tsvs" type="list">
<element name="mainmatrix.tsv" value="firstlayer.tsv" ftype="tabular"/>
<element name="extralayer.tsv" value="secondlayer.tsv" ftype="tabular"/>
<element name="thirdlayer.tsv" value="finallayer.tsv" ftype="tabular"/>
</output_collection>
<output_collection name="attribute_tsvs" type="list">
<element name="row_attr.tsv" value="rows.tsv" ftype="tabular"/>
<element name="col_attr.tsv" value="cols.tsv" ftype="tabular"/>
</output_collection>
</test>
</tests>
<help><![CDATA[
This tool exports an AnnData dataset to a Loom file
(`write_loom method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.write_loom.html>`__)
or a Tabular file (`write_csvs method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.write_csvs.html>`__)
It can also create a series of tabular files from an input loom dataset.
This tool exports an AnnData dataset to a tabular files (`write_csvs method <https://anndata.readthedocs.io/en/latest/generated/anndata.AnnData.write_csvs.html>`__)
@HELP@
]]></help>
Expand Down
Loading

0 comments on commit 67b3808

Please sign in to comment.