diff random_select.xml @ 0:156371cbc343 tip

planemo upload
author jpayne
date Tue, 06 Feb 2018 13:30:07 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/random_select.xml	Tue Feb 06 13:30:07 2018 -0500
@@ -0,0 +1,74 @@
+<tool id="random_select" name="Choose Randomly" version="0.1.0" profile="16.10">
+    <description>one pair of reads from a collection of paired reads</description>
+    <requirements>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+        #if not $seed
+        #from hashlib import md5
+        #set $seed = md5(str($input.name)).hexdigest()
+        #end if
+        echo "seed: " $seed &&
+        echo $seed > $output_seed &&
+        #import random
+        #set $_ = random.seed($seed)
+        #set $choice = random.choice(list($input))
+        cp $choice.forward $selection.forward && cp $choice.reverse $selection.reverse
+    ]]></command>
+    <inputs>
+		<param label="List of paired datasets" name="input" type="data_collection" collection_type="list:paired" format="fastqsanger" />
+        <param label="Random seed (optional)" name="seed" type="text" />
+    </inputs>
+    <outputs>
+    	<collection name="selection" label="Selected pair" type="paired">
+    		<data name="forward" format="fastqsanger" />
+            <data name="reverse" format="fastqsanger" />
+        </collection>
+        <data name="output_seed" label="Seed" format_source="seed" hidden="true" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="mul" value="single" />
+            <param name="seed" value="TESTTEST" />
+            <param name="input">
+                <collection type="list">
+                    <element name="sample1">
+                        <collection type="paired">
+                            <element name="forward" value="sample1_1.fastq" />
+                            <element name="reverse" value="sample1_2.fastq" />
+                        </collection>
+                    </element>
+                    <element name="sample2">
+                        <collection type="paired">
+                            <element name="forward" value="sample2_1.fastq" />
+                            <element name="reverse" value="sample2_2.fastq" />
+                        </collection>
+                    </element>
+                    <element name="sample3">
+                        <collection type="paired">
+                            <element name="forward" value="sample3_1.fastq" />
+                            <element name="reverse" value="sample3_2.fastq" />
+                        </collection>
+                    </element>
+                    <element name="sample4">
+                        <collection type="paired">
+                            <element name="forward" value="sample4_1.fastq" />
+                            <element name="reverse" value="sample4_2.fastq" />
+                        </collection>
+                    </element>
+                </collection>
+            </param>
+            <output_collection name="selection" type="paired" >
+                <element name="forward" file="sample4_1.fastq" />
+                <element name="reverse" file="sample4_2.fastq" />
+            </output_collection>
+        </test>
+    </tests>
+    <help>Choose one pair at random from a paired dataset. 
+            If you re-use the seed, the choice should be the same 
+            (this is for reproducability of analysis.) 
+            Provide a blank seed value to use a seed created 
+            as an MD5 sum of the dataset's name.
+    </help>
+    <citations>
+    </citations>
+</tool>
\ No newline at end of file