]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed but in order_pairs3
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 1 Nov 2012 17:45:33 +0000 (17:45 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 1 Nov 2012 17:45:33 +0000 (17:45 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1983 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/order_pairs3

index 6edb1fdb981a10daaf352cefc72baa0074a3237a..6a943c01ad08c9dc0f3b35cf1665df4d34751a27 100755 (executable)
@@ -66,7 +66,7 @@ def files_merge(file_in1, file_in2)
 end
 
 casts = []
-casts << {:long=>'block_size', :short=>'b', :type=>'uint', :mandatory=>false, :default=>10_000_000, :allowed=>nil, :disallowed=>'0'}
+casts << {:long=>'block_size', :short=>'b', :type=>'uint', :mandatory=>false, :default=>100_000_000, :allowed=>nil, :disallowed=>'0'}
 
 options = Biopieces.options_parse(ARGV, casts)
 tmpdir  = Biopieces.mktmpdir
@@ -116,9 +116,8 @@ end
 
 Biopieces.open(File.join(tmpdir, "0.stream"), options[:stream_out]) do |input, output|
   record1 = input.get_entry
-  record2 = input.get_entry
 
-  while record1 and record2
+  while record2 = input.get_entry
     case record1[:SEQ_NAME]
     when /^(.+)\/(\d)$/   # Illumina 1.5
       name1 = $1
@@ -138,7 +137,7 @@ Biopieces.open(File.join(tmpdir, "0.stream"), options[:stream_out]) do |input, o
       name2 = $1
       pair2 = $2.to_i
     else
-      $stderr.puts "WARNING: Unmatched sequence name: #{record1[:SEQ_NAME]}"
+      $stderr.puts "WARNING: Unmatched sequence name: #{record2[:SEQ_NAME]}"
     end
 
     if name1 == name2 and (pair1 - pair2).abs == 1
@@ -147,14 +146,28 @@ Biopieces.open(File.join(tmpdir, "0.stream"), options[:stream_out]) do |input, o
       output.puts record1
       output.puts record2
       record1 = input.get_entry
-      record2 = input.get_entry
     else
       record1[:ORDER] = "orphan #{pair1}"
       output.puts record1
       record1 = record2
-      record2 = input.get_entry
     end
   end
+
+  if record1
+    case record1[:SEQ_NAME]
+    when /^(.+)\/(\d)$/   # Illumina 1.5
+      name1 = $1
+      pair1 = $2.to_i
+    when /^(.+) (\d):/    # Illumina 1.8
+      name1 = $1
+      pair1 = $2.to_i
+    else
+      $stderr.puts "WARNING: Unmatched sequence name: #{record1[:SEQ_NAME]}"
+    end
+
+    record1[:ORDER] = "orphan #{pair1}"
+    output.puts record1
+  end
 end
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<