diff --git a/tool_conf.xml.sample b/tool_conf.xml.sample index 1045c1c14f6..ce0e35ab935 100644 --- a/tool_conf.xml.sample +++ b/tool_conf.xml.sample @@ -77,6 +77,8 @@ + +
diff --git a/tools/next_gen_conversion/fastq_conversions.py b/tools/next_gen_conversion/fastq_conversions.py new file mode 100644 index 00000000000..123bc1acdb9 --- /dev/null +++ b/tools/next_gen_conversion/fastq_conversions.py @@ -0,0 +1,41 @@ +#! /usr/bin/python + +""" +Performs various conversions around Sanger FASTQ data + +usage: %prog [options] + -c, --command=c: Command to run + -i, --input=i: Input file to be converted + -o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std + -s, --outputFastqsolexa=s: FASTQ Solexa converted output file + -f, --outputFasta=f: FASTA converted output file + +usage: %prog command input_file output_file +""" + +import os, sys, tempfile +from galaxy import eggs +import pkg_resources; pkg_resources.require( "bx-python" ) +from bx.cookbook import doc_optparse + +def stop_err( msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + +def __main__(): + #Parse Command Line + options, args = doc_optparse.parse( __doc__ ) + + cmd = "fq_all2std.pl %s %s > %s" + if options.command == 'sol2std': + cmd = cmd % (options.command, options.input, options.outputFastqsanger) + elif options.command == 'std2sol': + cmd = cmd % (options.command, options.input, options.outputFastqsolexa) + elif options.command == 'fq2fa': + cmd = cmd % (options.command, options.input, options.outputFasta) + try: + os.system(cmd) + except Exception, eq: + stop_err("Error converting data format.\n" + str(eq)) + +if __name__=="__main__": __main__() diff --git a/tools/next_gen_conversion/fastq_conversions.xml b/tools/next_gen_conversion/fastq_conversions.xml new file mode 100644 index 00000000000..c87c4571ec8 --- /dev/null +++ b/tools/next_gen_conversion/fastq_conversions.xml @@ -0,0 +1,133 @@ + + converts between FASTQ data and other data formats + + fastq_conversions.py + --command=$conversionType.type + --input=$input + #if $conversionType.type == "sol2std": + --outputFastqsanger=$outputFastqsanger + #else: + --outputFastqsanger="None" + #end if + #if $conversionType.type == "std2sol": + --outputFastqsolexa=$outputFastqsolexa + #else: + --outputFastqsolexa="None" + #end if + #if $conversionType.type == "fq2fa": + --outputFasta=$outputFasta + #else: + --outputFasta="None" + #end if + + + + + + + + + + + + + + + + + + + + + + conversionType['type'] == 'sol2std' + + + conversionType['type'] == 'std2sol' + + + conversionType['type'] == 'fq2fa' + + + + + + + + + + + + + + + + + + + + +**What it does** + +This tool offers several conversions options relating to the FASTQ format. + +----- + +**Examples** + +- Converting the Solexa/Illumina FASTQ data:: + + @081017-and-081020:1:1:1715:1759 + GGACTCAGATAGTAATCCACGCTCCTTTAAAATATC + + + II#IIIIIII$5+.(9IIIIIII$%*$G$A31I&&B + +- will produce the following Sanger FASTQ data:: + + @081017-and-081020:1:1:1715:1759 + GGACTCAGATAGTAATCCACGCTCCTTTAAAATATC + + + ++!+++++++!!!!!"+++++++!!!!)!%!!+!!%! + +- Converting standard Sanger FASTQ:: + + @1831_573_1004/1 + AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG + + + ><C&&9952+C>5<.?<79,=42<292:<(9/-7 + @1831_573_1050/1 + TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT + + + ;@@17?@=>7??@A8?==@4A?A4)&+.'&+'1, + +- will produce the following Solexa/Illumina FASTQ data:: + + @1831_573_1004/1 + AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG + + + ][bEEXXTQJb]T[M^[VXK\SQ[QXQY[GXNLV + @1831_573_1050/1 + TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT + + + Z__PV^_\]V^^_`W^\\_S`^`SHEJMFEJFPK + +- Converting the Sanger FASTQ data:: + + @1831_573_1004/1 + AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG + + + ><C&&9952+C>5<.?<79,=42<292:<(9/-7 + @1831_573_1050/1 + TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT + + + ;@@17?@=>7??@A8?==@4A?A4)&+.'&+'1, + +- will produce the following FASTA data:: + + >1831_573_1004/1 + AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG + >1831_573_1050/1 + TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT + + + diff --git a/tools/next_gen_conversion/solid_to_fastq.py b/tools/next_gen_conversion/solid_to_fastq.py new file mode 100644 index 00000000000..2a345d13334 --- /dev/null +++ b/tools/next_gen_conversion/solid_to_fastq.py @@ -0,0 +1,53 @@ +#! /usr/bin/python + +""" +Converts SOLiD data to Sanger FASTQ format. + +usage: %prog [options] + -i, --input1=i: Forward reads file + -q, --input2=q: Forward qual file + -I, --input3=I: Reverse reads file + -Q, --input4=Q: Reverse qual file + -o, --output1=o: Forward output + -r, --output2=r: Reverse output + +usage: %prog forward_reads_file forwards_qual_file reverse_reads_file(or_None) reverse_qual_file(or_None) output_file ouptut_id output_dir +""" + +import os, sys, tempfile +from galaxy import eggs +import pkg_resources; pkg_resources.require( "bx-python" ) +from bx.cookbook import doc_optparse + +def stop_err( msg ): + sys.stderr.write( "%s\n" % msg ) + sys.exit() + +def __main__(): + #Parse Command Line + options, args = doc_optparse.parse( __doc__ ) + # if paired-end data (have reverse input files) + if options.input3 != "None" and options.input4 != "None": + tmpf = tempfile.NamedTemporaryFile() #forward reads + tmpr = tempfile.NamedTemporaryFile() #reverse reads + + cmd1 = "bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s %s 2>&1" %(tmpf.name,tmpr.name,None,options.input1,options.input2,options.input3,options.input4) + try: + os.system(cmd1) + os.system('gunzip -c %s >> %s' %(tmpf.name,options.output1)) + os.system('gunzip -c %s >> %s' %(tmpr.name,options.output2)) + + except Exception, eq: + stop_err("Error converting data to fastq format.\n" + str(eq)) + # if single-end data + else: + tmpf = tempfile.NamedTemporaryFile() + cmd1 = "bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s %s 2>&1" % (tmpf.name, None, None, options.input1, options.input2, None, None) + try: + os.system(cmd1) + os.system('gunzip -c %s >> %s' % (tmpf.name, options.output1)) + tmpf.close() + except Exception, eq: + stop_err("Error converting data to fastq format.\n" + str(eq)) + +if __name__=="__main__": __main__() diff --git a/tools/next_gen_conversion/solid_to_fastq.xml b/tools/next_gen_conversion/solid_to_fastq.xml new file mode 100644 index 00000000000..ff8741fa9f9 --- /dev/null +++ b/tools/next_gen_conversion/solid_to_fastq.xml @@ -0,0 +1,101 @@ + + converts SOLiD data to FASTQ data + + solid_to_fastq.py + --input1=$input1 + --input2=$input2 + #if $paired.pairedSingle == "single": + --input3="None" + --input4="None" + #else: + --input3=$input3 + --input4=$input4 + #end if + --output1=$output1 + #if $paired.pairedSingle == "single": + --output2="None" + #else: + --output2=$output2 + #end if + + + + + + + + + + + + + + + + + + + + + + + + paired['pairedSingle'] == 'paired' + + + + + + + + + + + + + +**What it does** + +This tool takes reads and quality files and converts them to FASTQ data ( Sanger variant ). Note that it also converts sequences to base pairs. + +----- + +**Example** + +- Converting the following sequences:: + + >seq1 + T00030133312212111300011021310132222 + >seq2 + T03330322230322112131010221102122113 + +- and quality scores:: + + >seq1 + 4 29 34 34 32 32 24 24 20 17 10 34 29 20 34 13 30 34 22 24 11 28 19 17 34 17 24 17 25 34 7 24 14 12 22 + >seq2 + 8 26 31 31 16 22 30 31 28 29 22 30 30 31 32 23 30 28 28 31 19 32 30 32 19 8 32 10 13 6 32 10 6 16 11 + +- will produce the following Sanger FASTQ data:: + + @seq1 + AATACTTTCGGCGCCCTAAACCAGCTCACTGGGG + + + >CCAA9952+C>5C.?C79,=42C292:C(9/-7 + @seq2 + TTTATGGGTATGGCCGCTCACAGGCCAGCGGCCT + + + ;@@17?@=>7??@A8?==@4A?A4)A+.'A+'1, + + +