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
Returns all hits of the entry. Unlike #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.
Returns hits of the entry. Unlike #all_hits, it returns hits which have alignments. Returns an Array of Bio::Sim4::Report::Hit objects.
Returns sequence informations of 'seq1'. Returns a Bio::Sim4::Report::SeqDesc object. This would be a Bio::Sim4 specific method.
Public Class Methods
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 #query_id, query_def, query_len, and seq1 methods.
# File lib/bio/appl/sim4/report.rb, line 42 def initialize(text) @hits = [] @all_hits = [] overrun = '' text.each_line("\n\nseq1 = ") do |str| str = str.sub(/\A\s+/, '') str.sub!(/\n(^seq1 \= .*)/m, "\n") # remove trailing hits for sure tmp = $1.to_s hit = Hit.new(overrun + str) overrun = tmp unless hit.instance_eval { @data.empty? } then @hits << hit end @all_hits << hit end @seq1 = @all_hits[0].seq1 end
Public Instance Methods
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, line 486 def each_hit(&x) #:yields: hit @hits.each(&x) end
Returns number of hits. Same as hits.size.
# File lib/bio/appl/sim4/report.rb, line 481 def num_hits; @hits.size; end
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, line 494 def query_def; @seq1.definition; end
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, line 499 def query_id; @seq1.entry_id; end
Returns the length of query sequence.
# File lib/bio/appl/sim4/report.rb, line 502 def query_len; @seq1.len; end