Fix srf2named_fastq to output the proper /2 in paired end reads
authorDiane Trout <diane@caltech.edu>
Tue, 22 Jun 2010 19:07:48 +0000 (19:07 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 22 Jun 2010 19:07:48 +0000 (19:07 +0000)
scripts/srf2named_fastq.py

index b6b8b55cc82b5c929c51293a7497bedd91883db4..22edc12743b52f1f6b9141cdf566bc1fe28e4f19 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+import logging
 from optparse import OptionParser
 import os
 from subprocess import Popen, PIPE
@@ -14,6 +15,11 @@ def main(cmdline=None):
     if len(args) != 1:
         parser.error("Requires one argument")
 
+    if opts.verbose:
+        logging.basicConfig(level=logging.INFO)
+    else:
+        logging.basicConfig(level=logging.WARN)
+
     if opts.flowcell is not None:
         header = "%s_" % (opts.flowcell,)
     else:
@@ -58,6 +64,8 @@ You can also force the flowcell ID to be added to the header.""")
                       help='actual sequence mid point')
     parser.add_option('-s','--single', default=None,
                       help="single fastq target name")
+    parser.add_option('-v', '--verbose', default=False, action="store_true",
+                      help="show information about what we're doing.")
     return parser
 
 
@@ -70,7 +78,8 @@ def srf_open(filename, cnf1=False):
     if cnf1:
         cmd.append('-c')
     cmd.append(filename)
-        
+      
+    logging.info('srf command: %s' % (" ".join(cmd),))
     p = Popen(cmd, stdout=PIPE)
     return p.stdout
     
@@ -109,7 +118,7 @@ def convert_single_to_two_fastq(instream, target1, target2, mid=None, header='')
             target2.write('@')
             target2.write(header)
             target2.write(line[1:])
-            target2.write("/1")
+            target2.write("/2")
             target2.write(os.linesep)
 
         # quality header