class Bio::Sim4::Report

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

Constants

DELIMITER

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) click to toggle source

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.

   # File lib/bio/appl/sim4/report.rb
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| ... } click to toggle source

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

    # File lib/bio/appl/sim4/report.rb
486 def each_hit(&x) #:yields: hit
487   @hits.each(&x)
488 end
Also aliased as: each
num_hits() click to toggle source

Returns number of hits. Same as hits.size.

    # File lib/bio/appl/sim4/report.rb
481 def num_hits;     @hits.size;     end
query_def() click to toggle source

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

    # File lib/bio/appl/sim4/report.rb
494 def query_def; @seq1.definition; end
query_id() click to toggle source

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

    # File lib/bio/appl/sim4/report.rb
499 def query_id;  @seq1.entry_id;   end
query_len() click to toggle source

Returns the length of query sequence.

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