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.
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 |
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 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
(PSI-BLAST) Returns true if the iteration is converged. Otherwise, returns false.
# File lib/bio/appl/blast/format0.rb, line 566 566: def converged? 567: @flag_converged 568: end
Iterates over each hit of the iteration. Yields a Bio::Blast::Default::Report::Hit object.
# File lib/bio/appl/blast/format0.rb, line 558 558: def each 559: hits.each do |x| 560: yield x 561: end 562: end
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 551 551: def hits 552: parse_hitlist 553: @hits 554: end
(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 600 600: def hits_found_again 601: parse_hitlist 602: @hits_found_again 603: end
(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 608 608: def hits_newly_found 609: parse_hitlist 610: @hits_newly_found 611: end
(PHI-BLAST) Returns pattern string. Returns nil if it is not a PHI-BLAST result.
# 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