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")
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
# 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
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]
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
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