]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/clip_adaptor
refactor subseq to Seq#[]
[biopieces.git] / bp_bin / clip_adaptor
index 0589b27d0c109bf551d8ff4db07e42192ec3ee99..1bf6bf5240a61f374ec4ac9bed8d7e6e51aa001f 100755 (executable)
@@ -42,11 +42,13 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
       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]
-        entry.subseq!(record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i)
+        if record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i < entry.length
+          entry = entry[record[:ADAPTOR_POS_LEFT].to_i + record[:ADAPTOR_LEN_LEFT].to_i .. -1]
+        end
       end
 
       record.merge! entry.to_bp