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
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
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
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
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<