Class | Bio::Blast::Report
In: | lib/bio/appl/blast/format8.rb lib/bio/appl/blast/report.rb lib/bio/appl/blast/rexml.rb lib/bio/appl/blast/xmlparser.rb
Parent: | Object

# 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

### Methods

db_len db_num each each_hit each_iteration eff_space entrez_query entropy expect filter gap_extend gap_open hits hsp_len inclusion kappa lambda matrix message new pattern rexml sc_match sc_mismatch statistics tab xmlparser

### Classes and Modules

Class Bio::Blast::Report::BlastXmlSplitter
Class Bio::Blast::Report::Hit
Class Bio::Blast::Report::Hsp
Class Bio::Blast::Report::Iteration

### Constants

DELIMITER | = | RS = "</BlastOutput>\n" |  | for Bio::FlatFile support (only for XML data)
FLATFILE_SPLITTER | = | BlastXmlSplitter |  | splitter for Bio::FlatFile support

### 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)

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 85
     85:   def initialize(data, parser = nil)
     86:     @iterations = []
     87:     @parameters = {}
     88:     case parser
     89:     when :xmlparser             # format 7
     90:       xmlparser_parse(data)
     91:       @reports = blastxml_split_reports
     92:     when :rexml         # format 7
     93:       rexml_parse(data)
     94:       @reports = blastxml_split_reports
     95:     when :tab           # format 8
     96:       tab_parse(data)
     97:     when false
     98:       # do not parse, creates an empty object
     99:     else
    100:       auto_parse(data)
    101:     end
    102:   end

rexml(data)

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

[Source]

        # File lib/bio/appl/blast/report.rb, line 59
    59:   def self.rexml(data)
    60:     self.new(data, :rexml)
    61:   end

tab(data)

Specify to use tab delimited output parser.

[Source]

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

xmlparser(data)

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

[Source]

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

### Public Instance methods

db_len()

Length of BLAST db

[Source]

         # File lib/bio/appl/blast/report.rb, line 191
    191:   def db_len;    statistics['db-len'];    end

db_num()

Number of sequences in BLAST db

[Source]

         # File lib/bio/appl/blast/report.rb, line 189
    189:   def db_num;    statistics['db-num'];    end

each()

Alias for each_hit

each_hit() {|x| ...}

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 167
    167:   def each_hit
    168:     @iterations.last.each do |x|
    169:       yield x
    170:     end
    171:   end

each_iteration() {|x| ...}

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 159
    159:   def each_iteration
    160:     @iterations.each do |x|
    161:       yield x
    162:     end
    163:   end

eff_space()

Effective search space

[Source]

         # File lib/bio/appl/blast/report.rb, line 195
    195:   def eff_space; statistics['eff-space']; end

entrez_query()

Limit of request to Entrez : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 156
    156:   def entrez_query; @parameters['entrez-query'];     end

entropy()

Karlin-Altschul parameter H

[Source]

         # File lib/bio/appl/blast/report.rb, line 201
    201:   def entropy;   statistics['entropy'];   end

expect()

Expectation threshold (-e) : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 140
    140:   def expect;       @parameters['expect'];           end

filter()

Filtering options (-F) : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 152
    152:   def filter;       @parameters['filter'];           end

gap_extend()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 150
    150:   def gap_extend;   @parameters['gap-extend'];       end

gap_open()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 148
    148:   def gap_open;     @parameters['gap-open'];         end

hits()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 176
    176:   def hits
    177:     @iterations.last.hits
    178:   end

hsp_len()

Effective HSP length

[Source]

         # File lib/bio/appl/blast/report.rb, line 193
    193:   def hsp_len;   statistics['hsp-len'];   end

inclusion()

Inclusion threshold (-h) : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 142
    142:   def inclusion;    @parameters['include'];          end

kappa()

Karlin-Altschul parameter K

[Source]

         # File lib/bio/appl/blast/report.rb, line 197
    197:   def kappa;     statistics['kappa'];     end

lambda()

Karlin-Altschul parameter Lamba

[Source]

         # File lib/bio/appl/blast/report.rb, line 199
    199:   def lambda;    statistics['lambda'];    end

matrix()

Matrix used (-M) : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 138
    138:   def matrix;       @parameters['matrix'];           end

message()

Returns a String (or nil) containing execution message of the last iteration (typically "CONVERGED"). Shortcut for the last iteration‘s message (for checking ‘CONVERGED’)

[Source]

         # File lib/bio/appl/blast/report.rb, line 206
    206:   def message
    207:     @iterations.last.message
    208:   end

pattern()

PHI-BLAST pattern : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 154
    154:   def pattern;      @parameters['pattern'];          end

sc_match()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 144
    144:   def sc_match;     @parameters['sc-match'];         end

sc_mismatch()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 146
    146:   def sc_mismatch;  @parameters['sc-mismatch'];      end

statistics()

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.

[Source]

         # File lib/bio/appl/blast/report.rb, line 184
    184:   def statistics
    185:     @iterations.last.statistics
    186:   end

[Validate]