changeset 0:daf96c3e3b60 draft

Imported from capsule None
author devteam
date Thu, 23 Jan 2014 12:31:31 -0500
parents
children 2ebd6fcee4c4
files fastq_to_fasta.py fastq_to_fasta.xml test-data/fastq_to_fasta_python_1.out test-data/fastq_to_fasta_python_2.out test-data/sanger_full_range_as_cssanger.fastqcssanger test-data/sanger_full_range_masked_N.fastqsanger test-data/sanger_full_range_masked_lowercase.fastqsanger test-data/sanger_full_range_original_sanger.fastqsanger tool_dependencies.xml
diffstat 9 files changed, 111 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fastq_to_fasta.py	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,22 @@
+#Dan Blankenberg
+import sys
+from galaxy_utils.sequence.fastq import fastqReader
+from galaxy_utils.sequence.fasta import fastaWriter
+
+def main():
+    input_filename = sys.argv[1]
+    output_filename = sys.argv[2]
+    input_type = sys.argv[3] or 'sanger' #input type should ordinarily be unnecessary
+    
+    num_reads = None
+    fastq_read = None
+    out = fastaWriter( open( output_filename, 'wb' ) )
+    for num_reads, fastq_read in enumerate( fastqReader( open( input_filename ), format = input_type ) ):
+        out.write( fastq_read )
+    out.close()
+    if num_reads is None:
+        print "No valid FASTQ reads could be processed."
+    else:
+        print "%i FASTQ reads were converted to FASTA." % ( num_reads + 1 )
+    
+if __name__ == "__main__": main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fastq_to_fasta.xml	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,43 @@
+<tool id="fastq_to_fasta_python" name="FASTQ to FASTA" version="1.0.0">
+  <description>converter</description>
+  <requirements>
+    <requirement type="package" version="1.0.0">galaxy_sequence_utils</requirement>
+  </requirements>
+  <command interpreter="python">fastq_to_fasta.py '$input_file' '$output_file' '${input_file.extension[len( 'fastq' ):]}'</command>
+  <inputs>
+    <param name="input_file" type="data" format="fastq" label="FASTQ file to convert" />
+  </inputs>
+  <outputs>
+    <data name="output_file" format="fasta" />
+  </outputs>
+  <tests>
+    <!-- basic test -->
+    <test>
+      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastqsanger" />
+      <output name="output_file" file="fastq_to_fasta_python_1.out" />
+    </test>
+    <!-- color space test -->
+    <test>
+      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastqcssanger" />
+      <output name="output_file" file="fastq_to_fasta_python_2.out" />
+    </test>
+    <!-- test of ignoring invalid score values: this input has ascii characters falling outside of illumina range, but they should not matter -->
+    <test>
+      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastqillumina" />
+      <output name="output_file" file="fastq_to_fasta_python_1.out" />
+    </test>
+  </tests>
+  <help>
+**What it does**
+
+This tool converts FASTQ sequencing reads to FASTA sequences.
+
+------
+
+**Citation**
+
+If you use this tool, please cite `Blankenberg D, Gordon A, Von Kuster G, Coraor N, Taylor J, Nekrutenko A; Galaxy Team. Manipulation of FASTQ data with Galaxy. Bioinformatics. 2010 Jul 15;26(14):1783-5. &lt;http://www.ncbi.nlm.nih.gov/pubmed/20562416&gt;`_
+
+
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fastq_to_fasta_python_1.out	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,4 @@
+>FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC
+>FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fastq_to_fasta_python_2.out	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,4 @@
+>FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+G2131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131
+>FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+G3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sanger_full_range_as_cssanger.fastqcssanger	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,8 @@
+@FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+G2131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131
++
+!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+@FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+G3131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131
++
+~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sanger_full_range_masked_N.fastqsanger	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,8 @@
+@FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+NNNNNNNNNNNNNNNNNNNNNCGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC
++
+!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+@FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCNNNNNNNNNNNNNNNNNNNNN
++
+~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sanger_full_range_masked_lowercase.fastqsanger	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,8 @@
+@FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+acgtacgtacgtacgtacgtaCGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC
++
+!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+@FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCatgcatgcatgcatgcatgca
++
+~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/sanger_full_range_original_sanger.fastqsanger	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,8 @@
+@FAKE0001 Original version has PHRED scores from 0 to 93 inclusive (in that order)
+ACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTACGTAC
++
+!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+@FAKE0002 Original version has PHRED scores from 93 to 0 inclusive (in that order)
+CATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCATGCA
++
+~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Thu Jan 23 12:31:31 2014 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+  <package name="galaxy_sequence_utils" version="1.0.0">
+      <repository changeset_revision="195699b1562a" name="package_galaxy_utils_1_0" owner="devteam" prior_installation_required="False" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>