Fixed a stupid and truly horrible paired end splitter bug

This commit is contained in:
Anton Nekrutenko
2009-08-20 17:33:39 -04:00
parent 4b3f327a70
commit bf9666bf21
3 changed files with 16 additions and 8 deletions
+1 -1
View File
@@ -71,7 +71,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie1_TabSeq/flow.html',width:640,height:500,scroll:'no'})">
<a href="javascript:parent.show_in_overlay({url:'http://screencast.g2.bx.psu.edu/galaxy/quickie1_TabSeq/quickie1_TabSeq.flv',width:640,height:500,scroll:'no'})">
<div class="quickie">
<img src="images/qk/quickie1_small.png" border="0">
</div>
+11 -3
View File
@@ -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()
+4 -4
View File
@@ -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.")