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
database name or title (String)
Returns an Array of Bio::Blast::Report::Iteration
objects.
Returns a Hash containing execution parameters. Valid keys are: ‘matrix’, ‘expect’, ‘include’, ‘sc-match’, ‘sc-mismatch’, ‘gap-open’, ‘gap-extend’, ‘filter’
program name (e.g. “blastp”) (String)
query definition line (String)
query ID (String)
query length (Integer)
reference (String)
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.
BLAST version (e.g. “blastp 2.2.18 [Mar-02-2008]”) (String)
Public Class Methods
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
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
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
Length of BLAST db
# File lib/bio/appl/blast/report.rb 197 def db_len; statistics['db-len']; end
Number of sequences in BLAST db
# File lib/bio/appl/blast/report.rb 195 def db_num; statistics['db-num']; end
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
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
Effective search space
# File lib/bio/appl/blast/report.rb 201 def eff_space; statistics['eff-space']; end
Limit of request to Entrez : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 162 def entrez_query; @parameters['entrez-query']; end
Karlin-Altschul parameter H
# File lib/bio/appl/blast/report.rb 207 def entropy; statistics['entropy']; end
Expectation threshold (-e) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 146 def expect; @parameters['expect']; end
Filtering options (-F) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 158 def filter; @parameters['filter']; end
Gap extension cost (-E) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 156 def gap_extend; @parameters['gap-extend']; end
Gap opening cost (-G) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 154 def gap_open; @parameters['gap-open']; end
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
Effective HSP length
# File lib/bio/appl/blast/report.rb 199 def hsp_len; statistics['hsp-len']; end
Inclusion threshold (-h) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 148 def inclusion; @parameters['include']; end
Karlin-Altschul parameter K
# File lib/bio/appl/blast/report.rb 203 def kappa; statistics['kappa']; end
Karlin-Altschul parameter Lamba
# File lib/bio/appl/blast/report.rb 205 def lambda; statistics['lambda']; end
Matrix used (-M) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 144 def matrix; @parameters['matrix']; end
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
PHI-BLAST pattern : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 160 def pattern; @parameters['pattern']; end
Match score for NT (-r) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 150 def sc_match; @parameters['sc-match']; end
Mismatch score for NT (-q) : shortcuts for @parameters
# File lib/bio/appl/blast/report.rb 152 def sc_mismatch; @parameters['sc-mismatch']; end
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