comparison random_select.xml @ 0:156371cbc343 tip

planemo upload
author jpayne
date Tue, 06 Feb 2018 13:30:07 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:156371cbc343
1 <tool id="random_select" name="Choose Randomly" version="0.1.0" profile="16.10">
2 <description>one pair of reads from a collection of paired reads</description>
3 <requirements>
4 </requirements>
5 <command detect_errors="exit_code"><![CDATA[
6 #if not $seed
7 #from hashlib import md5
8 #set $seed = md5(str($input.name)).hexdigest()
9 #end if
10 echo "seed: " $seed &&
11 echo $seed > $output_seed &&
12 #import random
13 #set $_ = random.seed($seed)
14 #set $choice = random.choice(list($input))
15 cp $choice.forward $selection.forward && cp $choice.reverse $selection.reverse
16 ]]></command>
17 <inputs>
18 <param label="List of paired datasets" name="input" type="data_collection" collection_type="list:paired" format="fastqsanger" />
19 <param label="Random seed (optional)" name="seed" type="text" />
20 </inputs>
21 <outputs>
22 <collection name="selection" label="Selected pair" type="paired">
23 <data name="forward" format="fastqsanger" />
24 <data name="reverse" format="fastqsanger" />
25 </collection>
26 <data name="output_seed" label="Seed" format_source="seed" hidden="true" />
27 </outputs>
28 <tests>
29 <test>
30 <param name="mul" value="single" />
31 <param name="seed" value="TESTTEST" />
32 <param name="input">
33 <collection type="list">
34 <element name="sample1">
35 <collection type="paired">
36 <element name="forward" value="sample1_1.fastq" />
37 <element name="reverse" value="sample1_2.fastq" />
38 </collection>
39 </element>
40 <element name="sample2">
41 <collection type="paired">
42 <element name="forward" value="sample2_1.fastq" />
43 <element name="reverse" value="sample2_2.fastq" />
44 </collection>
45 </element>
46 <element name="sample3">
47 <collection type="paired">
48 <element name="forward" value="sample3_1.fastq" />
49 <element name="reverse" value="sample3_2.fastq" />
50 </collection>
51 </element>
52 <element name="sample4">
53 <collection type="paired">
54 <element name="forward" value="sample4_1.fastq" />
55 <element name="reverse" value="sample4_2.fastq" />
56 </collection>
57 </element>
58 </collection>
59 </param>
60 <output_collection name="selection" type="paired" >
61 <element name="forward" file="sample4_1.fastq" />
62 <element name="reverse" file="sample4_2.fastq" />
63 </output_collection>
64 </test>
65 </tests>
66 <help>Choose one pair at random from a paired dataset.
67 If you re-use the seed, the choice should be the same
68 (this is for reproducability of analysis.)
69 Provide a blank seed value to use a seed created
70 as an MD5 sum of the dataset's name.
71 </help>
72 <citations>
73 </citations>
74 </tool>