changeset 5:3852b3edc8a4 tip

"planemo upload for repository https://toolrepo.galaxytrakr.org/"
author jpayne
date Fri, 19 Feb 2021 17:51:59 -0500
parents a90a883f88f9
children
files reads_subsampler.xml subsamplr.py
diffstat 2 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/reads_subsampler.xml	Fri Feb 19 15:28:20 2021 -0500
+++ b/reads_subsampler.xml	Fri Feb 19 17:51:59 2021 -0500
@@ -6,12 +6,10 @@
     <command detect_errors="exit_code"><![CDATA[
         #if $reads.reads_select == 'collection'
             python3 ${__tool_directory__}/subsamplr.py '$reads.coll.forward' '$reads.coll.reverse' '$downsampled.forward' '$downsampled.reverse' $coverage $genome_size '$seed'
-        #else
-            #if $reverse
-                python3 ${__tool_directory__}/subsamplr.py '$forward' '$reverse' $forward_out $reverse_out $coverage $genome_size '$seed'
-            #else
-                python3 ${__tool_directory__}/subsamplr.py '$forward' '$forward_out' $coverage $genome_size '$seed'
-            #end if
+        #elif $reads.reads_select == 'single'
+            python3 ${__tool_directory__}/subsamplr.py '$forward' '$forward_out' $coverage $genome_size '$seed'
+        #else 
+            python3 ${__tool_directory__}/subsamplr.py '$forward' '$reverse' $forward_out $reverse_out $coverage $genome_size '$seed'
         #end if
     ]]></command>
     <inputs>
@@ -34,8 +32,10 @@
         </conditional>
         <param name="coverage" type="integer" label="Maximum Coverage" value="200" />
         <param name="genome_size" type="select" label="Assumed Genome Size">
-            <option value="4500000">Salmonella, E. Coli (4500000)</option>
+            <option value="5000000">Salmonella, E. Coli, Vibrio p. (5000000)</option>
+            <option value="4000000">Vibrio cholerae (4000000)</option>
             <option value="2700000">Listeria (2700000)</option>
+            <option value="1600000">Campylobacter (1600000)</option>
             <option value="29900">SARS-CoV-2 (29900)</option>
         </param>
         <param name="seed" type="text" value="ed2b99d842cddc1ac81d7c01a0bf0555" label="Random seed (you don't have to change this)"/>
@@ -56,6 +56,15 @@
     <tests>
         <test>
             <conditional name="reads">
+                <param name="reads_select" value="single" />
+                <param name="forward" value="forward.fastq" />
+            </conditional>
+            <param name="coverage" value="20" />
+            <param name="genome_size" value="29900" />
+            <output name="forward_out" value="forward_out.fastq" />
+        </test>
+        <test>
+            <conditional name="reads">
                 <param name="reads_select" value="collection" />
                 <param name="coll">
                     <collection type="paired">
--- a/subsamplr.py	Fri Feb 19 15:28:20 2021 -0500
+++ b/subsamplr.py	Fri Feb 19 17:51:59 2021 -0500
@@ -43,7 +43,7 @@
     outs = [fout, rout]
 except ValueError: # not enough values to unpack
     try:
-        fin, fout, cov, gen_size, *ops = argv[1:]
+        fin, fout, cov, gen_size, *opts = argv[1:]
         ins = [fin]
         outs = [fout]
     except ValueError:
@@ -70,7 +70,8 @@
     outs = [stack.enter_context(openn(path, 'w')) for openn, path in zip(file_openers, outs)] # opened output files
 
     for file in ins:
-        print(file.name)
+        if hasattr(file, "name"):
+            print(file.name)
 
     # https://en.m.wikipedia.org/wiki/Reservoir_sampling