Class Bio::Blast::Default::Report
In: lib/bio/appl/blast/format0.rb
Parent: Object

Bio::Blast::Default::Report parses NCBI BLAST default output and stores information in the data. It may store some Bio::Blast::Default::Report::Iteration objects.

Methods

Classes and Modules

Class Bio::Blast::Default::Report::HSP
Class Bio::Blast::Default::Report::Hit
Class Bio::Blast::Default::Report::Iteration

Constants

DELIMITER = RS = "\nBLAST"   Delimiter of each entry. Bio::FlatFile uses it.
DELIMITER_OVERRUN = 5   (Integer) excess read size included in DELIMITER.

Attributes

db_len  [R]  number of letters in database
db_num  [R]  number of sequences in database
eff_space  [R]  effective length of the database
entry_overrun  [R]  piece of next entry. Bio::FlatFile uses it.
expect  [R]  e-value threshold specified when BLAST was executed
gap_extend  [R]  gap extend penalty
gap_open  [R]  gap open penalty
iterations  [R]  (PSI-BLAST) Returns iterations. It returns an array of Bio::Blast::Default::Report::Iteration class. Note that normal blastall result usually contains one iteration.
matrix  [R]  name of the matrix
num_hits  [R]  number of hits. Note that this may differ from hits.size.
posted_date  [R]  posted date of the database
sc_match  [R]  match score of the matrix
sc_mismatch  [R]  mismatch score of the matrix

Public Class methods

Creates a new Report object from BLAST result text.

[Source]

    # File lib/bio/appl/blast/format0.rb, line 53
53:         def initialize(str)
54:           str = str.sub(/\A\s+/, '')
55:           str.sub!(/\n(T?BLAST.*)/m, "\n") # remove trailing entries for sure
56:           @entry_overrun = $1
57:           @entry = str
58:           data = str.split(/(?:^[ \t]*\n)+/)
59: 
60:           format0_split_headers(data)
61:           @iterations = format0_split_search(data)
62:           format0_split_stat_params(data)
63:         end

Opens file by using Bio::FlatFile.open.

[Source]

    # File lib/bio/appl/blast/format0.rb, line 48
48:         def self.open(filename, *mode)
49:           Bio::FlatFile.open(self, filename, *mode)
50:         end

Public Instance methods

(PSI-BLAST) Same as iterations.last.converged?. Returns true if the last iteration is converged, otherwise, returns false.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 221
221:         def converged?
222:           @iterations.last.converged?
223:         end

Returns the name (filename or title) of the database.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 245
245:         def db
246:           unless defined?(@db)
247:             if /Database *\: *(.*)/m =~ @f0database then
248:               a = $1.split(/^/)
249:               a.pop if a.size > 1
250:               @db = a.collect { |x| x.sub(/\s+\z/, '') }.join(' ')
251:             end
252:           end #unless
253:           @db
254:         end
each()

Alias for each_hit

Iterates over each hit of the last iteration. Same as iterations.last.each_hit. Yields a Bio::Blast::Default::Report::Hit object. This is very useful in most cases, e.g. for blastall results.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 196
196:         def each_hit
197:           @iterations.last.each do |x|
198:             yield x
199:           end
200:         end

(PSI-BLAST) Iterates over each iteration. Same as iterations.each. Yields a Bio::Blast::Default::Report::Iteration object.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 186
186:         def each_iteration
187:           @iterations.each do |x|
188:             yield x
189:           end
190:         end

Same as iterations.last.entropy.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 146
146:         def entropy;        @iterations.last.entropy;        end

Same as iterations.last.gapped_entropy.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 153
153:         def gapped_entropy; @iterations.last.gapped_entropy; end

Same as iterations.last.gapped_kappa.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 149
149:         def gapped_kappa;   @iterations.last.gapped_kappa;   end

Same as iterations.last.gapped_lambda.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 151
151:         def gapped_lambda;  @iterations.last.gapped_lambda;  end

Same as iterations.last.hits. Returns the last iteration‘s hits. Returns an array of Bio::Blast::Default::Report::Hit object. This is very useful in most cases, e.g. for blastall results.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 207
207:         def hits
208:           @iterations.last.hits
209:         end

Same as iterations.last.kappa.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 142
142:         def kappa;          @iterations.last.kappa;          end

Same as iterations.last.lambda.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 144
144:         def lambda;         @iterations.last.lambda;         end

(PSI-BLAST) Same as iterations.last.message.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 213
213:         def message
214:           @iterations.last.message
215:         end

(PHI-BLAST) Same as iterations.first.pattern. Note that it returns the FIRST iteration‘s value.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 173
173:         def pattern; @iterations.first.pattern; end

(PHI-BLAST) Same as iterations.first.pattern_positions. Note that it returns the FIRST iteration‘s value.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 178
178:         def pattern_positions
179:           @iterations.first.pattern_positions
180:         end

Returns program name.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 156
156:         def program;        format0_parse_header; @program;        end

Returns definition of the query.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 168
168:         def query_def; format0_parse_query; @query_def; end

Returns length of the query.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 165
165:         def query_len; format0_parse_query; @query_len; end

Returns the bibliography reference of the BLAST software. Note that this method shows only the first reference. When you want to get additional references, you can use references method.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 229
229:         def reference
230:           references[0]
231:         end

Returns the bibliography references of the BLAST software. Returns an array of strings.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 235
235:         def references
236:           unless defined?(@references)
237:             @references = @f0references.collect do |x|
238:               x.to_s.gsub(/\s+/, ' ').strip
239:             end
240:           end #unless
241:           @references
242:         end

Returns whole entry as a string.

[Source]

    # File lib/bio/appl/blast/format0.rb, line 74
74:         def to_s; @entry; end

Returns version of the program.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 158
158:         def version;        format0_parse_header; @version;        end

Returns released date of the program.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 162
162:         def version_date;   format0_parse_header; @version_date;   end

Returns version number string of the program.

[Source]

     # File lib/bio/appl/blast/format0.rb, line 160
160:         def version_number; format0_parse_header; @version_number; end

[Validate]