changeset 13:c38286ea7047 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sra-tools commit 686710a7d313b828f1daed20c4055479727f2d91
author iuc
date Wed, 17 Oct 2018 11:44:12 -0400
parents 5534eb46de20
children 1790dcf3c32d
files fastq_dump.xml sam_dump.xml sra_macros.xml sra_pileup.xml
diffstat 4 files changed, 31 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/fastq_dump.xml	Wed Sep 26 05:33:56 2018 -0400
+++ b/fastq_dump.xml	Wed Oct 17 11:44:12 2018 -0400
@@ -5,26 +5,9 @@
     </macros>
     <expand macro="requirements"/>
     <version_command>fastq-dump --version</version_command>
-    <command detect_errors="exit_code">
-        <![CDATA[
-
-    #if $input.input_select=="file_list":
-    
-        for acc in `cat $input.file_list` ;
-        do
-    
-    #elif $input.input_select=="accession_number":
+    <command detect_errors="exit_code"><![CDATA[
 
-        ## Stripping leading and trailing spaces in case user typed them in 
-        acc="${input.accession}" &&
-    
-    #end if
-
-    #if $input.input_select=="file_list" or $input.input_select=="accession_number":
-    
-        [ ""\$acc" =~ ^[E|S|D]RR[0-9]{1,}$" ] && (
-    
-    #end if
+    @SET_ACCESSIONS@
 
     ## Need to set the home directory to the current working directory,
     ## else the tool tries to write to home/.ncbi and fails when used
--- a/sam_dump.xml	Wed Sep 26 05:33:56 2018 -0400
+++ b/sam_dump.xml	Wed Oct 17 11:44:12 2018 -0400
@@ -7,16 +7,7 @@
     <version_command>sam-dump --version</version_command>
     <command detect_errors="exit_code">
 <![CDATA[
-    #if $input.input_select=="file_list":
-      for acc in `cat $input.file_list` ;
-      do
-    #elif $input.input_select=="accession_number":
-      acc="${input.accession}" &&
-    #end if
-
-    #if $input.input_select=="file_list" or $input.input_select=="accession_number":
-          [ ""\$acc" =~ ^[E|S|D]RR[0-9]{1,}$" ] && (
-    #end if
+        @SET_ACCESSIONS@
 
         ## Need to set the home directory to the current working directory,
         ## else the tool tries to write to home/.ncbi and fails when used
--- a/sra_macros.xml	Wed Sep 26 05:33:56 2018 -0400
+++ b/sra_macros.xml	Wed Oct 17 11:44:12 2018 -0400
@@ -1,10 +1,34 @@
 <macros>
     <token name="@VERSION@">2.9.1</token>
+    <token name="@ACCESSIONS_FROM_FILE@">
+        grep '^[[:space:]]*[E|S|D]RR[0-9]\{1,\}[[:space:]]*$'
+    </token>
+    <token name="@SET_ACCESSIONS@"><![CDATA[
+        #if $input.input_select=="file_list":
+            for acc in `@ACCESSIONS_FROM_FILE@ '$input.file_list'` ;
+            do (
+        #elif $input.input_select=="accession_number":
+            acc='${input.accession}' && [ ""\$acc" =~ ^[E|S|D]RR[0-9]{1,}$" ] && (
+        #end if
+    ]]></token>
+
     <macro name="requirements">
         <requirements>
             <requirement type="package" version="2.9.1">sra-tools</requirement>
         </requirements>
     </macro>
+    <macro name="sanitize_query">
+        <sanitizer>
+            <valid initial="string.printable">
+                <remove value=" "/>
+                <remove value="&apos;" />
+            </valid>
+            <mapping initial="none">
+                <add source=" " target=""/>
+                <add source="&apos;" target="&apos;&quot;&apos;&quot;&apos;" />
+            </mapping>
+        </sanitizer>
+    </macro>
     <macro name="input_conditional">
         <conditional name="input">
             <param name="input_select" type="select" label="select input type">
@@ -14,14 +38,7 @@
             </param>
             <when value="accession_number">
                 <param name="accession" type="text" label="Accession" help="Must start with SRR, DRR or ERR, e.g. SRR925743, ERR343809">
-                    <sanitizer>
-                        <valid initial="string.printable">
-                            <remove value=" "/>
-                        </valid>
-                        <mapping initial="none">
-                            <add source=" " target=""/>
-                        </mapping>
-                    </sanitizer>
+                    <expand macro="sanitize_query" />
                     <validator type="empty_field" message="An accession is required"/>
                 </param>
             </when>
--- a/sra_pileup.xml	Wed Sep 26 05:33:56 2018 -0400
+++ b/sra_pileup.xml	Wed Oct 17 11:44:12 2018 -0400
@@ -9,7 +9,7 @@
         <![CDATA[
 
         #if $input.input_select=="accession_number":
-            acc="${input.accession}" &&
+            acc='${input.accession}' && [ ""\$acc" =~ ^[E|S|D]RR[0-9]{1,}$" ] &&
         #end if
 
         ## Need to set the home directory to the current working directory,
@@ -38,7 +38,7 @@
         #elif $input.input_select == "accession_number":
             "\$acc" > "$output_accession"
         #elif $input.input_select == "text":
-            `cat "$input.text"` > "$output_text"
+            `@ACCESSIONS_FROM_FILE@ '$input.text'` > "$output_text"
         #end if
         ]]>
     </command>
@@ -54,14 +54,7 @@
             </when>
             <when value="accession_number">
                 <param format="text" name="accession" type="text" label="SRR accession" help="Must start with SRR, e.g. SRR925743">
-                    <sanitizer>
-                        <valid initial="string.printable">
-                            <remove value=" "/>
-                        </valid>
-                        <mapping initial="none">
-                            <add source=" " target=""/>
-                        </mapping>
-                    </sanitizer>
+                    <expand macro="sanitize_query" />
                 </param>
             </when>
             <when value="text">