From bf9666bf215767f1cc30fe5d2d2ce154f12d869b Mon Sep 17 00:00:00 2001 From: Anton Nekrutenko Date: Thu, 20 Aug 2009 17:33:39 -0400 Subject: [PATCH] Fixed a stupid and truly horrible paired end splitter bug --- static/welcome.html | 2 +- tools/metag_tools/split_paired_reads.py | 14 +++++++++++--- tools/solid_tools/maq_cs_wrapper.py | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/static/welcome.html b/static/welcome.html index b64180964ca..4bbb02cae90 100644 --- a/static/welcome.html +++ b/static/welcome.html @@ -71,7 +71,7 @@
- +
diff --git a/tools/metag_tools/split_paired_reads.py b/tools/metag_tools/split_paired_reads.py index f2e4039e5a6..f2b01bc7b35 100644 --- a/tools/metag_tools/split_paired_reads.py +++ b/tools/metag_tools/split_paired_reads.py @@ -1,7 +1,7 @@ #! /usr/bin/python """ -Split Solexa paired end reads +Split fixed length paired end reads """ import os, sys @@ -12,9 +12,13 @@ if __name__ == '__main__': outfile_end1 = open(sys.argv[2], 'w') outfile_end2 = open(sys.argv[3], 'w') - for i, line in enumerate(file(infile)): + i = 0 + + for line in file( infile ): line = line.rstrip() - if not line or line.startswith('#'): continue + + if not line: + continue end1 = '' end2 = '' @@ -42,5 +46,9 @@ if __name__ == '__main__': outfile_end1.write('%s\n' %(end1)) outfile_end2.write('%s\n' %(end2)) + i += 1 + + if i % 4 != 0 : + sys.stderr.write("WARNING: Number of lines in the input file was not divisible by 4.\nCheck consistency of the input fastq file.\n") outfile_end1.close() outfile_end2.close() \ No newline at end of file diff --git a/tools/solid_tools/maq_cs_wrapper.py b/tools/solid_tools/maq_cs_wrapper.py index 82f29270975..e0c305dd9eb 100644 --- a/tools/solid_tools/maq_cs_wrapper.py +++ b/tools/solid_tools/maq_cs_wrapper.py @@ -48,9 +48,9 @@ def __main__(): cmd1 = "solid2fastq_modified.pl 'yes' %s %s %s %s %s %s %s 2>&1" %(tmpf.name,tmpr.name,tmps.name,f3_read_fname,f3_qual_fname,r3_read_fname,r3_qual_fname) try: os.system(cmd1) - os.system('zcat -f %s >> %s' %(tmpf.name,tmpffastq.name)) - os.system('zcat -f %s >> %s' %(tmpr.name,tmprfastq.name)) - os.system('zcat -f %s >> %s' %(tmps.name,tmpsfastq.name)) + os.system('gunzip -c %s >> %s' %(tmpf.name,tmpffastq.name)) + os.system('gunzip -c %s >> %s' %(tmpr.name,tmprfastq.name)) + os.system('gunzip -c %s >> %s' %(tmps.name,tmpsfastq.name)) except Exception, eq: stop_err("Error converting data to fastq format." + str(eq)) @@ -135,7 +135,7 @@ def __main__(): cmd1 = "solid2fastq_modified.pl 'no' %s %s %s %s %s %s %s 2>&1" %(tmpf.name,None,None,f3_read_fname,f3_qual_fname,None,None) try: os.system(cmd1) - os.system('zcat -f %s >> %s' %(tmpf.name,tmpfastq.name)) + os.system('gunzip -c %s >> %s' %(tmpf.name,tmpfastq.name)) tmpf.close() except: stop_err("Error converting data to fastq format.")