class Bio::Blast::Default::Report::Iteration

Bio::Blast::Default::Report::Iteration stores information about a iteration. It may contain some Bio::Blast::Default::Report::Hit objects. Note that a PSI-BLAST (blastpgp command) result usually contain multiple iterations in it, and a normal BLAST (blastall command) result usually contain one iteration in it.

Attributes

database[R]

name (title or filename) of the database

db_len[R]

number of sequences in database

db_num[R]

number of letters in database

eff_space[R]

effective length of the database

entropy[R]

entropy of the database

expect[R]

e-value threshold specified when BLAST was executed

gapped_entropy[R]

gapped entropy of the database

gapped_kappa[R]

gapped kappa of the database

gapped_lambda[R]

gapped lambda of the database

kappa[R]

kappa of the database

lambda[R]

lambda of the database

message[R]

(PSI-BLAST) Messages of the iteration.

num[R]

(PSI-BLAST) Iteration round number.

pattern_in_database[R]

(PHI-BLAST) Number of occurrences of pattern in the database.

posted_date[R]

posted date of the database

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::Default::Report class. Users shall not use the method directly.

# File lib/bio/appl/blast/format0.rb, line 492
def initialize(data)
  @f0stat = []
  @f0dbstat = AlwaysNil.instance
  @f0hitlist = []
  @hits = []
  @num = 1
  r = data.shift
  @f0message = [ r ]
  r.gsub!(/^Results from round (\d+).*\z/) { |x|
    @num = $1.to_i
    @f0message << x
    ''
  }
  r = data.shift
  while /^Number of occurrences of pattern in the database is +(\d+)/ =~ r
    # PHI-BLAST
    @pattern_in_database = $1.to_i
    @f0message << r
    r = data.shift
  end
  if /^Results from round (\d+)/ =~ r then
    @num = $1.to_i
    @f0message << r
    r = data.shift
  end
  if r and !(/\*{5} No hits found \*{5}/ =~ r) then
    @f0hitlist << r
    begin
      @f0hitlist << data.shift
    end until r = data[0] and /^\>/ =~ r
    if r and /^CONVERGED\!/ =~ r then
      r.sub!(/(.*\n)*^CONVERGED\!.*\n/) { |x| @f0hitlist << x; '' }
    end
    if defined?(@pattern_in_database) and r = data.first then
      #PHI-BLAST
      while /^\>/ =~ r
        @hits << Hit.new(data)
        r = data.first
        break unless r
        while /^Significant alignments for pattern/ =~ r
          data.shift
          r = data.first
        end
      end
    else
      #not PHI-BLAST
      while r = data[0] and /^\>/ =~ r
        @hits << Hit.new(data)
      end
    end
  end
  if /^CONVERGED\!\s*$/ =~ @f0hitlist[-1].to_s then
    @message = 'CONVERGED!'
    @flag_converged = true
  end
end

Public Instance Methods

converged?() click to toggle source

(PSI-BLAST) Returns true if the iteration is converged. Otherwise, returns false.

# File lib/bio/appl/blast/format0.rb, line 573
def converged?
  @flag_converged
end
each() { |x| ... } click to toggle source

Iterates over each hit of the iteration. Yields a Bio::Blast::Default::Report::Hit object.

# File lib/bio/appl/blast/format0.rb, line 565
def each
  hits.each do |x|
    yield x
  end
end
hits() click to toggle source

Returns the hits of the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.

# File lib/bio/appl/blast/format0.rb, line 558
def hits
  parse_hitlist
  @hits
end
hits_for_pattern() click to toggle source

(PHI-BLAST) Returns hits for pattern. ????

# File lib/bio/appl/blast/format0.rb, line 625
def hits_for_pattern
  parse_hitlist
  @hits_for_pattern
end
hits_found_again() click to toggle source

(PSI-BLAST) Returns hits which have been found again in the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.

# File lib/bio/appl/blast/format0.rb, line 611
def hits_found_again
  parse_hitlist
  @hits_found_again
end
hits_newly_found() click to toggle source

(PSI-BLAST) Returns hits which have been newly found in the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.

# File lib/bio/appl/blast/format0.rb, line 619
def hits_newly_found
  parse_hitlist
  @hits_newly_found
end
pattern() click to toggle source

(PHI-BLAST) Returns pattern string. Returns nil if it is not a PHI-BLAST result.

# File lib/bio/appl/blast/format0.rb, line 579
def pattern
  #PHI-BLAST
  if defined? @pattern
    @pattern
  elsif defined? @pattern_in_database then
    @pattern = nil
    @pattern_positions = []
    @f0message.each do |r|
      sc = StringScanner.new(r)
      if sc.skip_until(/^ *pattern +([^\s]+)/) then
        @pattern = sc[1] unless @pattern
        sc.skip_until(/(?:^ *| +)at position +(\d+) +of +query +sequence/)
        @pattern_positions << sc[1].to_i
      end
    end
    @pattern
  else
    nil
  end
end
pattern_positions() click to toggle source

(PHI-BLAST) Returns pattern positions. Returns nil if it is not a PHI-BLAST result.

# File lib/bio/appl/blast/format0.rb, line 602
def pattern_positions
  #PHI-BLAST
  pattern
  @pattern_positions
end