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 81
    81:   def initialize(data, parser = nil)
    82:     @iterations = []
    83:     @parameters = {}
    84:     case parser
    85:     when :xmlparser             # format 7
    86:       xmlparser_parse(data)
    87:       @reports = blastxml_split_reports
    88:     when :rexml         # format 7
    89:       rexml_parse(data)
    90:       @reports = blastxml_split_reports
    91:     when :tab           # format 8
    92:       tab_parse(data)
    93:     when false
    94:       # do not parse, creates an empty object
    95:     else
    96:       auto_parse(data)
    97:     end
    98:   end

rexml(data)

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

[Source]

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

tab(data)

Specify to use tab delimited output parser.

[Source]

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

xmlparser(data)

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

[Source]

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

### Public Instance methods

db_len()

Length of BLAST db

[Source]

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

db_num()

Number of sequences in BLAST db

[Source]

         # File lib/bio/appl/blast/report.rb, line 185
    185:   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 163
    163:   def each_hit
    164:     @iterations.last.each do |x|
    165:       yield x
    166:     end
    167:   end

each_iteration() {|x| ...}

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 155
    155:   def each_iteration
    156:     @iterations.each do |x|
    157:       yield x
    158:     end
    159:   end

eff_space()

Effective search space

[Source]

         # File lib/bio/appl/blast/report.rb, line 191
    191:   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 152
    152:   def entrez_query; @parameters['entrez-query'];     end

entropy()

Karlin-Altschul parameter H

[Source]

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

expect()

Expectation threshold (-e) : shortcuts for @parameters

[Source]

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

filter()

Filtering options (-F) : shortcuts for @parameters

[Source]

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

gap_extend()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 146
    146:   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 144
    144:   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 172
    172:   def hits
    173:     @iterations.last.hits
    174:   end

hsp_len()

Effective HSP length

[Source]

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

inclusion()

Inclusion threshold (-h) : shortcuts for @parameters

[Source]

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

kappa()

Karlin-Altschul parameter K

[Source]

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

lambda()

Karlin-Altschul parameter Lamba

[Source]

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

matrix()

Matrix used (-M) : shortcuts for @parameters

[Source]

         # File lib/bio/appl/blast/report.rb, line 134
    134:   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 202
    202:   def message
    203:     @iterations.last.message
    204:   end

pattern()

PHI-BLAST pattern : shortcuts for @parameters

[Source]

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

sc_match()

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

[Source]

         # File lib/bio/appl/blast/report.rb, line 140
    140:   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 142
    142:   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 180
    180:   def statistics
    181:     @iterations.last.statistics
    182:   end

[Validate]