| 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 503
503: def initialize(data)
504: @f0stat = []
505: @f0dbstat = AlwaysNil.instance
506: @f0hitlist = []
507: @hits = []
508: @num = 1
509: r = data.shift
510: @f0message = [ r ]
511: r.gsub!(/^Results from round (\d+).*\z/) { |x|
512: @num = $1.to_i
513: @f0message << x
514: ''
515: }
516: r = data.shift
517: while /^Number of occurrences of pattern in the database is +(\d+)/ =~ r
518: # PHI-BLAST
519: @pattern_in_database = $1.to_i
520: @f0message << r
521: r = data.shift
522: end
523: if /^Results from round (\d+)/ =~ r then
524: @num = $1.to_i
525: @f0message << r
526: r = data.shift
527: end
528: if r and !(/\*{5} No hits found \*{5}/ =~ r) then
529: @f0hitlist << r
530: begin
531: @f0hitlist << data.shift
532: end until r = data[0] and /^\>/ =~ r
533: if r and /^CONVERGED\!/ =~ r then
534: r.sub!(/(.*\n)*^CONVERGED\!.*\n/) { |x| @f0hitlist << x; '' }
535: end
536: if defined?(@pattern_in_database) and r = data.first then
537: #PHI-BLAST
538: while /^\>/ =~ r
539: @hits << Hit.new(data)
540: r = data.first
541: break unless r
542: while /^Significant alignments for pattern/ =~ r
543: data.shift
544: r = data.first
545: end
546: end
547: else
548: #not PHI-BLAST
549: while r = data[0] and /^\>/ =~ r
550: @hits << Hit.new(data)
551: end
552: end
553: end
554: if /^CONVERGED\!\s*$/ =~ @f0hitlist[-1].to_s then
555: @message = 'CONVERGED!'
556: @flag_converged = true
557: end
558: end
(PSI-BLAST) Returns true if the iteration is converged. Otherwise, returns false.
# File lib/bio/appl/blast/format0.rb, line 584
584: def converged?
585: @flag_converged
586: end
Iterates over each hit of the iteration. Yields a Bio::Blast::Default::Report::Hit object.
# File lib/bio/appl/blast/format0.rb, line 576
576: def each
577: hits.each do |x|
578: yield x
579: end
580: 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 569
569: def hits
570: parse_hitlist
571: @hits
572: 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 618
618: def hits_found_again
619: parse_hitlist
620: @hits_found_again
621: 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 626
626: def hits_newly_found
627: parse_hitlist
628: @hits_newly_found
629: end
(PHI-BLAST) Returns pattern string. Returns nil if it is not a PHI-BLAST result.
# File lib/bio/appl/blast/format0.rb, line 590
590: def pattern
591: #PHI-BLAST
592: if !defined?(@pattern) and defined?(@pattern_in_database) then
593: @pattern = nil
594: @pattern_positions = []
595: @f0message.each do |r|
596: sc = StringScanner.new(r)
597: if sc.skip_until(/^ *pattern +([^\s]+)/) then
598: @pattern = sc[1] unless @pattern
599: sc.skip_until(/(?:^ *| +)at position +(\d+) +of +query +sequence/)
600: @pattern_positions << sc[1].to_i
601: end
602: end
603: end
604: @pattern
605: end