class Bio::Blast::WU::Report::Iteration

Iteration class for WU-BLAST report. Though WU-BLAST does not iterate like PSI-BLAST, Bio::Blast::WU::Report::Iteration aims to keep compatibility with Bio::Blast::Default::Report::* classes. It may contain some Bio::Blast::WU::Report::Hit objects. Because it inherits Bio::Blast::Default::Report::Iteration, please also refer Bio::Blast::Default::Report::Iteration.

Public Class Methods

new(data) click to toggle source

Creates a new Iteration object. It is designed to be called only internally from the Bio::Blast::WU::Report class. Users shall not use the method directly.

# File lib/bio/appl/blast/wublast.rb, line 319
def initialize(data)
  @f0stat = []
  @f0dbstat = Default::Report::AlwaysNil.instance
  @f0hitlist = []
  @hits = []
  @num = 1
  @f0message = []
  @f0warnings = []
  return unless r = data.first
  return if /\AParameters\:$/ =~ r
  return if /\AEXIT CODE *\d+/ =~ r
  @f0hitlist << data.shift
  return unless r = data.shift
  unless /\*{3} +NONE +\*{3}/ =~ r then
    @f0hitlist << r
    while r = data.first and /^WARNING\: / =~ r
      @f0warnings << data.shift
    end
    while r = data.first and /^\>/ =~ r
      @hits << Hit.new(data)
    end
  end #unless
end

Public Instance Methods

warnings() click to toggle source

Returns warning messages.

# File lib/bio/appl/blast/wublast.rb, line 344
def warnings
  @f0warnings
end

Private Instance Methods

parse_hitlist() click to toggle source

Parses hit list.

# File lib/bio/appl/blast/wublast.rb, line 350
def parse_hitlist
  unless defined?(@parse_hitlist)
    r = @f0hitlist.shift.to_s
    if /Reading/ =~ r and /Frame/ =~ r then
      flag_tblast = true 
      spnum = 5
    else
      flag_tblast = nil
      spnum = 4
    end
    i = 0
    @f0hitlist.each do |x|
      b = x.split(/^/)
      b.collect! { |y| y.empty? ? nil : y }
      b.compact!
      b.each do |y|
        y.strip!
        y.reverse!
        z = y.split(/\s+/, spnum)
        z.each { |y| y.reverse! }
        dfl  = z.pop
        h = @hits[i] 
        unless h then
          h = Hit.new([ dfl.to_s.sub(/\.+\z/, '') ])
          @hits[i] = h
        end
        z.pop if flag_tblast #ignore Reading Frame
        scr = z.pop
        scr = (scr ? scr.to_i : nil)
        pval = z.pop.to_s
        pval = '1' + pval if pval[0] == ?e
        pval = (pval.empty? ? (1.0/0.0) : pval.to_f)
        nnum = z.pop.to_i
        h.instance_eval {
          @score = scr
          @pvalue = pval
          @n_number = nnum
        }
        i += 1
      end
    end #each
    @parse_hitlist = true
  end #unless
end