Mercurial > repos > iuc > anndata_import
diff import.xml @ 3:b5c7ba11401d draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit dc9d19d1f902f3ed54009cd0e68c8518c284b856"
author | iuc |
---|---|
date | Mon, 06 Jan 2020 13:45:13 -0500 |
parents | e175d4067b00 |
children | 32e547223c9e |
line wrap: on
line diff
--- a/import.xml Thu Dec 12 09:23:27 2019 -0500 +++ b/import.xml Mon Jan 06 13:45:13 2020 -0500 @@ -1,4 +1,4 @@ -<tool id="anndata_import" name="Import AnnData" version="@VERSION@+@GALAXY_VERSION@"> +<tool id="anndata_import" name="Import Anndata and loom" version="@VERSION@+@GALAXY_VERSION@"> <description>from different format</description> <macros> <import>macros.xml</import> @@ -17,124 +17,155 @@ </expand> <expand macro="version_command"/> <command detect_errors="exit_code"><![CDATA[ -#if $in.adata_format == 'mtx' -mkdir mtx - #if $in.tenx.use == 'legacy_10x' -&& cp '$in.matrix' 'mtx/matrix.mtx' -&& cp '$in.tenx.genes' 'mtx/genes.tsv' -&& cp '$in.tenx.barcodes' 'mtx/barcodes.tsv' - #else if $in.tenx.use == 'v3_10x' -&& cp '$in.matrix' 'mtx/matrix.mtx' -&& gzip 'mtx/matrix.mtx' -&& cp '$in.tenx.features' 'mtx/features.tsv' -&& gzip 'mtx/features.tsv' -&& cp '$in.tenx.barcodes' 'mtx/barcodes.tsv' -&& gzip 'mtx/barcodes.tsv' +#if $hd5_format.filetype == 'anndata' + #if $hd5_format.in.adata_format == 'mtx' + mkdir mtx + #if $hd5_format.in.tenx.use == 'legacy_10x' + && cp '$hd5_format.in.matrix' 'mtx/matrix.mtx' + && cp '$hd5_format.in.tenx.genes' 'mtx/genes.tsv' + && cp '$hd5_format.in.tenx.barcodes' 'mtx/barcodes.tsv' + #else if $hd5_format.in.tenx.use == 'v3_10x' + && cp '$hd5_format.in.matrix' 'mtx/matrix.mtx' + && gzip 'mtx/matrix.mtx' + && cp '$hd5_format.in.tenx.features' 'mtx/features.tsv' + && gzip 'mtx/features.tsv' + && cp '$hd5_format.in.tenx.barcodes' 'mtx/barcodes.tsv' + && gzip 'mtx/barcodes.tsv' + #end if + && + #else if $hd5_format.in.adata_format == 'umi_tools' + gzip '$hd5_format.in.input' + && #end if -&& -#else if $in.adata_format == 'umi_tools' -gzip '$in.input' -&& -#end if + + @CMD@ + + #if $hd5_format.in.adata_format == 'mtx' + && rm -rf mtx + #end if -@CMD@ - -#if $in.adata_format == 'mtx' -&& rm -rf mtx +#else: + python '$__tool_directory__/tsv_to_loompy.py' + -c '${hd5_format.coldata}' + -r '${hd5_format.rowdata}' + -f '${hd5_format.mainmatrix}' + #if $hd5_format.other_files: + '${hd5_format.other_files}' + #end if #end if ]]></command> <configfiles> <configfile name="script_file"><![CDATA[ @CMD_imports@ -#if $in.adata_format == 'loom' +#if $hd5_format.filetype == 'anndata' +#if $hd5_format.in.adata_format == 'loom' adata = ad.read_loom( - '$in.input', - sparse=$in.sparse, - cleanup=$in.cleanup, - X_name='$in.x_name', - obs_names='$in.obs_names', - var_names='$in.var_names') + '$hd5_format.in.input', + sparse=$hd5_format.in.sparse, + cleanup=$hd5_format.in.cleanup, + X_name='$hd5_format.in.x_name', + obs_names='$hd5_format.in.obs_names', + var_names='$hd5_format.in.var_names') -#else if $in.adata_format == 'tabular' - #set delimiter=$in.input.metadata.delimiter +#else if $hd5_format.in.adata_format == 'tabular' + #set delimiter=$hd5_format.in.input.metadata.delimiter #if $delimiter != ',' #set delimiter='\\t' #end if adata = ad.read_csv( - '$in.input', + '$hd5_format.in.input', delimiter='$delimiter', - first_column_names=$in.first_column_names) + first_column_names=$hd5_format.in.first_column_names) -#else if $in.adata_format == 'mtx' - #if $in.tenx.use == 'no' -adata = ad.read_mtx(filename='$in.matrix') +#else if $hd5_format.in.adata_format == 'mtx' + #if $hd5_format.in.tenx.use == 'no' +adata = ad.read_mtx(filename='$hd5_format.in.matrix') #else import scanpy as sc adata = sc.read_10x_mtx( 'mtx', - var_names='$in.tenx.var_names', - make_unique=$in.tenx.make_unique, + var_names='$hd5_format.in.tenx.var_names', + make_unique=$hd5_format.in.tenx.make_unique, cache=False, - gex_only=$in.tenx.gex_only) + gex_only=$hd5_format.in.tenx.gex_only) #end if -#else if $in.adata_format == 'umi_tools' -adata = ad.read_umi_tools('${in.input}.gz') +#else if $hd5_format.in.adata_format == 'umi_tools' +adata = ad.read_umi_tools('${hd5_format.in.input}.gz') #end if - adata.write('anndata.h5ad') +#end if ]]></configfile> </configfiles> <inputs> - <conditional name="in"> - <param name="adata_format" type="select" label="Format for the annotated data matrix"> - <option value="loom">Loom</option> - <option value="tabular">Tabular, CSV, TSV</option> - <option value="mtx">Matrix Market (mtx), from Cell ranger or not</option> - <option value="umi_tools">UMI tools</option> + <conditional name="hd5_format"> + <param name="filetype" type="select" label="hd5 format to be created"> + <option value="anndata" selected="true">Anndata file</option> + <option value="loom">Loom file</option> </param> - <when value="loom"> - <param name="input" type="data" format="loom" label="Annotated data matrix"/> - <param name="sparse" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Is the data matrix to read sparse?"/> - <param name="cleanup" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Cleanup?"/> - <param name="x_name" type="text" value="spliced" label="X_name"/> - <param name="obs_names" type="text" value="CellID" label="obs_names"/> - <param name="var_names" type="text" value="Gene" label="var_names"/> - </when> - <when value="tabular"> - <param name="input" type="data" format="tabular,csv,tsv" label="Annotated data matrix"/> - <param name="first_column_names" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Does the first column store the row names?"/> - </when> - <when value="mtx"> - <param name="matrix" type="data" format="mtx" label="Matrix"/> - <conditional name="tenx"> - <param name="use" type="select" label="Use 10x Genomics formatted mtx"> - <option value="no">No</option> - <option value="legacy_10x">Output from Cell Ranger v2 or earlier versions</option> - <option value="v3_10x">Output from Cell Ranger v3 or later versions</option> + <when value="anndata"> + <conditional name="in"> + <param name="adata_format" type="select" label="Format for the annotated data matrix"> + <option value="loom">Loom</option> + <option value="tabular">Tabular, CSV, TSV</option> + <option value="mtx">Matrix Market (mtx), from Cell ranger or not</option> + <option value="umi_tools">UMI tools</option> </param> - <when value="no"/> - <when value="legacy_10x"> - <param name="genes" type="data" format="tabular" label="Genes"/> - <expand macro="params_10x"/> + <when value="loom"> + <param name="input" type="data" format="loom" label="Annotated data matrix"/> + <param name="sparse" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Is the data matrix to read sparse?"/> + <param name="cleanup" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Cleanup?"/> + <param name="x_name" type="text" value="spliced" label="X_name"/> + <param name="obs_names" type="text" value="CellID" label="obs_names"/> + <param name="var_names" type="text" value="Gene" label="var_names"/> + </when> + <when value="tabular"> + <param name="input" type="data" format="tabular,csv,tsv" label="Annotated data matrix"/> + <param name="first_column_names" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Does the first column store the row names?"/> </when> - <when value="v3_10x"> - <param name="features" type="data" format="tabular" label="Features"/> - <expand macro="params_10x"/> + <when value="mtx"> + <param name="matrix" type="data" format="mtx" label="Matrix"/> + <conditional name="tenx"> + <param name="use" type="select" label="Use 10x Genomics formatted mtx"> + <option value="no">No</option> + <option value="legacy_10x">Output from Cell Ranger v2 or earlier versions</option> + <option value="v3_10x">Output from Cell Ranger v3 or later versions</option> + </param> + <when value="no"/> + <when value="legacy_10x"> + <param name="genes" type="data" format="tabular" label="Genes"/> + <expand macro="params_10x"/> + </when> + <when value="v3_10x"> + <param name="features" type="data" format="tabular" label="Features"/> + <expand macro="params_10x"/> + </when> + </conditional> + </when> + <when value="umi_tools"> + <param name="input" type="data" format="tabular" label="condensed count matrix from UMI tools"/> </when> </conditional> </when> - <when value="umi_tools"> - <param name="input" type="data" format="tabular" label="condensed count matrix from UMI tools"/> + <when value="loom"> + <param name="mainmatrix" type="data" format="tabular" label="File for main layer of loom file." help="All subsequent tsv must be the same dimensions as this file. When converted back to tsv using hd5 export, this will be labeled as 'mainmatrix.tsv'"/> + <param name="other_files" type="data" format="tabular" multiple="true" optional="true" label="Add layers" help="Adds layers of same dimension to the loom file. When converted to tsv using hd5 export, these layers will retain their names."/> + <param name="coldata" type="data" format="tabular" label="Tsv of column data." help="First row is column attributes, subsequent are values."/> + <param name="rowdata" type="data" format="tabular" label="Tsv of row data." help="First row is row attributes, subsequent are values."/> </when> </conditional> </inputs> <outputs> - <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="${tool.name} on ${on_string}"/> + <data name="anndata" format="h5ad" from_work_dir="anndata.h5ad" label="Anndata import on ${on_string}"> + <filter>hd5_format['filetype'] == 'anndata'</filter> + </data> + <data name="loomdata" format="loom" from_work_dir="converted.loom" label="Loom import on ${on_string}"> + <filter>hd5_format['filetype'] == 'loom'</filter> + </data> </outputs> <tests> - <test> + <test expect_num_outputs="1"> <conditional name="in"> <param name="adata_format" value="loom"/> <param name="input" value="krumsiek11.loom" /> @@ -154,7 +185,7 @@ </assert_stdout> <output name="anndata" value="import.loom.krumsiek11.h5ad" ftype="h5ad" compare="sim_size"/> </test> - <test> + <test expect_num_outputs="1"> <conditional name="in"> <param name="adata_format" value="tabular"/> <param name="input" value="adata.csv"/> @@ -167,7 +198,7 @@ </assert_stdout> <output name="anndata" value="import.csv.h5ad" ftype="h5ad" compare="sim_size"/> </test> - <test> + <test expect_num_outputs="1"> <conditional name="in"> <param name="adata_format" value="tabular"/> <param name="input" value="adata.tsv"/> @@ -180,7 +211,7 @@ </assert_stdout> <output name="anndata" value="import.tsv.h5ad" ftype="h5ad" compare="sim_size"/> </test> - <!--<test> + <!--<test expect_num_outputs="1"> <conditional name="in"> <param name="adata_format" value="mtx"/> <param name="matrix" value="matrix_10x_v1.2.0.mtx"/> @@ -220,23 +251,32 @@ </conditional> <output name="anndata" value="import.mtx.v3_10x.h5ad" ftype="h5ad" compare="sim_size"/> </test>!--> - <test> + <test expect_num_outputs="1"> + <param name="filetype" value="anndata"/> <conditional name="in"> <param name="adata_format" value="umi_tools"/> <param name="input" value="umi_tools.tsv"/> </conditional> <output name="anndata" value="import.umi_tools.h5ad" ftype="h5ad" compare="sim_size"/> </test> + <test expect_num_outputs="1"> + <param name="filetype" value="loom"/> + <param name="mainmatrix" value="firstlayer.tsv"/> + <param name="other_files" value="secondlayer.tsv"/> + <param name="coldata" value="cols.tsv"/> + <param name="rowdata" value="rows.tsv"/> + <output name="loomdata" value="converted.loom.test" ftype="loom" compare="sim_size"/> + </test> </tests> <help><![CDATA[ **What it does** -This tool creates an AnnData dataset from several input types: +This tool creates an AnnData or loom dataset from several input types: -- Loom (`read_loom method <https://anndata.readthedocs.io/en/latest/anndata.read_loom.html>`__) -- Tabular (`read_csv method <https://anndata.readthedocs.io/en/latest/anndata.read_csv.html>`__) -- Matrix Market (mtx), from Cell ranger or not (`read_mtx method <https://anndata.readthedocs.io/en/latest/anndata.read_mtx.html>`__) -- UMI tools (`read_umi_tools method <https://anndata.readthedocs.io/en/latest/anndata.read_umi_tools.html>`__) +- Loom (`read_loom method <https://anndata.readthedocs.io/en/latest/anndata.read_loom.html>`__) +- Tabular (`read_csv method <https://anndata.readthedocs.io/en/latest/anndata.read_csv.html>`__) +- Matrix Market (mtx), from Cell ranger or not (`read_mtx method <https://anndata.readthedocs.io/en/latest/anndata.read_mtx.html>`__) +- UMI tools (`read_umi_tools method <https://anndata.readthedocs.io/en/latest/anndata.read_umi_tools.html>`__) @HELP@ ]]></help>