X-Git-Url: https://git.donarmstrong.com/?p=biopieces.git;a=blobdiff_plain;f=bp_bin%2Fremove_primers;h=6544afce3087b02dd53f83f8202e7f7c647c4aa5;hp=88c1a81c3351df23fca647bec6d131d5b64e9dd9;hb=10e0db1d8cc294afc9bcff4c56ca34770e0052cb;hpb=3656f15bb59e2eb7eff628bae117db6479b2f03f diff --git a/bp_bin/remove_primers b/bp_bin/remove_primers index 88c1a81..6544afc 100755 --- a/bp_bin/remove_primers +++ b/bp_bin/remove_primers @@ -50,22 +50,22 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| 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| @@ -75,10 +75,10 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| 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 @@ -86,7 +86,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| end if forward or reverse - record.merge!(seq.to_bp) + record.merge!(entry.to_bp) end output.puts record