diff tools/seq_select_by_id/seq_select_by_id.xml @ 6:91f55ee8fea5 draft

v0.0.11; more tests and assorting minor changes
author peterjc
date Wed, 13 May 2015 10:56:29 -0400
parents 6842c0c7bc70
children a5602454b0ad
line wrap: on
line diff
--- a/tools/seq_select_by_id/seq_select_by_id.xml	Thu Nov 21 04:54:59 2013 -0500
+++ b/tools/seq_select_by_id/seq_select_by_id.xml	Wed May 13 10:56:29 2015 -0400
@@ -1,35 +1,25 @@
-<tool id="seq_select_by_id" name="Select sequences by ID" version="0.0.6">
+<tool id="seq_select_by_id" name="Select sequences by ID" version="0.0.11">
     <description>from a tabular file</description>
     <requirements>
         <requirement type="package" version="1.62">biopython</requirement>
         <requirement type="python-module">Bio</requirement>
     </requirements>
-    <version_command interpreter="python">seq_select_by_id.py --version</version_command>
-    <command interpreter="python">
-seq_select_by_id.py $input_tabular $column $input_file $input_file.ext $output_file
-    </command>
     <stdio>
         <!-- Anything other than zero is an error -->
         <exit_code range="1:" />
         <exit_code range=":-1" />
     </stdio>
+    <version_command interpreter="python">seq_select_by_id.py --version</version_command>
+    <command interpreter="python">
+seq_select_by_id.py "$input_tabular" "$column" "$input_file" "$input_file.ext" "$output_file"
+    </command>
     <inputs>
         <param name="input_file" type="data" format="fasta,qual,fastq,sff" label="Sequence file to select from" help="FASTA, QUAL, FASTQ, or SFF format." />
         <param name="input_tabular" type="data" format="tabular" label="Tabular file containing sequence identifiers"/>
         <param name="column" type="data_column" data_ref="input_tabular" multiple="False" numerical="False" label="Column containing sequence identifiers"/>
     </inputs>
     <outputs>
-        <data name="output_file" format="fasta" label="Selected sequences">
-            <!-- TODO - Replace this with format="input:input_fastq" if/when that works -->
-            <change_format>
-                <when input_dataset="input_file" attribute="extension" value="sff" format="sff" />
-                <when input_dataset="input_file" attribute="extension" value="fastq" format="fastq" />
-                <when input_dataset="input_file" attribute="extension" value="fastqsanger" format="fastqsanger" />
-                <when input_dataset="input_file" attribute="extension" value="fastqsolexa" format="fastqsolexa" />
-                <when input_dataset="input_file" attribute="extension" value="fastqillumina" format="fastqillumina" />
-                <when input_dataset="input_file" attribute="extension" value="fastqcssanger" format="fastqcssanger" />
-            </change_format>
-        </data>
+        <data name="output_file" format_source="input_file" metadata_source="input_file" label="Selected sequences from $input_file.name"/>
     </outputs>
     <tests>
         <test>
@@ -37,6 +27,35 @@
             <param name="input_tabular" value="k12_hypothetical.tabular" ftype="tabular" />
             <param name="column" value="1" />
             <output name="output_file" file="k12_hypothetical.fasta" ftype="fasta" />
+            <assert_stdout>
+                <has_line line="Indexed 10 sequences" />
+                <has_line line="Selected 1 sequences by ID" />
+            </assert_stdout>
+        </test>
+        <!-- this version has white space in the identifier column (id and description) -->
+        <test>
+            <param name="input_file" value="k12_ten_proteins.fasta" ftype="fasta" />
+            <param name="input_tabular" value="k12_hypothetical_alt.tabular" ftype="tabular" />
+            <param name="column" value="1" />
+            <output name="output_file" file="k12_hypothetical.fasta" ftype="fasta" />
+            <assert_stdout>
+                <has_line line="Indexed 10 sequences" />
+                <has_line line="Selected 1 sequences by ID" />
+            </assert_stdout>
+            <assert_stderr>
+                <has_line line="WARNING: Some of your identifiers had white space in them, using first word only. e.g.:" />
+            </assert_stderr>
+        </test>
+        <test expect_failure="true" expect_exit_code="1">
+            <param name="input_file" value="empty.fasta" ftype="fasta" />
+            <param name="input_tabular" value="k12_hypothetical.tabular" ftype="tabular" />
+            <param name="column" value="1" />
+            <assert_stdout>
+                <has_line line="Indexed 0 sequences" />
+            </assert_stdout>
+            <assert_stderr>
+                <has_line line="Identifier 'gi|16127999|ref|NP_414546.1|' not found in sequence file" />
+            </assert_stderr>
         </test>
     </tests>
     <help>
@@ -69,4 +88,8 @@
 This tool is available to install into other Galaxy Instances via the Galaxy
 Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/seq_select_by_id
     </help>
+    <citations>
+        <citation type="doi">10.7717/peerj.167</citation>
+        <citation type="doi">10.1093/bioinformatics/btp163</citation>
+    </citations>
 </tool>