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