Class Bio::Fasta::Report
In: lib/bio/appl/fasta/format10.rb
Parent: Object

Summarized results of the fasta execution results.

Methods

each   lap_over   new   threshold  

Classes and Modules

Class Bio::Fasta::Report::FastaFormat10Splitter
Class Bio::Fasta::Report::Hit
Class Bio::Fasta::Report::Program

Constants

FLATFILE_SPLITTER = FastaFormat10Splitter   Splitter for Bio::FlatFile

Attributes

entry_overrun  [R]  piece of next entry. Bio::FlatFile uses it.
hits  [R]  Returns an Array of Bio::Fasta::Report::Hit objects.
list  [R]  Returns the ‘The best scores are’ lines as a String.
log  [R]  Returns the trailing lines including library size, execution date, fasta function used, and fasta versions as a String.
program  [R]  Returns a Bio::Fasta::Report::Program object.
query_def  [R]  Query definition. For older reports, the value may be nil.
query_len  [R]  Query sequence length. For older reports, the value may be nil.

Public Class methods

[Source]

     # File lib/bio/appl/fasta/format10.rb, line 69
 69:   def initialize(data)
 70:     # Split outputs containing multiple query sequences' results
 71:     chunks = data.split(/^(\s*\d+\>\>\>.*)/, 3)
 72:     if chunks.size >= 3 then
 73:       if chunks[0].strip.empty? then
 74:         qdef_line = chunks[1]
 75:         data = chunks[1..2].join('')
 76:         overruns = chunks[3..-1]
 77:       elsif /^\>\>\>/ =~ chunks[0] then
 78:         qdef_line = nil
 79:         data = chunks.shift
 80:         overruns = chunks
 81:       else
 82:         qdef_line = chunks[1]
 83:         data = chunks[0..2].join('')
 84:         overruns = chunks[3..-1]
 85:       end
 86:       @entry_overrun = overruns.join('')
 87:       if qdef_line and
 88:           /^ *\d+\>\>\>([^ ]+) .+ \- +(\d+) +(nt|aa)\s*$/ =~ qdef_line then
 89:         @query_def = $1
 90:         @query_len = $2.to_i
 91:       end
 92:     end
 93: 
 94:     # header lines - brief list of the hits
 95:     if list_start = data.index("\nThe best scores are") then
 96:       data = data[(list_start + 1)..-1]
 97:       data.sub!(/(.*)\n\n>>>/m, '')
 98:       @list = $1
 99:     else
100:       if list_start = data.index(/\n!!\s+/) then
101:         data = data[list_start..-1]
102:         data.sub!(/\n!!\s+/, '')
103:         data.sub!(/.*/) { |x| @list = x; '' }
104:       else
105:         data = data.sub(/.*/) { |x| @list = x; '' }
106:       end
107:     end
108: 
109:     # body lines - fasta execution result
110:     program, *hits = data.split(/\n>>/)
111: 
112:     # trailing lines - log messages of the execution
113:     @log = hits.pop
114:     @log.sub!(/.*<\n/m, '')
115:     @log.strip!
116: 
117:     # parse results
118:     @program = Program.new(program)
119:     @hits = []
120: 
121:     hits.each do |x|
122:       @hits.push(Hit.new(x))
123:     end
124:   end

Public Instance methods

Iterates on each Bio::Fasta::Report::Hit object.

[Source]

     # File lib/bio/appl/fasta/format10.rb, line 149
149:   def each
150:     @hits.each do |x|
151:       yield x
152:     end
153:   end

Returns an Array of Bio::Fasta::Report::Hit objects having longer overlap length than ‘length_min’.

[Source]

     # File lib/bio/appl/fasta/format10.rb, line 167
167:   def lap_over(length_min = 0)
168:     list = []
169:     @hits.each do |x|
170:       list.push(x) if x.overlap > length_min
171:     end
172:     return list
173:   end

Returns an Array of Bio::Fasta::Report::Hit objects having better evalue than ‘evalue_max’.

[Source]

     # File lib/bio/appl/fasta/format10.rb, line 157
157:   def threshold(evalue_max = 0.1)
158:     list = []
159:     @hits.each do |x|
160:       list.push(x) if x.evalue < evalue_max
161:     end
162:     return list
163:   end

[Validate]