comparison modify_loom.xml @ 9:0f1aaff9b22d draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/anndata/ commit 67b3808b56df343798263ff0c905df8cb789edfa
author iuc
date Sat, 14 Sep 2024 19:59:12 +0000
parents 4b0adaa31c95
children
comparison
equal deleted inserted replaced
8:e98619de2776 9:0f1aaff9b22d
1 <tool id="modify_loom" name="Manipulate loom object" version="@TOOL_VERSION@+galaxy1"> 1 <tool id="modify_loom" name="Loom operations" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>Add layers, or row/column attributes to a loom file</description> 2 <description>Manipulate, export and import loom data</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 </macros> 5 </macros>
6 <expand macro="requirements"/> 6 <expand macro="requirements">
7 <requirement type="package" version="1.26.4">numpy</requirement><!-- loompy seems to adapt to numpy 2.x. Remove this in the next update -->
8 </expand>
7 <expand macro="version_command"/> 9 <expand macro="version_command"/>
8 <command detect_errors="exit_code"><![CDATA[ 10 <command detect_errors="exit_code"><![CDATA[
9 cp '${input}' loom_add_out.loom && 11 #if $operation.to_perform == 'manipulate'
10 python '$__tool_directory__/modify_loom.py' -f 'loom_add_out.loom' 12 cp '${operation.loom}' converted.loom &&
11 #if $which_add.add_type == "cols": 13 python '$__tool_directory__/modify_loom.py' -f 'converted.loom'
12 -a cols -c '${which_add.cols}' 14 #if $operation.which_add.add_type == "cols":
13 #else if $which_add.add_type == "cols": 15 -a cols -c '${operation.which_add.cols}'
14 -a rows -r '${which_add.rows}' 16 #else if $operation.which_add.add_type == "rows":
15 #else if $which_add.add_type == "layers": 17 -a rows -r '${operation.which_add.rows}'
16 -a layers -l '${which_add.layers}' 18 #else if $operation.which_add.add_type == "layers":
19 -a layers -l '${operation.which_add.layers}'
20 #end if
21
22 #else if $operation.to_perform == 'export'
23 mkdir ./output &&
24 mkdir ./attributes &&
25 python '$__tool_directory__/loompy_to_tsv.py' -f '$operation.loom'
26
27 #else if $operation.to_perform == 'import'
28 #if $operation.from.file_type == 'ad'
29 @CMD@
30 #else if $operation.from.file_type == 'tab'
31 python '$__tool_directory__/tsv_to_loompy.py'
32 -c '${operation.coldata}'
33 -r '${operation.rowdata}'
34 -f '${operation.mainmatrix}'
35 #if $operation.other_files
36 '${operation.other_files}'
37 #end if
38 #end if
17 #end if 39 #end if
18 ]]></command> 40 ]]></command>
41 <configfiles>
42 <configfile name="script_file"><![CDATA[
43 @CMD_imports@
44 #if $operation.to_perform == 'import'
45 #if $operation.from.file_type == 'ad'
46 adata = ad.read_h5ad('$operation.anndata')
47 adata.write_loom('converted.loom')
48 #end if
49 #end if
50 ]]></configfile>
51 </configfiles>
19 <inputs> 52 <inputs>
20 <param name="input" type="data" format="loom" label="Loom file"/> 53 <conditional name="operation">
21 <conditional name="which_add"> 54 <param name="to_perform" type="select" label="Operation to perform on loom data">
22 <param name="add_type" type="select" label="Select data attribute to add to loom"> 55 <option value="manipulate">Manipulate loom data</option>
23 <option value="cols">Columns</option> 56 <option value="export">Export loom layers and attributes</option>
24 <option value="rows">Rows</option> 57 <option value="import">Import loom from an anndata or tabular files</option>
25 <option value="layers">Layers</option>
26 </param> 58 </param>
27 <when value="cols"> 59 <when value="manipulate">
28 <param name="cols" type="data" format="tabular" label="Column file of same dimensions as existing file"/> 60 <param name="loom" type="data" format="loom" label="Loom file"/>
61 <conditional name="which_add">
62 <param name="add_type" type="select" label="Select data attribute to add to loom">
63 <option value="cols">Columns</option>
64 <option value="rows">Rows</option>
65 <option value="layers">Layers</option>
66 </param>
67 <when value="cols">
68 <param name="cols" type="data" format="tabular" label="Column file of same dimensions as existing file"/>
69 </when>
70 <when value="rows">
71 <param name="rows" type="data" format="tabular" label="Row file of same dimensions as existing file"/>
72 </when>
73 <when value="layers">
74 <param name="layers" type="data" multiple="true" format="tabular" label="Layer file(s) of same dimensions as existing file"/>
75 </when>
76 </conditional>
29 </when> 77 </when>
30 <when value="rows"> 78 <when value="export">
31 <param name="rows" type="data" format="tabular" label="Row file of same dimensions as existing file"/> 79 <param name="loom" type="data" format="loom" label="Loom file"/>
32 </when> 80 </when>
33 <when value="layers"> 81 <when value="import">
34 <param name="layers" type="data" multiple="true" format="tabular" label="Layer file(s) of same dimensions as existing file"/> 82 <conditional name="from">
83 <param name="file_type" type="select" label="Create loom file from">
84 <option value="ad">an anndata object</option>
85 <option value="tab">from tabular files of matrix and row and column attributes</option>
86 </param>
87 <when value="ad">
88 <param name="anndata" type="data" format="h5ad" label="Anndata file"/>
89 </when>
90 <when value="tab">
91 <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'"/>
92 <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."/>
93 <param name="coldata" type="data" format="tabular" label="Tsv of column data." help="First row is column attributes, subsequent are values."/>
94 <param name="rowdata" type="data" format="tabular" label="Tsv of row data." help="First row is row attributes, subsequent are values."/>
95 </when>
96 </conditional>
97
35 </when> 98 </when>
36 </conditional> 99 </conditional>
37 </inputs> 100 </inputs>
38 <outputs> 101 <outputs>
39 <data name="loomout" format="loom" from_work_dir='loom_add_out.loom' label="Expanded loom file from '${on_string}'"/> 102 <data name="loomout" format="loom" from_work_dir='converted.loom' label="${tool.name} (${operation.to_perform}) on ${on_string} Loom file">
103 <filter>operation['to_perform'] == 'manipulate' or operation['to_perform'] == 'import'</filter>
104 </data>
105 <collection name="layer_tsvs" type="list" label="Layer matrices" >
106 <filter>operation['to_perform'] == 'export'</filter>
107 <discover_datasets pattern="__designation__" format="tabular" directory="output" visible="false" />
108 </collection>
109 <collection name="attribute_tsvs" type="list" label="Attribute matrices" >
110 <filter>operation['to_perform'] == 'export'</filter>
111 <discover_datasets pattern="__designation__" format="tabular" directory="attributes" visible="false" />
112 </collection>
40 </outputs> 113 </outputs>
41 <tests> 114 <tests>
42 <test expect_num_outputs="1"> 115 <test expect_num_outputs="1">
43 <param name="input" value="addtest.loom"/> 116 <conditional name="operation">
44 <param name="add_type" value="cols"/> 117 <param name="to_perform" value="manipulate"/>
45 <param name="cols" value="cols.tsv"/> 118 <param name="loom" value="addtest.loom"/>
119 <conditional name="which_add">
120 <param name="add_type" value="cols"/>
121 <param name="cols" value="cols.tsv"/>
122 </conditional>
123 </conditional>
46 <output name="loomout" value="addloomout1.loom" ftype="loom" compare="sim_size"/> 124 <output name="loomout" value="addloomout1.loom" ftype="loom" compare="sim_size"/>
47 </test> 125 </test>
48 <test expect_num_outputs="1"> 126 <test expect_num_outputs="1">
49 <param name="input" value="addtest.loom"/> 127 <conditional name="operation">
50 <param name="add_type" value="rows"/> 128 <param name="to_perform" value="manipulate"/>
51 <param name="rows" value="rows.tsv"/> 129 <param name="loom" value="addtest.loom"/>
130 <conditional name="which_add">
131 <param name="add_type" value="rows"/>
132 <param name="rows" value="rows.tsv"/>
133 </conditional>
134 </conditional>
52 <output name="loomout" value="addloomout2.loom" ftype="loom" compare="sim_size"/> 135 <output name="loomout" value="addloomout2.loom" ftype="loom" compare="sim_size"/>
53 </test> 136 </test>
54 <test expect_num_outputs="1"> 137 <test expect_num_outputs="1">
55 <param name="input" value="addtest.loom"/> 138 <conditional name="operation">
56 <param name="add_type" value="layers"/> 139 <param name="to_perform" value="manipulate"/>
57 <param name="layers" value="addlayer1.tsv"/> 140 <param name="loom" value="addtest.loom"/>
141 <conditional name="which_add">
142 <param name="add_type" value="layers"/>
143 <param name="layers" value="addlayer1.tsv"/>
144 </conditional>
145 </conditional>
58 <output name="loomout" value="addloomout3.loom" ftype="loom" compare="sim_size"/> 146 <output name="loomout" value="addloomout3.loom" ftype="loom" compare="sim_size"/>
147 </test>
148 <test expect_num_outputs="2">
149 <conditional name="operation">
150 <param name="to_perform" value="export"/>
151 <param name="loom" value="loomtest.loom"/>
152 </conditional>
153 <output_collection name="layer_tsvs" type="list">
154 <element name="extralayer.tsv" value="secondlayer.tsv" ftype="tabular"/>
155 <element name="mainmatrix.tsv" value="firstlayer.tsv" ftype="tabular"/>
156 <element name="thirdlayer.tsv" value="finallayer.tsv" ftype="tabular"/>
157 </output_collection>
158 <output_collection name="attribute_tsvs" type="list">
159 <element name="col_attr.tsv" value="cols.tsv" ftype="tabular"/>
160 <element name="row_attr.tsv" value="rows.tsv" ftype="tabular"/>
161 </output_collection>
162 </test>
163 <test expect_num_outputs="1">
164 <conditional name="operation">
165 <param name="to_perform" value="import"/>
166 <conditional name="from">
167 <param name="file_type" value="ad"/>
168 <param name="anndata" value="krumsiek11.h5ad"/>
169 </conditional>
170 </conditional>
171 <assert_stdout>
172 <has_text_matching expression="adata.write_loom"/>
173 </assert_stdout>
174 <output name="loomout" value="export.krumsiek11.loom" ftype="loom" compare="sim_size"/>
175 </test>
176 <test expect_num_outputs="1">
177 <conditional name="operation">
178 <param name="to_perform" value="import"/>
179 <conditional name="from">
180 <param name="file_type" value="tab"/>
181 <param name="mainmatrix" value="firstlayer.tsv"/>
182 <param name="other_files" value="secondlayer.tsv"/>
183 <param name="coldata" value="cols.tsv"/>
184 <param name="rowdata" value="rows.tsv"/>
185 </conditional>
186 </conditional>
187 <output name="loomout" value="converted.loom.test" ftype="loom" compare="sim_size"/>
59 </test> 188 </test>
60 </tests> 189 </tests>
61 <help><![CDATA[ 190 <help><![CDATA[
62 This tool allows the user to modify an existing loom data file by adding column attributes, row attributes or additional layers via tsv files. 191 This tool allows the user to modify an existing loom data file by adding column attributes, row attributes or additional layers via tsv files.
63 ]]></help> 192 ]]></help>