]> git.donarmstrong.com Git - biopieces.git/commitdiff
updated patscan_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 17 Jun 2013 09:56:22 +0000 (09:56 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 17 Jun 2013 09:56:22 +0000 (09:56 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2179 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/patscan_seq

index 64fc6ddff6d91d6c1d7f90bcc09819acb706072b..f408bd677f5c31ad1aaaeb1371c15f8db104ab34 100755 (executable)
@@ -85,7 +85,7 @@ class Patscan
               strand = '-'
             end
 
-            results[id.to_i] << Match.new(start, stop, strand, entry.seq)
+            results[id.to_i] << Match.new(start, stop, strand, pattern, entry.seq)
           else
             raise "Failed to parse seq_name: #{entry.seq_name} in patscan result"
           end
@@ -109,12 +109,13 @@ class Patscan
 
   # Subclass to define Patscan hits.
   class Match
-    attr_reader :start, :stop, :strand, :match
+    attr_reader :start, :stop, :strand, :pattern, :match
 
-    def initialize(start, stop, strand, match)
+    def initialize(start, stop, strand, pattern, match)
       @start   = start
       @stop    = stop
       @strand  = strand
+      @pattern = pattern
       @match   = match
     end
 
@@ -196,7 +197,7 @@ Biopieces.open(tmp_file, options[:stream_out]) do |input, output|
       if options[:inline]
         if results[key]
           results[key].each do |result|
-            record[:PATTERN]   = options[:pattern]
+            record[:PATTERN]   = result.pattern
             record[:MATCH]     = result.match
             record[:S_BEG]     = result.start
             record[:S_END]     = result.stop
@@ -216,7 +217,7 @@ Biopieces.open(tmp_file, options[:stream_out]) do |input, output|
         results[key].each do |result|
           new_record[:REC_TYPE]  = "PATSCAN"
           new_record[:S_ID]      = record[:SEQ_NAME]
-          new_record[:Q_ID]      = options[:pattern]
+          new_record[:Q_ID]      = result.pattern
           new_record[:MATCH]     = result.match
           new_record[:S_BEG]     = result.start
           new_record[:S_END]     = result.stop