Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Anndata to 0.10.9 #6309

Merged
merged 17 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add, make sure, a profile version is in all tools

Suggested change
<tool id="anndata_export" name="Export AnnData" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
<tool id="anndata_export" name="Export AnnData" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE_VERSION@">

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set profile to 21.09 (same as scanpy) to support other instances. See here: #6001

<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