Class: Bio::Blast::Default::Report::Iteration
- Defined in:
- lib/bio/appl/blast/format0.rb
Overview
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.
Direct Known Subclasses
Bl2seq::Report::Iteration, RPSBlast::Report::Iteration, WU::Report::Iteration
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
name (title or filename) of the database.
-
#db_len ⇒ Object
readonly
number of sequences in database.
-
#db_num ⇒ Object
readonly
number of letters in database.
-
#eff_space ⇒ Object
readonly
effective length of the database.
-
#entropy ⇒ Object
readonly
entropy of the database.
-
#expect ⇒ Object
readonly
e-value threshold specified when BLAST was executed.
-
#gapped_entropy ⇒ Object
readonly
gapped entropy of the database.
-
#gapped_kappa ⇒ Object
readonly
gapped kappa of the database.
-
#gapped_lambda ⇒ Object
readonly
gapped lambda of the database.
-
#kappa ⇒ Object
readonly
kappa of the database.
-
#lambda ⇒ Object
readonly
lambda of the database.
-
#message ⇒ Object
readonly
(PSI-BLAST) Messages of the iteration.
-
#num ⇒ Object
readonly
(PSI-BLAST) Iteration round number.
-
#pattern_in_database ⇒ Object
readonly
(PHI-BLAST) Number of occurrences of pattern in the database.
-
#posted_date ⇒ Object
readonly
posted date of the database.
Instance Method Summary collapse
-
#converged? ⇒ Boolean
(PSI-BLAST) Returns true if the iteration is converged.
-
#each ⇒ Object
Iterates over each hit of the iteration.
-
#hits ⇒ Object
Returns the hits of the iteration.
-
#hits_for_pattern ⇒ Object
(PHI-BLAST) Returns hits for pattern.
-
#hits_found_again ⇒ Object
(PSI-BLAST) Returns hits which have been found again in the iteration.
-
#hits_newly_found ⇒ Object
(PSI-BLAST) Returns hits which have been newly found in the iteration.
-
#initialize(data) ⇒ Iteration
constructor
Creates a new Iteration object.
-
#pattern ⇒ Object
(PHI-BLAST) Returns pattern string.
-
#pattern_positions ⇒ Object
(PHI-BLAST) Returns pattern positions.
Constructor Details
#initialize(data) ⇒ Iteration
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.
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# 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 |
Instance Attribute Details
#database ⇒ Object (readonly)
name (title or filename) of the database
774 775 776 |
# File 'lib/bio/appl/blast/format0.rb', line 774 def database @database end |
#db_len ⇒ Object (readonly)
number of sequences in database
784 785 786 |
# File 'lib/bio/appl/blast/format0.rb', line 784 def db_len @db_len end |
#db_num ⇒ Object (readonly)
number of letters in database
781 782 783 |
# File 'lib/bio/appl/blast/format0.rb', line 781 def db_num @db_num end |
#eff_space ⇒ Object (readonly)
effective length of the database
787 788 789 |
# File 'lib/bio/appl/blast/format0.rb', line 787 def eff_space @eff_space end |
#entropy ⇒ Object (readonly)
entropy of the database
752 753 754 |
# File 'lib/bio/appl/blast/format0.rb', line 752 def entropy @entropy end |
#expect ⇒ Object (readonly)
e-value threshold specified when BLAST was executed
791 792 793 |
# File 'lib/bio/appl/blast/format0.rb', line 791 def expect @expect end |
#gapped_entropy ⇒ Object (readonly)
gapped entropy of the database
762 763 764 |
# File 'lib/bio/appl/blast/format0.rb', line 762 def gapped_entropy @gapped_entropy end |
#gapped_kappa ⇒ Object (readonly)
gapped kappa of the database
759 760 761 |
# File 'lib/bio/appl/blast/format0.rb', line 759 def gapped_kappa @gapped_kappa end |
#gapped_lambda ⇒ Object (readonly)
gapped lambda of the database
756 757 758 |
# File 'lib/bio/appl/blast/format0.rb', line 756 def gapped_lambda @gapped_lambda end |
#kappa ⇒ Object (readonly)
kappa of the database
749 750 751 |
# File 'lib/bio/appl/blast/format0.rb', line 749 def kappa @kappa end |
#lambda ⇒ Object (readonly)
lambda of the database
746 747 748 |
# File 'lib/bio/appl/blast/format0.rb', line 746 def lambda @lambda end |
#message ⇒ Object (readonly)
(PSI-BLAST) Messages of the iteration.
552 553 554 |
# File 'lib/bio/appl/blast/format0.rb', line 552 def @message end |
#num ⇒ Object (readonly)
(PSI-BLAST) Iteration round number.
550 551 552 |
# File 'lib/bio/appl/blast/format0.rb', line 550 def num @num end |
#pattern_in_database ⇒ Object (readonly)
(PHI-BLAST) Number of occurrences of pattern in the database.
554 555 556 |
# File 'lib/bio/appl/blast/format0.rb', line 554 def pattern_in_database @pattern_in_database end |
#posted_date ⇒ Object (readonly)
posted date of the database
777 778 779 |
# File 'lib/bio/appl/blast/format0.rb', line 777 def posted_date @posted_date end |
Instance Method Details
#converged? ⇒ Boolean
(PSI-BLAST) Returns true if the iteration is converged. Otherwise, returns false.
573 574 575 |
# File 'lib/bio/appl/blast/format0.rb', line 573 def converged? @flag_converged end |
#each ⇒ Object
Iterates over each hit of the iteration. Yields a Bio::Blast::Default::Report::Hit object.
565 566 567 568 569 |
# File 'lib/bio/appl/blast/format0.rb', line 565 def each hits.each do |x| yield x end end |
#hits ⇒ Object
Returns the hits of the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.
558 559 560 561 |
# File 'lib/bio/appl/blast/format0.rb', line 558 def hits parse_hitlist @hits end |
#hits_for_pattern ⇒ Object
(PHI-BLAST) Returns hits for pattern. ????
625 626 627 628 |
# File 'lib/bio/appl/blast/format0.rb', line 625 def hits_for_pattern parse_hitlist @hits_for_pattern end |
#hits_found_again ⇒ Object
(PSI-BLAST) Returns hits which have been found again in the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.
611 612 613 614 |
# File 'lib/bio/appl/blast/format0.rb', line 611 def hits_found_again parse_hitlist @hits_found_again end |
#hits_newly_found ⇒ Object
(PSI-BLAST) Returns hits which have been newly found in the iteration. It returns an array of Bio::Blast::Default::Report::Hit objects.
619 620 621 622 |
# File 'lib/bio/appl/blast/format0.rb', line 619 def hits_newly_found parse_hitlist @hits_newly_found end |
#pattern ⇒ Object
(PHI-BLAST) Returns pattern string. Returns nil if it is not a PHI-BLAST result.
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
# 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 ⇒ Object
(PHI-BLAST) Returns pattern positions. Returns nil if it is not a PHI-BLAST result.
602 603 604 605 606 |
# File 'lib/bio/appl/blast/format0.rb', line 602 def pattern_positions #PHI-BLAST pattern @pattern_positions end |