]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/clip_seq
removed debug message
[biopieces.git] / bp_bin / clip_seq
index f26e10b9dea90023b800b3127e6cca9cacb290cf..44d1e508e1b007a0a8ae50b4ba67f37bc88bb20c 100755 (executable)
@@ -33,31 +33,31 @@ require 'maasha/biopieces'
 
 casts = []
 
-bp = Biopieces.new
+options = Biopieces.options_parse(ARGV, casts)
 
-options = bp.parse(ARGV, casts)
+Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
+  input.each_record do |record|
+    if record[:SEQ]
+      trim_beg = 0
+      trim_end = record[:SEQ].length
 
-bp.each_record do |record|
-  if record.has_key? :SEQ
-    trim_beg = 0
-    trim_end = record[:SEQ].length
+      record[:SEQ] =~ /[^a-z]/
 
-    record[:SEQ] =~ /[^a-z]/
+      trim_beg = $`.length
 
-    trim_beg = $`.length
+      if record[:SEQ] =~ /[a-z]+$/
+        trim_end = $`.length
+      else
+        trim_end = record[:SEQ].length
+      end
 
-    if record[:SEQ] =~ /[a-z]+$/
-      trim_end = $`.length
-    else
-      trim_end = record[:SEQ].length
+      record[:SEQ]     = record[:SEQ][trim_beg ... trim_end]
+      record[:SEQ_LEN] = record[:SEQ].length
+      record[:SCORES]  = record[:SCORES][trim_beg ... trim_end] if record[:SCORES]
     end
 
-    record[:SEQ]     = record[:SEQ][trim_beg ... trim_end]
-    record[:SEQ_LEN] = record[:SEQ].length
-    record[:SCORES]  = record[:SCORES][trim_beg ... trim_end] if record.has_key? :SCORES
+    output.puts record
   end
-
-  bp.puts record
 end