class Bio::Blast::Report

Bio::Blast::Report

Parsed results of the blast execution for Tab-delimited and XML output format. Tab-delimited reports are consists of

Query id,
Subject id,
percent of identity,
alignment length,
number of mismatches (not including gaps),
number of gap openings,
start of alignment in query,
end of alignment in query,
start of alignment in subject,
end of alignment in subject,
expected value,
bit score.

according to the MEGABLAST document (README.mbl). As for XML output, see the following DTDs.

* http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd
* http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.mod
* http://www.ncbi.nlm.nih.gov/dtd/NCBI_Entity.mod

Constants

DELIMITER

for Bio::FlatFile support (only for XML data)

FLATFILE_SPLITTER

Flatfile splitter for NCBI BLAST XML format. It is internally used when reading BLAST XML. Normally, users do not need to use it directly.

Attributes

db[R]

database name or title (String)

iterations[R]

Returns an Array of Bio::Blast::Report::Iteration objects.

parameters[R]

Returns a Hash containing execution parameters. Valid keys are: 'matrix', 'expect', 'include', 'sc-match', 'sc-mismatch', 'gap-open', 'gap-extend', 'filter'

program[R]

program name (e.g. “blastp”) (String)

query_def[R]

query definition line (String)

query_id[R]

query ID (String)

query_len[R]

query length (Integer)

reference[R]

reference (String)

reports[R]

When the report contains results for multiple query sequences, returns an array of Bio::Blast::Report objects corresponding to the multiple queries. Otherwise, returns nil.

Note for “No hits found”: When no hits found for a query sequence, the result for the query is completely void and no information available in the result XML, including query ID and query definition. The only trace is that iteration number is skipped. This means that if the no-hit query is the last query, the query can not be detected, because the result XML is completely the same as the result XML without the query.

version[R]

BLAST version (e.g. “blastp 2.2.18 [Mar-02-2008]”) (String)

Public Class Methods

new(data, parser = nil) click to toggle source

Passing a BLAST output from 'blastall -m 7' or '-m 8' as a String. Formats are auto detected.

    # File lib/bio/appl/blast/report.rb
 87 def initialize(data, parser = nil)
 88   @iterations = []
 89   @parameters = {}
 90   case parser
 91   when :xmlparser             # format 7
 92     if defined? xmlparser_parse
 93       xmlparser_parse(data)
 94     else
 95       raise NameError, "xmlparser_parse does not defined"
 96     end
 97     @reports = blastxml_split_reports
 98   when :rexml         # format 7
 99     rexml_parse(data)
100     @reports = blastxml_split_reports
101   when :tab           # format 8
102     tab_parse(data)
103   when false
104     # do not parse, creates an empty object
105   else
106     auto_parse(data)
107   end
108 end
rexml(data) click to toggle source

Specify to use REXML to parse XML (-m 7) output.

   # File lib/bio/appl/blast/report.rb
61 def self.rexml(data)
62   self.new(data, :rexml)
63 end
tab(data) click to toggle source

Specify to use tab delimited output parser.

   # File lib/bio/appl/blast/report.rb
66 def self.tab(data)
67   self.new(data, :tab)
68 end

Public Instance Methods

db_len() click to toggle source

Length of BLAST db

    # File lib/bio/appl/blast/report.rb
197 def db_len;    statistics['db-len'];    end
db_num() click to toggle source

Number of sequences in BLAST db

    # File lib/bio/appl/blast/report.rb
195 def db_num;    statistics['db-num'];    end
each()
Alias for: each_hit
each_hit() { |x| ... } click to toggle source

Iterates on each Bio::Blast::Report::Hit object of the the last Iteration. Shortcut for the last iteration's hits (for blastall)

    # File lib/bio/appl/blast/report.rb
173 def each_hit
174   @iterations.last.each do |x|
175     yield x
176   end
177 end
Also aliased as: each
each_iteration() { |x| ... } click to toggle source

Iterates on each Bio::Blast::Report::Iteration object. (for blastpgp)

    # File lib/bio/appl/blast/report.rb
165 def each_iteration
166   @iterations.each do |x|
167     yield x
168   end
169 end
eff_space() click to toggle source

Effective search space

    # File lib/bio/appl/blast/report.rb
201 def eff_space; statistics['eff-space']; end
entrez_query() click to toggle source

Limit of request to Entrez : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
162 def entrez_query; @parameters['entrez-query'];     end
entropy() click to toggle source

Karlin-Altschul parameter H

    # File lib/bio/appl/blast/report.rb
207 def entropy;   statistics['entropy'];   end
expect() click to toggle source

Expectation threshold (-e) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
146 def expect;       @parameters['expect'];           end
filter() click to toggle source

Filtering options (-F) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
158 def filter;       @parameters['filter'];           end
gap_extend() click to toggle source

Gap extension cost (-E) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
156 def gap_extend;   @parameters['gap-extend'];       end
gap_open() click to toggle source

Gap opening cost (-G) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
154 def gap_open;     @parameters['gap-open'];         end
hits() click to toggle source

Returns a Array of Bio::Blast::Report::Hits of the last iteration. Shortcut for the last iteration's hits

    # File lib/bio/appl/blast/report.rb
182 def hits
183   @iterations.last.hits
184 end
hsp_len() click to toggle source

Effective HSP length

    # File lib/bio/appl/blast/report.rb
199 def hsp_len;   statistics['hsp-len'];   end
inclusion() click to toggle source

Inclusion threshold (-h) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
148 def inclusion;    @parameters['include'];          end
kappa() click to toggle source

Karlin-Altschul parameter K

    # File lib/bio/appl/blast/report.rb
203 def kappa;     statistics['kappa'];     end
lambda() click to toggle source

Karlin-Altschul parameter Lamba

    # File lib/bio/appl/blast/report.rb
205 def lambda;    statistics['lambda'];    end
matrix() click to toggle source

Matrix used (-M) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
144 def matrix;       @parameters['matrix'];           end
message() click to toggle source

Returns a String (or nil) containing execution message of the last iteration (typically “CONVERGED”). Shortcut for the last iteration's message (for checking 'CONVERGED')

    # File lib/bio/appl/blast/report.rb
212 def message
213   @iterations.last.message
214 end
pattern() click to toggle source

PHI-BLAST pattern : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
160 def pattern;      @parameters['pattern'];          end
sc_match() click to toggle source

Match score for NT (-r) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
150 def sc_match;     @parameters['sc-match'];         end
sc_mismatch() click to toggle source

Mismatch score for NT (-q) : shortcuts for @parameters

    # File lib/bio/appl/blast/report.rb
152 def sc_mismatch;  @parameters['sc-mismatch'];      end
statistics() click to toggle source

Returns a Hash containing execution statistics of the last iteration. Valid keys are: 'db-num', 'db-len', 'hsp-len', 'eff-space', 'kappa', 'lambda', 'entropy' Shortcut for the last iteration's statistics.

    # File lib/bio/appl/blast/report.rb
190 def statistics
191   @iterations.last.statistics
192 end