diff bio_hansel.xml @ 1:4deefd708943 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hansel commit 80309b6403ad219d7fa3a25288c6339d0b33ed63"
author iuc
date Thu, 06 May 2021 18:31:35 +0000
parents e3698ac146d7
children 1b88c1cf803d
line wrap: on
line diff
--- a/bio_hansel.xml	Tue Oct 03 10:39:11 2017 -0400
+++ b/bio_hansel.xml	Thu May 06 18:31:35 2021 +0000
@@ -1,47 +1,51 @@
-<tool id="bio_hansel" name="Salmonella Subtyping" version="0.1.0">
-    <requirements>
-        <requirement type="package" version="0.1.0">bio_hansel</requirement>
-        <requirement type="package" version="17.2.0">attrs</requirement>
-    </requirements>
+<tool id="bio_hansel" name="Salmonella Subtyping" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@">
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
     <command detect_errors="exit_code"><![CDATA[
-        ## Preparing file input.
         #if $data_type.type == "paired":
-
-            ln -s '$data_type.fastq_input1' fast_q_paired_1.fastq &&
-            ln -s '$data_type.fastq_input2' fast_q_paired_2.fastq &&
-
+            #if $data_type.fastq_input1.ext.endswith('.gz'):
+                gunzip -c '$data_type.fastq_input1' > fast_q_paired_1.fastq &&
+                gunzip -c '$data_type.fastq_input2' > fast_q_paired_2.fastq &&
+            #else:
+                ln -s '$data_type.fastq_input1' fast_q_paired_1.fastq &&
+                ln -s '$data_type.fastq_input2' fast_q_paired_2.fastq &&
+            #end if
         #elif $data_type.type == "collection":
-
-            ln -s '$data_type.fastq_input1.forward' fast_q_paired_1.fastq &&
-            ln -s '$data_type.fastq_input1.reverse' fast_q_paired_2.fastq &&
-
-        #elif $data_type.type == "single":
-
-            #if $data_type.fastq_input1.is_of_type('fastqsanger') or $data_type.fastq_input1.is_of_type('fastq'):
-                ln -s '$data_type.fastq_input1' fast_q_single.fastq &&
+            #if $data_type.fastq_input1.forward.ext.endswith('.gz'):
+                gunzip -c '$data_type.fastq_input1.forward' > fast_q_paired_1.fastq &&
+                gunzip -c '$data_type.fastq_input2.reverse' > fast_q_paired_2.fastq &&
+            #else:
+                ln -s '$data_type.fastq_input1.forward' fast_q_paired_1.fastq &&
+                ln -s '$data_type.fastq_input1.reverse' fast_q_paired_2.fastq &&
             #end if
-
-            #if $data_type.fastq_input1.is_of_type('fasta'):
-                ln -s '$data_type.fastq_input1' fast_a_single.fasta &&
-            #end if
-
-        #end if
-
-
-        ## Checking for custom scheme.
-        #if $type_of_scheme.scheme_type == "custom":
-            #if $type_of_scheme.scheme_input.is_of_type('fasta'):
-                ln -s '$type_of_scheme.scheme_input' custom_scheme.fasta &&
+        #elif $data_type.type == "single":
+            #if $data_type.fastq_input1.ext.startswith("fastq"):
+                #if $data_type.fastq_input1.ext.endswith('.gz'):
+                    gunzip -c '$data_type.fastq_input1' > fast_q_single.fastq &&
+                #else:
+                    ln -s '$data_type.fastq_input1' fast_q_single.fastq &&
+                #end if
+            #elif $data_type.fastq_input1.ext.startswith('fasta'):
+                #if $data_type.fastq_input1.ext.endswith('.gz'):
+                    gunzip -c '$data_type.fastq_input1' > fast_a_single.fasta &&
+                #else:
+                    ln -s '$data_type.fastq_input1' fast_a_single.fasta &&
+                #end if
             #end if
         #end if
-
-        ## Start the actual command here
+        #if $type_of_scheme.scheme_type == "custom":
+            #if $type_of_scheme.scheme_input.ext.startswith('fasta'):
+                #if $type_of_scheme.scheme_input.ext.endswith('.gz'):
+                    gunzip -c '$type_of_scheme.scheme_input' > custom_scheme.fasta &&
+                #else:
+                    ln -s '$type_of_scheme.scheme_input' custom_scheme.fasta &&
+                #end if
+            #end if
+        #end if
         hansel 
-
-
-        ## Select the scheme
         -s
-
         #if $type_of_scheme.scheme_type == "heidelberg":
             heidelberg
         #elif $type_of_scheme.scheme_type == "enteritidis":
@@ -49,36 +53,21 @@
         #elif $type_of_scheme.scheme_type == "custom":
             custom_scheme.fasta
         #end if
-
-
         #if $kmer_min
             --min-kmer-freq $kmer_min
         #end if
-
         #if $kmer_max
             --max-kmer-freq $kmer_max
         #end if
-
-        ## Adding more parameters to the command.
-        -vvv -t "\${GALAXY_SLOTS:-1}" -o results.tab -O match_results.tab 
-
-
-        ## Entering the file inputs.
+        -vvv -t \${GALAXY_SLOTS:-1} -o 'results.tab' -O 'match_results.tab' 
         #if $data_type.type == "single":
-
-            #if $data_type.fastq_input1.is_of_type('fastqsanger') or $data_type.fastq_input1.is_of_type('fastq'):
+            #if $data_type.fastq_input1.ext.startswith('fastq'):
                 fast_q_single.fastq
-            #end if
-
-            #if $data_type.fastq_input1.is_of_type('fasta'):
+            #elif $data_type.fastq_input1.ext.startswith('fasta'):
                 fast_a_single.fasta
             #end if
-
         #else
-
-            ##use -p to declare using two files.
             -p fast_q_paired_1.fastq  fast_q_paired_2.fastq
-
         #end if
     ]]></command>
     <inputs>
@@ -89,14 +78,14 @@
                 <option value="collection">Collection Paired-end Data</option>
             </param>
             <when value="single">
-                <param name="fastq_input1" type="data" format="fastqsanger, fastq, fasta" label="Single end read file(s)"/>
+                <param name="fastq_input1" type="data" format="fastqsanger,fastqsanger.gz,fastq,fastq.gz,fasta,fasta.gz" label="Single end read file(s)"/>
             </when>
             <when value="paired">
-                <param name="fastq_input1" type="data" format="fastqsanger, fastq" label="Forward paired-end read file"/>
-                <param name="fastq_input2" type="data" format="fastqsanger, fastq" label="Reverse paired-end read file"/>
+                <param name="fastq_input1" type="data" format="fastqsanger,fastqsanger.gz,fastq,fastq.gz" label="Forward paired-end read file"/>
+                <param name="fastq_input2" type="data" format="fastqsanger,fastqsanger.gz,fastq,fastq.gz" label="Reverse paired-end read file"/>
             </when>
             <when value="collection">
-                <param name="fastq_input1" type="data_collection" label="Paired-end reads collection" optional="false" format="fastqsanger, fastq" collection_type="paired" />
+                <param name="fastq_input1" type="data_collection" label="Paired-end reads collection" optional="false" format="fastqsanger,fastqsanger.gz,fastq,fastq.gz" collection_type="paired" />
             </when>
         </conditional>
         <conditional name="type_of_scheme">
@@ -108,49 +97,31 @@
             <when value="heidelberg"/>
             <when value="enteritidis"/>
             <when value="custom">
-                <param name="scheme_input" type="data" format="fasta" label="Scheme Input"/>
+                <param name="scheme_input" type="data" format="fasta,fasta.gz" label="Scheme Input"/>
             </when>
         </conditional>
         <param name="kmer_min" argument="--min-kmer-freq" optional="True" type="integer" min="0" label="Min k-mer freq/coverage" help="default = 10"/>
         <param name="kmer_max" argument="--max-kmer-freq" optional="True" type="integer" min="1" label="Max k-mer freq/coverage" help="default = 200"/>
     </inputs>
     <outputs>
-        <data format="tabular" name="results.tab" from_work_dir="results.tab" label="results.tab"/>
-        <data format="tabular" name="match_results.tab" from_work_dir="match_results.tab" label="match_results.tab"/>
+        <data format="tabular" name="results" from_work_dir="results.tab" label="${tool.name} on ${on_string}: results.tab"/>
+        <data format="tabular" name="match_results" from_work_dir="match_results.tab" label="${tool.name} on ${on_string}: match_results.tab"/>
     </outputs>
     <tests>
         <test>
             <param name="type" value="single"/>
             <param name="type_of_scheme" value="heidelberg"/>
-            <param name="fastq_input1" value="SRR1002850_SMALL.fasta"/>
-            <output name="results.tab">
-                <assert_contents>
-                    <!-- Verifying that the columns are as expected. -->
-                    <has_text_matching expression="sample\s+scheme\s+subtype\s+all_subtypes\s+tiles_matching_subtype\s+are_subtypes_consistent\s+inconsistent_subtypes\s+n_tiles_matching_all\s+n_tiles_matching_all_total\s+n_tiles_matching_positive\s+n_tiles_matching_positive_total\s+n_tiles_matching_subtype\s+n_tiles_matching_subtype_total\s+file_path"/>
-                    <!-- Verifying that the output of running the test file is expected. This is done via REGEX because the name and path of the file outputted to results.tab changes each test. -->
-                    <has_text_matching expression="(heidelberg)\s+(2.2.2.2.1.4)\s+(2;)\s+(2.2;)\s+(2.2.2;)\s+(2.2.2.2;)\s+(2.2.2.2.1;)\s+(2.2.2.2.1.4)\s+(1037658-2.2.2.2.1.4;)\s+(2154958-2.2.2.2.1.4;)\s+(3785187-2.2.2.2.1.4)\s+(True)\s+(202)\s+(202)\s+(17)\s+(17)\s+(3)\s+(3)"/>
-                </assert_contents>
-            </output>
-            <output name="match_results.tab">
-                <assert_contents>
-                    <!-- This is the last line in the file, this assertion is to make sure that we have the correct number of items. -->
-                    <has_text_matching expression="negative4738855-1.1"/>
-                </assert_contents>
-            </output>
+            <param name="fastq_input1" ftype="fasta.gz" value="SRR1002850_SMALL.fasta.gz"/>
+            <output name="results" ftype="tabular" file="results1.tab" compare="contains"/>
+            <output name="match_results" ftype="tabular" file="match_results1.tab" compare="contains"/>
         </test>
         <test>
             <param name="type" value="paired"/>
             <param name="type_of_scheme" value="heidelberg"/>
-            <param name="fastq_input1" value="SRR5646583_SMALL_1.fastq"/>
-            <param name="fastq_input2" value="SRR5646583_SMALL_2.fastq"/>
-            <output name="results.tab">
-                <assert_contents>
-                    <!-- Verifying that the columns are as expected. -->
-                    <has_text_matching expression="sample\s+scheme\s+subtype\s+all_subtypes\s+tiles_matching_subtype\s+are_subtypes_consistent\s+inconsistent_subtypes\s+n_tiles_matching_all\s+n_tiles_matching_all_total\s+n_tiles_matching_positive\s+n_tiles_matching_positive_total\s+n_tiles_matching_subtype\s+n_tiles_matching_subtype_total\s+file_path"/>
-                    <!-- Verifying that the output of running the test file is expected. This is done via REGEX because the name and path of the file outputted to results.tab changes each test. -->
-                    <has_text_matching expression="(heidelberg)\s+(2.2.1.1.1.1)\s+(2;)\s+(2.2;)\s+(2.2.1;)\s+(2.2.1.1;)\s+(2.2.1.1.1;)\s+(2.2.1.1.1.1)\s+(1983064-2.2.1.1.1.1;)\s+(4211912-2.2.1.1.1.1)\s+(True)\s+(202)\s+(202)\s+(20)\s+(20)\s+(2)\s+(2)"/>
-                </assert_contents>
-            </output>
+            <param name="fastq_input1" ftype="fastq.gz" value="SRR5646583_SMALL_1.fastq.gz"/>
+            <param name="fastq_input2" value="SRR5646583_SMALL_2.fastq.gz"/>
+            <output name="results" ftype="tabular" file="results2.tab" compare="contains"/>
+            <output name="match_results" ftype="tabular" file="match_results2.tab" compare="contains"/>
         </test>
     </tests>
     <help><![CDATA[
@@ -264,4 +235,4 @@
             }
         }</citation>
     </citations>
-</tool>
\ No newline at end of file
+</tool>