X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Forder_pairs3;h=6a943c01ad08c9dc0f3b35cf1665df4d34751a27;hb=c25845f951359f3a6399370497bda9e90e8840d1;hp=6edb1fdb981a10daaf352cefc72baa0074a3237a;hpb=e584ac2e3932dfa8abcb497c4b69ffd944affd34;p=biopieces.git diff --git a/bp_bin/order_pairs3 b/bp_bin/order_pairs3 index 6edb1fd..6a943c0 100755 --- a/bp_bin/order_pairs3 +++ b/bp_bin/order_pairs3 @@ -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 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<