X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Fpatscan_seq;h=28f028dec433ccb5ac8ccd32c6d4ba59b9d08a0d;hb=59c0c522f4a4452b0951f33794dc797c4bcaecfe;hp=64fc6ddff6d91d6c1d7f90bcc09819acb706072b;hpb=b676baacf06b64c51fcb3cb5041e8fa3bbd3e5cb;p=biopieces.git diff --git a/bp_bin/patscan_seq b/bp_bin/patscan_seq index 64fc6dd..28f028d 100755 --- a/bp_bin/patscan_seq +++ b/bp_bin/patscan_seq @@ -51,7 +51,7 @@ class Patscan args << "scan_for_matches" args << "-c" if options[:comp] args << "-p" if options[:seq_type] == :protein - args << "-o" if options[:overlap] + args << "-o 1" if options[:overlap] args << "-n #{options[:max_misses]}" if options[:max_misses] args << "-m #{options[:max_hits]}" if options[:max_hits] args << File.join(@tmp_dir, "#{i}.pat") @@ -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 @@ -160,7 +161,7 @@ seq_name_hash = {} seq_type = nil Biopieces.open(options[:stream_in], tmp_file) do |input, output| - Fasta.open(in_file, mode="w") do |fasta_io| + Fasta.open(in_file, "w") do |fasta_io| input.each_record do |record| if record[:SEQ_NAME] seq_name_hash[seq_name_count] = record[:SEQ_NAME] @@ -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