Class | Bio::Blast::Default::Report::Iteration
In: | lib/bio/appl/blast/format0.rb
Parent: | Object

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.

### Methods

converged? each hits hits_for_pattern hits_found_again hits_newly_found new pattern pattern_positions

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

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.

[Source]

         # File lib/bio/appl/blast/format0.rb, line 485
    485:           def initialize(data)
    486:             @f0stat = []
    487:             @f0dbstat = AlwaysNil.instance
    488:             @f0hitlist = []
    489:             @hits = []
    490:             @num = 1
    491:             r = data.shift
    492:             @f0message = [ r ]
    493:             r.gsub!(/^Results from round (\d+).*\z/) { |x|
    494:               @num = $1.to_i
    495:               @f0message << x
    496:               ''
    497:             }
    498:             r = data.shift
    499:             while /^Number of occurrences of pattern in the database is +(\d+)/ =~ r
    500:               # PHI-BLAST
    501:               @pattern_in_database = $1.to_i
    502:               @f0message << r
    503:               r = data.shift
    504:             end
    505:             if /^Results from round (\d+)/ =~ r then
    506:               @num = $1.to_i
    507:               @f0message << r
    508:               r = data.shift
    509:             end
    510:             if r and !(/\*{5} No hits found \*{5}/ =~ r) then
    511:               @f0hitlist << r
    512:               begin
    513:                 @f0hitlist << data.shift
    514:               end until r = data[0] and /^\>/ =~ r
    515:               if r and /^CONVERGED\!/ =~ r then
    516:                 r.sub!(/(.*\n)*^CONVERGED\!.*\n/) { |x| @f0hitlist << x; '' }
    517:               end
    518:               if defined?(@pattern_in_database) and r = data.first then
    519:                 #PHI-BLAST
    520:                 while /^\>/ =~ r
    521:                   @hits << Hit.new(data)
    522:                   r = data.first
    523:                   break unless r
    524:                   while /^Significant alignments for pattern/ =~ r
    525:                     data.shift
    526:                     r = data.first
    527:                   end
    528:                 end
    529:               else
    530:                 #not PHI-BLAST
    531:                 while r = data[0] and /^\>/ =~ r
    532:                   @hits << Hit.new(data)
    533:                 end
    534:               end
    535:             end
    536:             if /^CONVERGED\!\s*$/ =~ @f0hitlist[-1].to_s then
    537:               @message = 'CONVERGED!'
    538:               @flag_converged = true
    539:             end
    540:           end

### Public Instance methods

converged?()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 566
    566:           def converged?
    567:             @flag_converged
    568:           end

each() {|x| ...}

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 558
    558:           def each
    559:             hits.each do |x|
    560:               yield x
    561:             end
    562:           end

hits()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 551
    551:           def hits
    552:             parse_hitlist
    553:             @hits
    554:           end

hits_for_pattern()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 614
    614:           def hits_for_pattern
    615:             parse_hitlist
    616:             @hits_for_pattern
    617:           end

hits_found_again()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 600
    600:           def hits_found_again
    601:             parse_hitlist
    602:             @hits_found_again
    603:           end

hits_newly_found()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 608
    608:           def hits_newly_found
    609:             parse_hitlist
    610:             @hits_newly_found
    611:           end

pattern()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 572
    572:           def pattern
    573:             #PHI-BLAST
    574:             if !defined?(@pattern) and defined?(@pattern_in_database) then
    575:               @pattern = nil
    576:               @pattern_positions = []
    577:               @f0message.each do |r|
    578:                 sc = StringScanner.new(r)
    579:                 if sc.skip_until(/^ *pattern +([^\s]+)/) then
    580:                   @pattern = sc[1] unless @pattern
    581:                   sc.skip_until(/(?:^ *| +)at position +(\d+) +of +query +sequence/)
    582:                   @pattern_positions << sc[1].to_i
    583:                 end
    584:               end
    585:             end
    586:             @pattern
    587:           end

pattern_positions()

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

[Source]

         # File lib/bio/appl/blast/format0.rb, line 591
    591:           def pattern_positions
    592:             #PHI-BLAST
    593:             pattern
    594:             @pattern_positions
    595:           end

[Validate]