Class: Bio::Blast::Default::Report
- Defined in:
- lib/bio/appl/blast/format0.rb
Overview
Bio::Blast::Default::Report parses NCBI BLAST default output and stores information in the data. It may store some Bio::Blast::Default::Report::Iteration objects.
Direct Known Subclasses
Defined Under Namespace
Classes: AlwaysNil, F0dbstat, HSP, Hit, Iteration
Constant Summary collapse
- DELIMITER =
Delimiter of each entry. Bio::FlatFile uses it.
RS = "\nBLAST"
- DELIMITER_OVERRUN =
(Integer) excess read size included in DELIMITER.
5
Instance Attribute Summary collapse
-
#db_len ⇒ Object
readonly
number of letters in database.
-
#db_num ⇒ Object
readonly
number of sequences in database.
-
#eff_space ⇒ Object
readonly
effective length of the database.
-
#entry_overrun ⇒ Object
readonly
piece of next entry.
-
#expect ⇒ Object
readonly
e-value threshold specified when BLAST was executed.
-
#gap_extend ⇒ Object
readonly
gap extend penalty.
-
#gap_open ⇒ Object
readonly
gap open penalty.
-
#iterations ⇒ Object
readonly
(PSI-BLAST) Returns iterations.
-
#matrix ⇒ Object
readonly
name of the matrix.
-
#num_hits ⇒ Object
readonly
number of hits.
-
#posted_date ⇒ Object
readonly
posted date of the database.
-
#sc_match ⇒ Object
readonly
match score of the matrix.
-
#sc_mismatch ⇒ Object
readonly
mismatch score of the matrix.
Class Method Summary collapse
-
.open(filename, *mode) ⇒ Object
Opens file by using Bio::FlatFile.open.
Instance Method Summary collapse
-
#converged? ⇒ Boolean
(PSI-BLAST) Same as
iterations.last.converged?
. -
#db ⇒ Object
Returns the name (filename or title) of the database.
-
#each_hit ⇒ Object
(also: #each)
Iterates over each hit of the last iteration.
-
#each_iteration ⇒ Object
(PSI-BLAST) Iterates over each iteration.
-
#entropy ⇒ Object
Same as
iterations.last.entropy
. -
#gapped_entropy ⇒ Object
Same as
iterations.last.gapped_entropy
. -
#gapped_kappa ⇒ Object
Same as
iterations.last.gapped_kappa
. -
#gapped_lambda ⇒ Object
Same as
iterations.last.gapped_lambda
. -
#hits ⇒ Object
Same as
iterations.last.hits
. -
#initialize(str) ⇒ Report
constructor
Creates a new Report object from BLAST result text.
-
#kappa ⇒ Object
Same as
iterations.last.kappa
. -
#lambda ⇒ Object
Same as
iterations.last.lambda
. -
#message ⇒ Object
(PSI-BLAST) Same as
iterations.last.message
. -
#pattern ⇒ Object
(PHI-BLAST) Same as
iterations.first.pattern
. -
#pattern_positions ⇒ Object
(PHI-BLAST) Same as
iterations.first.pattern_positions
. -
#program ⇒ Object
Returns program name.
-
#query_def ⇒ Object
Returns definition of the query.
-
#query_len ⇒ Object
Returns length of the query.
-
#reference ⇒ Object
Returns the bibliography reference of the BLAST software.
-
#references ⇒ Object
Returns the bibliography references of the BLAST software.
-
#to_s ⇒ Object
Returns whole entry as a string.
-
#version ⇒ Object
Returns version of the program.
-
#version_date ⇒ Object
Returns released date of the program.
-
#version_number ⇒ Object
Returns version number string of the program.
Constructor Details
#initialize(str) ⇒ Report
Creates a new Report object from BLAST result text.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bio/appl/blast/format0.rb', line 48 def initialize(str) str = str.sub(/\A\s+/, '') str.sub!(/\n(T?BLAST.*)/m, "\n") # remove trailing entries for sure @entry_overrun = $1 @entry = str data = str.split(/(?:^[ \t]*\n)+/) format0_split_headers(data) @iterations = format0_split_search(data) format0_split_stat_params(data) end |
Instance Attribute Details
#db_len ⇒ Object (readonly)
number of letters in database
84 85 86 |
# File 'lib/bio/appl/blast/format0.rb', line 84 def db_len @db_len end |
#db_num ⇒ Object (readonly)
number of sequences in database
80 81 82 |
# File 'lib/bio/appl/blast/format0.rb', line 80 def db_num @db_num end |
#eff_space ⇒ Object (readonly)
effective length of the database
92 93 94 |
# File 'lib/bio/appl/blast/format0.rb', line 92 def eff_space @eff_space end |
#entry_overrun ⇒ Object (readonly)
piece of next entry. Bio::FlatFile uses it.
60 61 62 |
# File 'lib/bio/appl/blast/format0.rb', line 60 def entry_overrun @entry_overrun end |
#expect ⇒ Object (readonly)
e-value threshold specified when BLAST was executed
116 117 118 |
# File 'lib/bio/appl/blast/format0.rb', line 116 def expect @expect end |
#gap_extend ⇒ Object (readonly)
gap extend penalty
112 113 114 |
# File 'lib/bio/appl/blast/format0.rb', line 112 def gap_extend @gap_extend end |
#gap_open ⇒ Object (readonly)
gap open penalty
108 109 110 |
# File 'lib/bio/appl/blast/format0.rb', line 108 def gap_open @gap_open end |
#iterations ⇒ Object (readonly)
(PSI-BLAST) Returns iterations. It returns an array of Bio::Blast::Default::Report::Iteration class. Note that normal blastall result usually contains one iteration.
66 67 68 |
# File 'lib/bio/appl/blast/format0.rb', line 66 def iterations @iterations end |
#matrix ⇒ Object (readonly)
name of the matrix
96 97 98 |
# File 'lib/bio/appl/blast/format0.rb', line 96 def matrix @matrix end |
#num_hits ⇒ Object (readonly)
number of hits. Note that this may differ from hits.size
.
120 121 122 |
# File 'lib/bio/appl/blast/format0.rb', line 120 def num_hits @num_hits end |
#posted_date ⇒ Object (readonly)
posted date of the database
88 89 90 |
# File 'lib/bio/appl/blast/format0.rb', line 88 def posted_date @posted_date end |
#sc_match ⇒ Object (readonly)
match score of the matrix
100 101 102 |
# File 'lib/bio/appl/blast/format0.rb', line 100 def sc_match @sc_match end |
#sc_mismatch ⇒ Object (readonly)
mismatch score of the matrix
104 105 106 |
# File 'lib/bio/appl/blast/format0.rb', line 104 def sc_mismatch @sc_mismatch end |
Class Method Details
Instance Method Details
#converged? ⇒ Boolean
(PSI-BLAST) Same as iterations.last.converged?
. Returns true if the last iteration is converged, otherwise, returns false.
203 204 205 |
# File 'lib/bio/appl/blast/format0.rb', line 203 def converged? @iterations.last.converged? end |
#db ⇒ Object
Returns the name (filename or title) of the database.
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/bio/appl/blast/format0.rb', line 227 def db unless defined?(@db) if /Database *\: *(.*)/m =~ @f0database then a = $1.split(/^/) a.pop if a.size > 1 @db = a.collect { |x| x.sub(/\s+\z/, '') }.join(' ') end end #unless @db end |
#each_hit ⇒ Object Also known as: each
Iterates over each hit of the last iteration. Same as iterations.last.each_hit
. Yields a Bio::Blast::Default::Report::Hit object. This is very useful in most cases, e.g. for blastall results.
178 179 180 181 182 |
# File 'lib/bio/appl/blast/format0.rb', line 178 def each_hit @iterations.last.each do |x| yield x end end |
#each_iteration ⇒ Object
(PSI-BLAST) Iterates over each iteration. Same as iterations.each
. Yields a Bio::Blast::Default::Report::Iteration object.
168 169 170 171 172 |
# File 'lib/bio/appl/blast/format0.rb', line 168 def each_iteration @iterations.each do |x| yield x end end |
#entropy ⇒ Object
Same as iterations.last.entropy
.
128 |
# File 'lib/bio/appl/blast/format0.rb', line 128 def entropy; @iterations.last.entropy; end |
#gapped_entropy ⇒ Object
Same as iterations.last.gapped_entropy
.
135 |
# File 'lib/bio/appl/blast/format0.rb', line 135 def gapped_entropy; @iterations.last.gapped_entropy; end |
#gapped_kappa ⇒ Object
Same as iterations.last.gapped_kappa
.
131 |
# File 'lib/bio/appl/blast/format0.rb', line 131 def gapped_kappa; @iterations.last.gapped_kappa; end |
#gapped_lambda ⇒ Object
Same as iterations.last.gapped_lambda
.
133 |
# File 'lib/bio/appl/blast/format0.rb', line 133 def gapped_lambda; @iterations.last.gapped_lambda; end |
#hits ⇒ Object
Same as iterations.last.hits
. Returns the last iteration’s hits. Returns an array of Bio::Blast::Default::Report::Hit object. This is very useful in most cases, e.g. for blastall results.
189 190 191 |
# File 'lib/bio/appl/blast/format0.rb', line 189 def hits @iterations.last.hits end |
#kappa ⇒ Object
Same as iterations.last.kappa
.
124 |
# File 'lib/bio/appl/blast/format0.rb', line 124 def kappa; @iterations.last.kappa; end |
#lambda ⇒ Object
Same as iterations.last.lambda
.
126 |
# File 'lib/bio/appl/blast/format0.rb', line 126 def lambda; @iterations.last.lambda; end |
#message ⇒ Object
(PSI-BLAST) Same as iterations.last.message
.
195 196 197 |
# File 'lib/bio/appl/blast/format0.rb', line 195 def @iterations.last. end |
#pattern ⇒ Object
(PHI-BLAST) Same as iterations.first.pattern
. Note that it returns the FIRST iteration’s value.
155 |
# File 'lib/bio/appl/blast/format0.rb', line 155 def pattern; @iterations.first.pattern; end |
#pattern_positions ⇒ Object
(PHI-BLAST) Same as iterations.first.pattern_positions
. Note that it returns the FIRST iteration’s value.
160 161 162 |
# File 'lib/bio/appl/blast/format0.rb', line 160 def pattern_positions @iterations.first.pattern_positions end |
#program ⇒ Object
Returns program name.
138 |
# File 'lib/bio/appl/blast/format0.rb', line 138 def program; format0_parse_header; @program; end |
#query_def ⇒ Object
Returns definition of the query.
150 |
# File 'lib/bio/appl/blast/format0.rb', line 150 def query_def; format0_parse_query; @query_def; end |
#query_len ⇒ Object
Returns length of the query.
147 |
# File 'lib/bio/appl/blast/format0.rb', line 147 def query_len; format0_parse_query; @query_len; end |
#reference ⇒ Object
Returns the bibliography reference of the BLAST software. Note that this method shows only the first reference. When you want to get additional references, you can use references
method.
211 212 213 |
# File 'lib/bio/appl/blast/format0.rb', line 211 def reference references[0] end |
#references ⇒ Object
Returns the bibliography references of the BLAST software. Returns an array of strings.
217 218 219 220 221 222 223 224 |
# File 'lib/bio/appl/blast/format0.rb', line 217 def references unless defined?(@references) @references = @f0references.collect do |x| x.to_s.gsub(/\s+/, ' ').strip end end #unless @references end |
#to_s ⇒ Object
Returns whole entry as a string.
69 |
# File 'lib/bio/appl/blast/format0.rb', line 69 def to_s; @entry; end |
#version ⇒ Object
Returns version of the program.
140 |
# File 'lib/bio/appl/blast/format0.rb', line 140 def version; format0_parse_header; @version; end |
#version_date ⇒ Object
Returns released date of the program.
144 |
# File 'lib/bio/appl/blast/format0.rb', line 144 def version_date; format0_parse_header; @version_date; end |
#version_number ⇒ Object
Returns version number string of the program.
142 |
# File 'lib/bio/appl/blast/format0.rb', line 142 def version_number; format0_parse_header; @version_number; end |