Class: Bio::Blast::RPSBlast::Report

Inherits:
Default::Report show all
Defined in:
lib/bio/appl/blast/rpsblast.rb

Overview

NCBI RPS Blast (Reversed Position Specific Blast) default output parser.

It supports defalut (-m 0 option) output of the “rpsblast” command.

Because this class inherits Bio::Blast::Default::Report, almost all methods are eqaul to Bio::Blast::Default::Report. Only DELIMITER (and RS) and few methods are different.

By using Bio::FlatFile, (for example, Bio::FlatFile.open), rpsblast result generated from multiple query sequences is automatically splitted into multiple Bio::BLast::RPSBlast::Report objects corresponding to query sequences.

Note for multi-fasta results WITH using Bio::FlatFile: Each splitted result is concatenated with header of the result which describes RPS-BLAST version and database information, if possible.

Note for multi-fasta results WITHOUT using Bio::FlatFile: When parsing an output of rpsblast command running with multi-fasta sequences WITHOUT using Bio::FlatFile, each query’s result is stored as an “iteration” of PSI-Blast. This behavior may be changed in the future.

Note for nucleotide results: This class is not tested with nucleotide query and/or nucleotide databases.

Defined Under Namespace

Classes: Iteration

Constant Summary collapse

DELIMITER =

Delimter of each entry for RPS-BLAST.

RS = "\nRPS-BLAST"
DELIMITER_OVERRUN =

(Integer) excess read size included in DELIMITER.

9
FLATFILE_SPLITTER =

splitter for Bio::FlatFile support

RPSBlastSplitter

Instance Attribute Summary

Attributes inherited from Default::Report

#db_len, #db_num, #eff_space, #entry_overrun, #expect, #gap_extend, #gap_open, #iterations, #matrix, #num_hits, #posted_date, #sc_match, #sc_mismatch

Instance Method Summary collapse

Methods inherited from Default::Report

#converged?, #db, #each_hit, #each_iteration, #entropy, #gapped_entropy, #gapped_kappa, #gapped_lambda, #hits, #kappa, #lambda, #message, open, #pattern, #pattern_positions, #program, #reference, #references, #to_s, #version, #version_date, #version_number

Constructor Details

#initialize(str) ⇒ Report

Creates a new Report object from a string.

Using Bio::FlatFile.open (or some other methods) is recommended instead of using this method directly. Refer Bio::Blast::RPSBlast::Report document for more information.

Note for multi-fasta results WITHOUT using Bio::FlatFile: When parsing an output of rpsblast command running with multi-fasta sequences WITHOUT using Bio::FlatFile, each query’s result is stored as an “iteration” of PSI-Blast. This behavior may be changed in the future.

Note for nucleotide results: This class is not tested with nucleotide query and/or nucleotide databases.



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/bio/appl/blast/rpsblast.rb', line 172

def initialize(str)
  str = str.sub(/\A\s+/, '')
  # remove trailing entries for sure
  str.sub!(/\n(RPS\-BLAST.*)/m, "\n") 
  @entry_overrun = $1
  @entry = str
  data = str.split(/(?:^[ \t]*\n)+/)

  if data[0] and /\AQuery\=/ !~ data[0] then
    format0_split_headers(data)
  end
  @iterations = format0_split_search(data)
  format0_split_stat_params(data)
end

Instance Method Details

#query_defObject

Returns definition of the query. For a result of multi-fasta input, the first query’s definition is returned (The same as iterations.first.query_def).



190
191
192
# File 'lib/bio/appl/blast/rpsblast.rb', line 190

def query_def
  iterations.first.query_def
end

#query_lenObject

Returns length of the query. For a result of multi-fasta input, the first query’s length is returned (The same as iterations.first.query_len).



197
198
199
# File 'lib/bio/appl/blast/rpsblast.rb', line 197

def query_len
  iterations.first.query_len
end