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.
DELIMITER | = | RS = nil | Delimiter of each entry. Bio::FlatFile uses it. In Bio::Sim4::Report, it it nil (1 entry 1 file). |
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. |
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, 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
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 486: def each_hit(&x) #:yields: hit 487: @hits.each(&x) 488: end
Returns number of hits. Same as hits.size.
# File lib/bio/appl/sim4/report.rb, line 481 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 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 499: def query_id; @seq1.entry_id; end