Class | Bio::Sim4::Report
In: | lib/bio/appl/sim4/report.rb
Parent: | Object

Bio::Sim4::Report is the sim4 report parser class. Its object may contain some Bio::Sim4::Report::Hit objects.

### Methods

each each_hit new num_hits query_def query_id query_len

### Classes and Modules

Class Bio::Sim4::Report::Hit
Class Bio::Sim4::Report::Segment
Class Bio::Sim4::Report::SegmentPair
Class Bio::Sim4::Report::SeqDesc

### Constants

DELIMITER | = | RS = nil |  | Delimiter of each entry. Bio::FlatFile uses it. In Bio::Sim4::Report, it it nil (1 entry 1 file).

### Attributes

all_hits | [R] | Returns all hits of the entry. Unlike Bio::Sim4::Report#hits, it returns results of all trials of pairwise alignment. This would be a Bio::Sim4 specific method. Returns an Array of Bio::Sim4::Report::Hit objects.
hits | [R] | Returns hits of the entry. Unlike Bio::Sim4::Report#all_hits, it returns hits which have alignments. Returns an Array of Bio::Sim4::Report::Hit objects.
seq1 | [R] | Returns sequence informations of ‘seq1’. Returns a Bio::Sim4::Report::SeqDesc object. This would be a Bio::Sim4 specific method.

### Public Class methods

new(text)

Creates new Bio::Sim4::Report object from String. You can use Bio::FlatFile to read a file. Currently, format A=0, A=3, and A=4 are supported. (A=1, A=2, A=5 are NOT supported yet.)

Note that ‘seq1’ in sim4 result is always regarded as ‘query’, and ‘seq2’ is always regarded as ‘subject’(target, hit).

Note that first ‘seq1’ informations are used for Bio::Sim4::Report#query_id, query_def, query_len, and seq1 methods.

[Source]

        # File lib/bio/appl/sim4/report.rb, line 42
    42:       def initialize(text)
    43:         @hits = []
    44:         @all_hits = []
    45:         overrun = ''
    46:         text.each_line("\n\nseq1 = ") do |str|
    47:           str = str.sub(/\A\s+/, '')
    48:           str.sub!(/\n(^seq1 \= .*)/m, "\n") # remove trailing hits for sure
    49:           tmp = $1.to_s
    50:           hit = Hit.new(overrun + str)
    51:           overrun = tmp
    52:           unless hit.instance_eval { @data.empty? } then
    53:             @hits << hit
    54:           end
    55:           @all_hits << hit
    56:         end
    57:         @seq1 = @all_hits[0].seq1
    58:       end

### Public Instance methods

each()

Alias for each_hit

each_hit() {|hit| ...}

Iterates over each hits of the sim4 result. Same as hits.each. Yields a Bio::Sim4::Report::Hit object.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 486
    486:       def each_hit(&x) #:yields: hit
    487:         @hits.each(&x)
    488:       end

num_hits()

Returns number of hits. Same as hits.size.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 481
    481:       def num_hits;     @hits.size;     end

query_def()

Returns the definition of query sequence. The value will be filename or (first word of) sequence definition according to sim4 run-time options.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 494
    494:       def query_def; @seq1.definition; end

query_id()

Returns the identifier of query sequence. The value will be filename or (first word of) sequence definition according to sim4 run-time options.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 499
    499:       def query_id;  @seq1.entry_id;   end

query_len()

Returns the length of query sequence.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 502
    502:       def query_len; @seq1.len;        end

[Validate]