details: http://www.bx.psu.edu/hg/galaxy/rev/e6d01a8256bc changeset: 2906:e6d01a8256bc user: Kelly Vincent kpvincent@bx.psu.edu date: Wed Oct 21 16:04:24 2009 -0400 description: Updated solid_to_fastq so that -1 qualities are converted to 1 before conversion to FASTQ.
3 file(s) affected in this change:
tools/next_gen_conversion/bwa_solid2fastq_modified.pl tools/next_gen_conversion/solid_to_fastq.py tools/next_gen_conversion/solid_to_fastq.xml
diffs (78 lines):
diff -r 8a619f8e2fb6 -r e6d01a8256bc tools/next_gen_conversion/bwa_solid2fastq_modified.pl --- a/tools/next_gen_conversion/bwa_solid2fastq_modified.pl Wed Oct 21 15:45:01 2009 -0400 +++ b/tools/next_gen_conversion/bwa_solid2fastq_modified.pl Wed Oct 21 16:04:24 2009 -0400 @@ -73,7 +73,7 @@ if (/^>(\d+)_(\d+)_(\d+)_[FR]3/) { $key = sprintf("%.4d_%.4d_%.4d", $1, $2, $3); # this line could be improved on 64-bit machines #print $key; - die(qq/** unmatched read name: '$_' != '$_'\n/) unless ($_ eq $t); + die(qq/** unmatched read name: '$_' != '$t'\n/) unless ($_ eq $t); my $name = "$1_$2_$3/$i"; $_ = substr(<$fhs>, 2); tr/0123./ACGTN/; diff -r 8a619f8e2fb6 -r e6d01a8256bc tools/next_gen_conversion/solid_to_fastq.py --- a/tools/next_gen_conversion/solid_to_fastq.py Wed Oct 21 15:45:01 2009 -0400 +++ b/tools/next_gen_conversion/solid_to_fastq.py Wed Oct 21 16:04:24 2009 -0400 @@ -22,15 +22,29 @@ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() + +def replaceNeg1(fin, fout): + line = fin.readline() + while line.strip(): + fout.write(line.replace('-1', '1')) + line = fin.readline() + fout.seek(0) + return fout
def __main__(): #Parse Command Line options, args = doc_optparse.parse( __doc__ ) + # common temp file setup + tmpf = tempfile.NamedTemporaryFile() #forward reads + tmpqf = tempfile.NamedTemporaryFile() + tmpqf = replaceNeg1(file(options.input2,'r'), tmpqf) # if paired-end data (have reverse input files) - tmpf = tempfile.NamedTemporaryFile() #forward reads if options.input3 != "None" and options.input4 != "None": tmpr = tempfile.NamedTemporaryFile() #reverse reads - cmd1 = "%s/bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s 2>&1" %(os.path.split(sys.argv[0])[0], tmpf.name,tmpr.name,options.input1,options.input2,options.input3,options.input4) + # replace the -1 in the qualities file + tmpqr = tempfile.NamedTemporaryFile() + tmpqr = replaceNeg1(file(options.input4,'r'), tmpqr) + cmd1 = "%s/bwa_solid2fastq_modified.pl 'yes' %s %s %s %s %s %s 2>&1" %(os.path.split(sys.argv[0])[0], tmpf.name, tmpr.name, options.input1, tmpqf.name, options.input3, tmpqr.name) try: os.system(cmd1) os.system('gunzip -c %s >> %s' %(tmpf.name,options.output1)) @@ -38,14 +52,17 @@ except Exception, eq: stop_err("Error converting data to fastq format.\n" + str(eq)) tmpr.close() + tmpqr.close() # if single-end data else: - cmd1 = "%s/bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s 2>&1" % (os.path.split(sys.argv[0])[0], tmpf.name, None, options.input1, options.input2, None, None) + cmd1 = "%s/bwa_solid2fastq_modified.pl 'no' %s %s %s %s %s %s 2>&1" % (os.path.split(sys.argv[0])[0], tmpf.name, None, options.input1, tmpqf.name, None, None) try: os.system(cmd1) os.system('gunzip -c %s >> %s' % (tmpf.name, options.output1)) except Exception, eq: stop_err("Error converting data to fastq format.\n" + str(eq)) + tmpqf.close() tmpf.close() + sys.stdout.write('converted SOLiD data')
if __name__=="__main__": __main__() diff -r 8a619f8e2fb6 -r e6d01a8256bc tools/next_gen_conversion/solid_to_fastq.xml --- a/tools/next_gen_conversion/solid_to_fastq.xml Wed Oct 21 15:45:01 2009 -0400 +++ b/tools/next_gen_conversion/solid_to_fastq.xml Wed Oct 21 16:04:24 2009 -0400 @@ -66,7 +66,7 @@
**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. +This tool takes reads and quality files and converts them to FASTQ data ( Sanger variant ). Any -1 qualities are converted to 1 before being converted to FASTQ. Note that it also converts sequences to base pairs.
-----
galaxy-dev@lists.galaxyproject.org