]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/slice_align
added tests for slice_align
[biopieces.git] / bp_bin / slice_align
index 586c2701570dfbd46d546a3cdf0e3bc012f731e5..f63ac7e203c2e41c40c15d294fd11798e760b5d5 100755 (executable)
@@ -24,7 +24,7 @@
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
-# Join sequences in the stream.
+# Slice aligned sequences in the stream to obtain subsequences.
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
@@ -60,13 +60,17 @@ else
   raise "either --beg/--end or --forward/--reverse|--reverse_rc must be specified"
 end
 
+if options[:template_file]
+  template = Fasta.open(options[:template_file]).get_entry
+end
+
 Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output|
   input.each_record do |record|
     if record[:SEQ]
       entry = Seq.new(seq: record[:SEQ])
 
       unless options[:beg]
-        compact = Seq.new(seq: entry.seq.dup)
+        compact = template ? template : Seq.new(seq: entry.seq.dup)
         compact.seq.delete! "-.~"
 
         fmatch = compact.patmatch(options[:forward],