entry = Seq.new_bp(record)
if record[:ADAPTOR_POS_RIGHT]
- entry.subseq!(0, record[:ADAPTOR_POS_RIGHT].to_i)
+ entry = entry[0 ... record[:ADAPTOR_POS_RIGHT].to_i]
end
if record[:ADAPTOR_POS_LEFT]
if record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i < entry.length
- entry.subseq!(record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i)
+ entry = entry[record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i .. -1]
end
end
if record[:SEQ]
forward = false
reverse = false
- seq = Seq.new_bp(record)
+ entry = Seq.new_bp(record)
- seq.patscan(options[:forward].to_s,
+ entry.patscan(options[:forward].to_s,
max_mismatches: options[:mismatches],
max_insertions: options[:insertions],
max_deletions: options[:deletions]) do |match|
record[:FORWARD_POS] = match.pos
record[:FORWARD_LEN] = match.length
pos = match.pos + match.length
- len = seq.length - pos
- seq.subseq!(pos, len) if len > 0
+ len = entry.length - pos
+ entry = entry[pos ... pos + len] if len > 0
forward = true
break
end
- seq.patscan(options[:reverse].to_s,
+ entry.patscan(options[:reverse].to_s,
max_mismatches: options[:mismatches],
max_insertions: options[:insertions],
max_deletions: options[:deletions]) do |match|
len = match.pos
if len == 0
- seq.seq = ""
- seq.qual = "" if seq.qual
+ entry.seq = ""
+ entry.qual = "" if entry.qual
else
- seq.subseq!(pos, len)
+ entry = entry[pos ... pos + len]
end
reverse = true
end
if forward or reverse
- record.merge!(seq.to_bp)
+ record.merge!(entry.to_bp)
end
output.puts record
raise "SEQ_LEN_LEFT + SEQ_LEN_RIGHT != SEQ_LEN #{len_left} + #{len_right} != #{entry.length}"
end
- entry1 = entry.subseq(0, len_left)
- entry2 = entry.subseq(len_left)
+ entry1 = entry[0 ... len_left]
+ entry2 = entry[len_left .. -1]
if entry.seq_name =~ /^[^ ]+ \d:/
entry2.seq_name.sub!(/ \d:/, " 2:")