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, line 85
def initialize(data, parser = nil)
  @iterations = []
  @parameters = {}
  case parser
  when :xmlparser             # format 7
    xmlparser_parse(data)
    @reports = blastxml_split_reports
  when :rexml         # format 7
    rexml_parse(data)
    @reports = blastxml_split_reports
  when :tab           # format 8
    tab_parse(data)
  when false
    # do not parse, creates an empty object
  else
    auto_parse(data)
  end
end
rexml(data) click to toggle source

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

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

Specify to use tab delimited output parser.

# File lib/bio/appl/blast/report.rb, line 64
def self.tab(data)
  self.new(data, :tab)
end
xmlparser(data) click to toggle source

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

# File lib/bio/appl/blast/report.rb, line 54
def self.xmlparser(data)
  self.new(data, :xmlparser)
end

Public Instance Methods

db_len() click to toggle source

Length of BLAST db

# File lib/bio/appl/blast/report.rb, line 191
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, line 189
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, line 167
def each_hit
  @iterations.last.each do |x|
    yield x
  end
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, line 159
def each_iteration
  @iterations.each do |x|
    yield x
  end
end
eff_space() click to toggle source

Effective search space

# File lib/bio/appl/blast/report.rb, line 195
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, line 156
def entrez_query; @parameters['entrez-query'];     end
entropy() click to toggle source

Karlin-Altschul parameter H

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

Expectation threshold (-e) : shortcuts for @parameters

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

Filtering options (-F) : shortcuts for @parameters

# File lib/bio/appl/blast/report.rb, line 152
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, line 150
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, line 148
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, line 176
def hits
  @iterations.last.hits
end
hsp_len() click to toggle source

Effective HSP length

# File lib/bio/appl/blast/report.rb, line 193
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, line 142
def inclusion;    @parameters['include'];          end
kappa() click to toggle source

Karlin-Altschul parameter K

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

Karlin-Altschul parameter Lamba

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

Matrix used (-M) : shortcuts for @parameters

# File lib/bio/appl/blast/report.rb, line 138
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, line 206
def message
  @iterations.last.message
end
pattern() click to toggle source

PHI-BLAST pattern : shortcuts for @parameters

# File lib/bio/appl/blast/report.rb, line 154
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, line 144
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, line 146
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, line 184
def statistics
  @iterations.last.statistics
end