Method: Bio::Sim4::Report#initialize

Defined in:
lib/bio/appl/sim4/report.rb

#initialize(text) ⇒ Report

Creates new Bio::Sim4::Report object from String. You can use Bio::FlatFile to read a file. Currently, format A=0, A=3, and A=4 are supported. (A=1, A=2, A=5 are NOT supported yet.)

Note that ‘seq1’ in sim4 result is always regarded as ‘query’, and ‘seq2’ is always regarded as ‘subject’(target, hit).

Note that first ‘seq1’ informations are used for Bio::Sim4::Report#query_id, #query_def, #query_len, and #seq1 methods.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/bio/appl/sim4/report.rb', line 42

def initialize(text)
  @hits = []
  @all_hits = []
  overrun = ''
  text.each_line("\n\nseq1 = ") do |str|
    str = str.sub(/\A\s+/, '')
    str.sub!(/\n(^seq1 \= .*)/m, "\n") # remove trailing hits for sure
    tmp = $1.to_s
    hit = Hit.new(overrun + str)
    overrun = tmp
    unless hit.instance_eval { @data.empty? } then
      @hits << hit
    end
    @all_hits << hit
  end
  @seq1 = @all_hits[0].seq1
end