changeset 2:b8cdc0507586 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/galaxy_sequence_utils/tabular_to_fastq commit f2582539542b33240234e8ea6093e25d0aee9b6a
author devteam
date Sat, 30 Sep 2017 13:56:23 -0400
parents 92034dcbb40a
children 68f57cc8fad0
files tabular_to_fastq.py tabular_to_fastq.xml tool_dependencies.xml
diffstat 3 files changed, 59 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/tabular_to_fastq.py	Wed Nov 11 12:43:24 2015 -0500
+++ b/tabular_to_fastq.py	Sat Sep 30 13:56:23 2017 -0400
@@ -1,29 +1,33 @@
-#Dan Blankenberg
+# Dan Blankenberg
+from __future__ import print_function
+
 import sys
 
+
 def main():
     input_filename = sys.argv[1]
     output_filename = sys.argv[2]
-    identifier_col = int( sys.argv[3] ) - 1
-    sequence_col = int( sys.argv[4] ) - 1
-    quality_col = int( sys.argv[5] ) - 1
-    
-    max_col = max( identifier_col, sequence_col, quality_col )
+    identifier_col = int(sys.argv[3]) - 1
+    sequence_col = int(sys.argv[4]) - 1
+    quality_col = int(sys.argv[5]) - 1
+
+    max_col = max(identifier_col, sequence_col, quality_col)
     num_reads = None
-    fastq_read = None
     skipped_lines = 0
-    out = open( output_filename, 'wb' )
-    for num_reads, line in enumerate( open( input_filename ) ):
-        fields = line.rstrip( '\n\r' ).split( '\t' )
-        if len( fields ) > max_col:
-            out.write( "@%s\n%s\n+\n%s\n" % ( fields[identifier_col], fields[sequence_col], fields[quality_col] ) )
+    out = open(output_filename, 'w')
+    for num_reads, line in enumerate(open(input_filename)):
+        fields = line.rstrip('\n\r').split('\t')
+        if len(fields) > max_col:
+            out.write("@%s\n%s\n+\n%s\n" % (fields[identifier_col], fields[sequence_col], fields[quality_col]))
         else:
             skipped_lines += 1
-    
+
     out.close()
     if num_reads is None:
-        print "Input was empty."
+        print("Input was empty.")
     else:
-        print "%i tabular lines were written as FASTQ reads. Be sure to use the FASTQ Groomer tool on this output before further analysis." % ( num_reads + 1 - skipped_lines )
-    
-if __name__ == "__main__": main()
+        print("%i tabular lines were written as FASTQ reads. Be sure to use the FASTQ Groomer tool on this output before further analysis." % (num_reads + 1 - skipped_lines))
+
+
+if __name__ == "__main__":
+    main()
--- a/tabular_to_fastq.xml	Wed Nov 11 12:43:24 2015 -0500
+++ b/tabular_to_fastq.xml	Sat Sep 30 13:56:23 2017 -0400
@@ -1,45 +1,41 @@
-<tool id="tabular_to_fastq" name="Tabular to FASTQ" version="1.0.0">
-  <description>converter</description>
-  <requirements>
-    <requirement type="package" version="1.0.0">galaxy_sequence_utils</requirement>
-  </requirements>
-  <command interpreter="python">tabular_to_fastq.py '$input_file' '$output_file' '$identifier' '$sequence' '$quality'</command>
-  <inputs>
-    <param name="input_file" type="data" format="tabular" label="Tabular file to convert" />
-    <param name="identifier" label="Identifier column" type="data_column" data_ref="input_file" />
-    <param name="sequence" label="Sequence column" type="data_column" data_ref="input_file" />
-    <param name="quality" label="Quality column" type="data_column" data_ref="input_file" />
-  </inputs>
-  <outputs>
-    <data name="output_file" format="fastq" />
-  </outputs>
-  <tests>
-    <!-- basic test -->
-    <test>
-      <param name="input_file" value="fastq_to_tabular_out_1.tabular" ftype="tabular" />
-      <param name="identifier" value="1" />
-      <param name="sequence" value="2" />
-      <param name="quality" value="3" />
-      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
-    </test>
-    <!-- color space test -->
-    <test>
-      <param name="input_file" value="fastq_to_tabular_out_2.tabular" ftype="tabular" />
-      <param name="identifier" value="1" />
-      <param name="sequence" value="2" />
-      <param name="quality" value="3" />
-      <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
-    </test>
-  </tests>
-  <help>
+<tool id="tabular_to_fastq" name="Tabular to FASTQ" version="1.1.1">
+    <description>converter</description>
+    <command><![CDATA[
+python '$__tool_directory__/tabular_to_fastq.py' '$input_file' '$output_file' '$identifier' '$sequence' '$quality'
+    ]]></command>
+    <inputs>
+        <param name="input_file" type="data" format="tabular" label="Tabular file to convert" />
+        <param name="identifier" type="data_column" data_ref="input_file" label="Identifier column" />
+        <param name="sequence" type="data_column" data_ref="input_file" label="Sequence column" />
+        <param name="quality" type="data_column" data_ref="input_file" label="Quality column" />
+    </inputs>
+    <outputs>
+        <data name="output_file" format="fastq" />
+    </outputs>
+    <tests>
+        <!-- basic test -->
+        <test>
+            <param name="input_file" value="fastq_to_tabular_out_1.tabular" ftype="tabular" />
+            <param name="identifier" value="1" />
+            <param name="sequence" value="2" />
+            <param name="quality" value="3" />
+            <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
+        </test>
+        <!-- color space test -->
+        <test>
+            <param name="input_file" value="fastq_to_tabular_out_2.tabular" ftype="tabular" />
+            <param name="identifier" value="1" />
+            <param name="sequence" value="2" />
+            <param name="quality" value="3" />
+            <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
+        </test>
+    </tests>
+    <help><![CDATA[
 **What it does**
 
-This tool attempts to convert a tabular file containing sequencing read data to a FASTQ formatted file. The FASTQ Groomer tool should always be used on the output of this tool. 
-
-  </help>
-  
-  <citations>
-    <citation type="doi">10.1093/bioinformatics/btq281</citation>
-  </citations>
-  
+This tool attempts to convert a tabular file containing sequencing read data to a FASTQ formatted file. The FASTQ Groomer tool should always be used on the output of this tool.
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btq281</citation>
+    </citations>
 </tool>
--- a/tool_dependencies.xml	Wed Nov 11 12:43:24 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<tool_dependency>
-  <package name="galaxy_sequence_utils" version="1.0.0">
-      <repository changeset_revision="0643676ad5f7" name="package_galaxy_utils_1_0" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
-    </package>
-</tool_dependency>