comparison data_reader.xml @ 1:1487421505f1 draft

Uploaded correct tool this time
author brenninc
date Wed, 23 Mar 2016 12:08:33 -0400
parents 25b07ce180d4
children 3911ee1a0078
comparison
equal deleted inserted replaced
0:25b07ce180d4 1:1487421505f1
1 <tool id="directory_data_reader" name="Directory Data Finder" version="0.2"> 1 <tool id="directory_table_reader" name="Directory Data Reader" version="0.2">
2 <description>Reads a particular data type from a directory on the server</description> 2 <description>Reads data from preconfigured directories table.</description>
3 <command interpreter="python"> 3 <command interpreter="python">
4 <![CDATA[ 4 <![CDATA[
5 directory_copier.py 5 directory_copier.py
6 #if $results.required=="data" 6 --ending .${directory.fields.original_extension}
7 --ending .${results.extension.file_type} 7 --new_ending .${directory.fields.galaxy_extension}
8 --link 8 #if $results.required=="data"
9 #if $results.start 9 --new_ending .${directory.fields.galaxy_extension}
10 --start $results.start 10 --decompress ${directory.fields.decompress}
11 #if $results.start
12 --start $results.start
13 #end if
14 #if $results.last
15 --last $results.last
16 #end if
11 #end if 17 #end if
12 #if $results.last 18 --path ${directory.fields.path}
13 --last $results.last 19 --list ${listing}
14 #end if 20 ]]>
15 #if $results.extension.file_type=="fa"
16 --new_ending .fasta
17 #end if
18 #if $results.extension.file_type=="fq"
19 --new_ending .fastq
20 #end if
21 #if $results.extension.file_type=="text"
22 --new_ending .txt
23 #end if
24 #if $results.extension.file_type=="tsv"
25 --new_ending .tabular
26 #end if
27 #if $results.extension.file_type in ["fasta.gz"]
28 --decompress
29 --new_ending .fasta
30 #end if
31 #if $results.extension.file_type=="fastq"
32 --new_ending .$results.extension.new_galaxy.new_ending
33 #end if
34 #if $results.extension.file_type=="fastq.gz"
35 --decompress
36 --new_ending .${results.extension.new_galaxy.new_ending}
37 #end if
38 #else
39 --ending bam
40 --ending csv
41 --ending fa
42 --ending fasta
43 --ending fasta.gz
44 --ending fastq
45 --ending fastq.gz
46 --ending fasta
47 --ending fq
48 --ending sam
49 --ending tabular
50 --ending text
51 --ending tsv
52 --ending txt
53 --ending xls
54 --ending xlsx
55 #end if
56 #if $directory.startswith('/'):
57 --path ${directory}
58 #else
59 --path $__tool_directory__/${directory}
60 #end if
61 --list ${listing}
62 ]]>
63 </command> 21 </command>
64 <macros>
65 <xml name="new_galaxy">
66 <conditional name="new_galaxy">
67 <param name="new_ending" type="select" label="Ending to be used for Galaxy" help="Will determine which down stream tools can be used.">
68 <option value="fastq" selected="true">Keep data as general fastq format</option>
69 <option value="fastqsanger">Tag data as fastq sanger in galaxy</option>
70 <option value="fastqsolexa">Tag data as fastq solexa in galaxy</option>
71 <option value="fastqillumina">Tag data as fastq illumina in galaxy</option>
72 </param>
73 <when value="fastq" />
74 <when value="fastqsanger" />
75 <when value="fastqsolexa" />
76 <when value="fastqillumina" />
77 </conditional>
78 </xml>
79 </macros>
80 <inputs> 22 <inputs>
81 <param name="directory" type="text" label="Directory to read data from." /> 23 <param name="directory" type="select" label="Directory to import data from">
24 <options from_data_table="directory_data"/>
25 <validator type="no_options" message="No Data Directory Setup"/>
26 </param>
82 <param name="list_name" type="text" size="25" label="output name" value="input data"/> 27 <param name="list_name" type="text" size="25" label="output name" value="input data"/>
83 <conditional name="results"> 28 <conditional name="results">
84 <param name="required" type="select" label="Download data or just directory listing" help="Select type of action required."> 29 <param name="required" type="select" label="Download data or just directory listing" help="Select type of action required.">
85 <option value="data" selected="true">Data and listing of selected type</option> 30 <option value="data" selected="true">Data and listing of selected type</option>
86 <option value="listing">Get listing of selected file types </option> 31 <option value="listing">Get listing of selected file types </option>
87 </param> 32 </param>
88 <when value="data"> 33 <when value="data">
89 <param name="start" type="text" value="" label="String which must be at the start of each file name" /> 34 <param name="start" type="text" value="" label="String which must be at the start of each file name" />
90 <param name="last" type="text" value="" label="String which must be at the end of the file name (excluding the file type)" /> 35 <param name="last" type="text" value="" label="String which must be at the end of the file name (excluding the file type)" />
91 <conditional name="extension">
92 <param name="file_type" type="select" label="File Type" help="File Type.">
93 <option value="bam">*.bam files</option>
94 <option value="csv">*.csv files</option>
95 <option value="fa">*.fa files Files saved as *.fasta for galaxy</option>
96 <option value="fasta">*.fasta files</option>
97 <option value="fasta.gz">*.fasta.gz files</option>
98 <option value="fastq">*.fastq files</option>
99 <option value="fastq.gz">*.fastq.gz files</option>
100 <option value="fastq">*.fastq files</option>
101 <option value="fastq.gz">*.fastq.gz files</option>
102 <option value="fq">*.fq files Files saved as *.fastq for galaxy</option>
103 <option value="sam">*.sam files</option>
104 <option value="tabular">*.tabular Files</option>
105 <option value="text">*.text Files saved as *.txt for galaxy</option>
106 <option value="tsv">*.tsv files saved as *.tabular for galaxy</option>
107 <option value="txt">*.txt Files</option>
108 <option value="xls">*.xls files</option>
109 <option value="xlsx">*.xlsx files</option>
110 </param>
111 <when value="bam" />
112 <when value="csv" />
113 <when value="fa" />
114 <when value="fasta" />
115 <when value="fasta.gz" />
116 <when value="fastq" >
117 <expand macro="new_galaxy"/>
118 </when>
119 <when value="fastq.gz" >
120 <expand macro="new_galaxy"/>
121 </when>
122 <when value="fq" >
123 <expand macro="new_galaxy"/>
124 </when>
125 <when value="sam" />
126 <when value="tabular" />
127 <when value="text" />
128 <when value="tsv" />
129 <when value="txt" />
130 <when value="xls" />
131 <when value="xlsx" />
132 </conditional>
133 </when> 36 </when>
134 <when value="listing"> 37 <when value="listing"/>
135 </when>
136 </conditional> 38 </conditional>
137 </inputs> 39 </inputs>
138 <outputs> 40 <outputs>
139 <data format="txt" name="listing" label="List of files in $list_name"> 41 <data format="txt" name="listing" label="List of files in $list_name">
140 </data> 42 </data>
144 <discover_datasets pattern="__designation_and_ext__" directory="output" visible="true" /> 46 <discover_datasets pattern="__designation_and_ext__" directory="output" visible="true" />
145 </collection> 47 </collection>
146 </outputs> 48 </outputs>
147 <tests> 49 <tests>
148 <test> 50 <test>
149 <param name="directory" value="test-data" /> 51 <param name="directory" value="fastq.gz_files_id" />
150 <param name="list_name" value="csv_files" /> 52 <param name="list_name" value="test_files" />
151 <param name="results|extension|file_type" value="csv"/> 53 <param name="results|required" value="listing"/>
152 <output name="listing">
153 <assert_contents>
154 <has_line line="sample1.csv" />
155 </assert_contents>
156 </output>
157 <output_collection name="data_collection" type="list">
158 <element name="sample1" ftype="csv" file="sample1.csv" />
159 </output_collection>
160 </test>
161 <test>
162 <param name="directory" value="test-data" />
163 <param name="results|extension|file_type" value="fa"/>
164 <output name="listing">
165 <assert_contents>
166 <has_line line="sample1.fasta" />
167 <has_line line="other.fasta" />
168 </assert_contents>
169 </output>
170 <output_collection name="data_collection" type="list">
171 <element name="sample1" ftype="fasta" file="sample1.fasta" />
172 <element name="other" ftype="fasta" file="sample1.fasta" />
173 </output_collection>
174 </test>
175 <test>
176 <param name="directory" value="test-data" />
177 <param name="results|extension|file_type" value="fasta"/>
178 <param name="results|start" value="sam" />
179 <output name="listing">
180 <assert_contents>
181 <has_line line="sample1.fasta" />
182 <not_has_text text="other.fasta" />
183 </assert_contents>
184 </output>
185 <output_collection name="data_collection" type="list">
186 <element name="sample1" ftype="fasta" file="sample1.fasta" />
187 </output_collection>
188 </test>
189 <test>
190 <param name="directory" value="test-data" />
191 <param name="results|extension|file_type" value="fasta.gz"/>
192 <param name="results|last" value="le1" />
193 <output name="listing">
194 <assert_contents>
195 <has_line line="sample1.fasta" />
196 <not_has_text text="other.fasta" />
197 </assert_contents>
198 </output>
199 <output_collection name="data_collection" type="list">
200 <element name="sample1" ftype="fasta" file="sample1.fasta" />
201 </output_collection>
202 </test>
203 <test>
204 <param name="directory" value="test-data" />
205 <param name="results|extension|file_type" value="fq"/>
206 <output name="listing">
207 <assert_contents>
208 <has_line line="sample1.fastq" />
209 </assert_contents>
210 </output>
211 <output_collection name="data_collection" type="list">
212 <element name="sample1" ftype="fastq" file="sample1.fastq" />
213 </output_collection>
214 </test>
215 <test>
216 <param name="directory" value="test-data" />
217 <param name="results|extension|file_type" value="fastq"/>
218 <output name="listing">
219 <assert_contents>
220 <has_line line="sample1.fastq" />
221 </assert_contents>
222 </output>
223 <output_collection name="data_collection" type="list">
224 <element name="sample1" ftype="fastq" file="sample1.fastq" />
225 </output_collection>
226 </test>
227 <test>
228 <param name="directory" value="test-data" />
229 <param name="results|extension|file_type" value="fastq"/>
230 <param name="results|extension|new_galaxy|new_ending" value="fastqsanger"/>
231 <output name="listing"> 54 <output name="listing">
232 <assert_contents> 55 <assert_contents>
233 <has_line line="sample1.fastqsanger" /> 56 <has_line line="sample1.fastqsanger" />
57 <has_line line="other.fastqsanger" />
234 </assert_contents> 58 </assert_contents>
235 </output> 59 </output>
236 <output_collection name="data_collection" type="list"> 60 </test>
237 <element name="sample1" ftype="fastqsanger" file="sample1.fastq" />
238 </output_collection>
239 </test>
240 <test> 61 <test>
241 <param name="directory" value="test-data" /> 62 <param name="directory" value="fastq.gz_files_id" />
242 <param name="results|extension|file_type" value="fastq.gz"/>
243 <output name="data_collection">
244 <assert_contents>
245 <has_line line="sample1.fastq" />
246 </assert_contents>
247 </output>
248 <output_collection name="data_collection" type="list">
249 <element name="sample1" ftype="fastq" file="sample1.fastq" />
250 </output_collection>
251 </test>
252 <test>
253 <param name="directory" value="test-data" />
254 <param name="results|extension|file_type" value="fastq.gz"/>
255 <param name="results|extension|new_galaxy|new_ending" value="fastqsanger"/>
256 <output name="listing_fastq_gz"> 63 <output name="listing_fastq_gz">
257 <assert_contents> 64 <assert_contents>
258 <has_line line="sample1.fastqsanger" /> 65 <has_line line="sample1.fastqsanger" />
259 </assert_contents> 66 </assert_contents>
260 </output> 67 </output>
261 <output_collection name="data_collection" type="list"> 68 <output_collection name="data_collection" type="list">
262 <element name="sample1" ftype="fastqsanger" file="sample1.fastq" /> 69 <element name="sample1" ftype="fastqsanger" file="sample1.fastq" />
70 <element name="other" ftype="fastqsanger" file="other.fastq" />
263 </output_collection> 71 </output_collection>
264 </test> 72 </test>
265 <test> 73 <test>
266 <param name="directory" value="test-data" /> 74 <param name="directory" value="fastq_files_id" />
267 <param name="results|extension|file_type" value="sam"/> 75 <param name="results|start" value="sam" />
268 <output name="listing"> 76 <output name="listing_fastq">
269 <assert_contents> 77 <assert_contents>
270 <has_line line="sample1.sam" /> 78 <has_line line="sample1.fastq" />
79 <not_has_text text="other.fasta" />
271 </assert_contents> 80 </assert_contents>
272 </output> 81 </output>
273 <output_collection name="data_collection" type="list"> 82 <output_collection name="data_collection" type="list">
274 <element name="sample1" ftype="sam" file="sample1.sam" /> 83 <element name="sample1" ftype="fastq" file="sample1.fastq" />
275 </output_collection> 84 </output_collection>
276 </test> 85 </test>
277 <test>
278 <param name="directory" value="test-data" />
279 <param name="results|extension|file_type" value="tabular"/>
280 <output name="listing">
281 <assert_contents>
282 <has_line line="sample1.tabular" />
283 </assert_contents>
284 </output>
285 <output_collection name="data_collection" type="list">
286 <element name="sample1" ftype="tabular" file="sample1.tabular" />
287 </output_collection>
288 </test>
289 <test>
290 <param name="directory" value="test-data" />
291 <param name="results|extension|file_type" value="text"/>
292 <output name="listing_text">
293 <assert_contents>
294 <has_line line="sample1.txt" />
295 </assert_contents>
296 </output>
297 <output_collection name="data_collection" type="list">
298 <element name="sample1" ftype="txt" file="sample1.text" />
299 </output_collection>
300 </test>
301 <test>
302 <param name="directory" value="test-data" />
303 <param name="results|extension|file_type" value="tsv"/>
304 <output name="data_collection">
305 <assert_contents>
306 <has_line line="sample1.tabular" />
307 </assert_contents>
308 </output>
309 <output_collection name="data_collection" type="list">
310 <element name="sample1" ftype="tabular" file="sample1.tsv" />
311 </output_collection>
312 </test>
313 <test>
314 <param name="directory" value="test-data" />
315 <param name="results|extension|file_type" value="txt" />
316 <output name="listing">
317 <assert_contents>
318 <has_line line="sample1.txt" />
319 </assert_contents>
320 </output>
321 <output_collection name="data_collection" type="list">
322 <element name="sample1" ftype="txt" file="sample1.txt" />
323 <element name="sample2" ftype="txt" file="sample2.txt" />
324 </output_collection>
325 </test>
326 <test>
327 <param name="directory" value="test-data" />
328 <param name="results|extension|file_type" value="xls"/>
329 <output name="listing">
330 <assert_contents>
331 <has_line line="sample1.xls" />
332 </assert_contents>
333 </output>
334 <output_collection name="data_collection" type="list">
335 <element name="sample1" ftype="xls" file="sample1.xls" />
336 </output_collection>
337 </test>
338 <test>
339 <param name="directory" value="test-data" />
340 <param name="results|extension|file_type" value="xlsx"/>
341 <output name="listing">
342 <assert_contents>
343 <has_line line="sample1.xlsx" />
344 </assert_contents>
345 </output>
346 <output_collection name="data_collection" type="list">
347 <element name="sample1" ftype="xlsx" file="sample1.xlsx" />
348 </output_collection>
349 </test>
350 <test>
351 <param name="directory" value="test-data" />
352 <param name="results|required" value="listing"/>
353 <output name="listing_all">
354 <assert_contents>
355 <has_line line="sample1.csv" />
356 <has_line line="sample1.fasta" />
357 <has_line line="sample1.fasta.gz" />
358 <has_line line="sample1.fastq" />
359 <has_line line="sample1.fastq.gz" />
360 <has_line line="sample1.sam" />
361 <has_line line="sample1.tabular" />
362 <has_line line="sample1.text" />
363 <has_line line="sample1.tsv" />
364 <has_line line="sample1.txt" />
365 <has_line line="sample1.xls" />
366 <has_line line="sample1.xlsx" />
367 </assert_contents>
368 </output>
369 </test>
370
371 </tests> 86 </tests>
372 87
373 <help> 88 <help>
374 <![CDATA[ 89 <![CDATA[
375 This tool will lookup files on the Galaxy server machine, including mounted directories. 90 This tool will lookup files on the Galaxy server machine, including mounted directories.
376 91
377 Only directories that are included in the white list and not in the black list are allowed. 92 Only directories and ending combinations set up by a Galaxy admin can be listed or loaded in this way.
378 If the directory you require does not pass the white list or blacklist test please contact the local galaxy admin.
379 (Admins see README)
380
381 This tool only supports a limited set of types and file extenstions.
382 No other files are ever returned either by data or listing.
383 These endings are case senitive. 93 These endings are case senitive.
384 94
385 ==== 95 ====
386 96
387 The data options will look for all files that have a particular ending in the selected directory. 97 The data options will look for all files that have a particular ending in the selected directory.
388 98
389 The tool will return two things. 99 The tool will return two things.
390 100
391 1. A Dataset collection of all the detected files. 101 1. A Dataset collection of all the detected files. (If data requested)
392 102
393 2. A file with the names of all the detected files. These will be sorted in the same order as galaxy builds the dataset collection. 103 2. A file with the names of all the detected files. These will be sorted in the same order as galaxy builds the dataset collection.
394 104
395 The files can be filtered by setting a specific start strinf for the file name. 105 The files can be filtered by setting a specific start string for the file name.
396 Only files that start with this string (case senstive) will be included. 106 Only files that start with this string (case senstive) will be included.
397 107
398 Files can also be filter for the last part before the file extsentions. 108 Files can also be filter for the last part before the file extsentions.
399 109
400 Assuming the directory has: 110 Assuming the directory has:
402 112
403 Setting start C01 will return just the C01 files: C01_R1_001.fasta C01_R2_001.fatsa 113 Setting start C01 will return just the C01 files: C01_R1_001.fasta C01_R2_001.fatsa
404 114
405 Setting last R1_001 will return the read1 files: C01_R1_001.fasta C02_R1_001.fasta 115 Setting last R1_001 will return the read1 files: C01_R1_001.fasta C02_R1_001.fasta
406 116
407 As Galaxy detects the file type based on the extension this tool will change the exstension for supported alternative file ends. 117 As Galaxy detects the file type based on the extension this tool will change the exstension as setup by the admin.
408 This includes (manually) setting the exstension to fastqsanger, fastqsolexa, fastqillumina for tools that specify one of these.
409 118
410 This tool will unzip gz files. 119 This tool will unzip gz files if requested to by the admin,
411 120
412 ====
413
414 The listing option will return a txt file with all the files found with any of the supported endings. Other files in that directory are not included.
415
416 The file exstensions are left as in the directory.
417
418 File start and last filters are not supported in this mode.
419 ]]> 121 ]]>
420 </help> 122 </help>
421 <citations> 123 <citations>
422 </citations> 124 </citations>
423 125