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
492 def initialize(data)
493   @f0stat = []
494   @f0dbstat = AlwaysNil.instance
495   @f0hitlist = []
496   @hits = []
497   @num = 1
498   r = data.shift
499   @f0message = [ r ]
500   r.gsub!(/^Results from round (\d+).*\z/) { |x|
501     @num = $1.to_i
502     @f0message << x
503     ''
504   }
505   r = data.shift
506   while /^Number of occurrences of pattern in the database is +(\d+)/ =~ r
507     # PHI-BLAST
508     @pattern_in_database = $1.to_i
509     @f0message << r
510     r = data.shift
511   end
512   if /^Results from round (\d+)/ =~ r then
513     @num = $1.to_i
514     @f0message << r
515     r = data.shift
516   end
517   if r and !(/\*{5} No hits found \*{5}/ =~ r) then
518     @f0hitlist << r
519     begin
520       @f0hitlist << data.shift
521     end until r = data[0] and /^\>/ =~ r
522     if r and /^CONVERGED\!/ =~ r then
523       r.sub!(/(.*\n)*^CONVERGED\!.*\n/) { |x| @f0hitlist << x; '' }
524     end
525     if defined?(@pattern_in_database) and r = data.first then
526       #PHI-BLAST
527       while /^\>/ =~ r
528         @hits << Hit.new(data)
529         r = data.first
530         break unless r
531         while /^Significant alignments for pattern/ =~ r
532           data.shift
533           r = data.first
534         end
535       end
536     else
537       #not PHI-BLAST
538       while r = data[0] and /^\>/ =~ r
539         @hits << Hit.new(data)
540       end
541     end
542   end
543   if /^CONVERGED\!\s*$/ =~ @f0hitlist[-1].to_s then
544     @message = 'CONVERGED!'
545     @flag_converged = true
546   end
547 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
573 def converged?
574   @flag_converged
575 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
565 def each
566   hits.each do |x|
567     yield x
568   end
569 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
558 def hits
559   parse_hitlist
560   @hits
561 end
hits_for_pattern() click to toggle source

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

    # File lib/bio/appl/blast/format0.rb
625 def hits_for_pattern
626   parse_hitlist
627   @hits_for_pattern
628 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
611 def hits_found_again
612   parse_hitlist
613   @hits_found_again
614 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
619 def hits_newly_found
620   parse_hitlist
621   @hits_newly_found
622 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
579 def pattern
580   #PHI-BLAST
581   if defined? @pattern
582     @pattern
583   elsif defined? @pattern_in_database then
584     @pattern = nil
585     @pattern_positions = []
586     @f0message.each do |r|
587       sc = StringScanner.new(r)
588       if sc.skip_until(/^ *pattern +([^\s]+)/) then
589         @pattern = sc[1] unless @pattern
590         sc.skip_until(/(?:^ *| +)at position +(\d+) +of +query +sequence/)
591         @pattern_positions << sc[1].to_i
592       end
593     end
594     @pattern
595   else
596     nil
597   end
598 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
602 def pattern_positions
603   #PHI-BLAST
604   pattern
605   @pattern_positions
606 end