From c25845f951359f3a6399370497bda9e90e8840d1 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Thu, 1 Nov 2012 17:45:33 +0000 Subject: [PATCH] fixed but in order_pairs3 git-svn-id: http://biopieces.googlecode.com/svn/trunk@1983 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/order_pairs3 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) 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 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -- 2.39.2