Class: Bio::LazyBlast::Report::Iteration
- Inherits:
-
Object
- Object
- Bio::LazyBlast::Report::Iteration
- Includes:
- Enumerable
- Defined in:
- lib/bio/appl/blast/lazyblastxml.rb
Defined Under Namespace
Classes: Hit
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#query_def ⇒ Object
readonly
Returns the value of attribute query_def.
-
#query_id ⇒ Object
readonly
Returns the value of attribute query_id.
-
#query_len ⇒ Object
readonly
Returns the value of attribute query_len.
Instance Method Summary collapse
- #each ⇒ Object (also: #each_hit)
-
#initialize(reader) ⇒ Iteration
constructor
A new instance of Iteration.
- #setup_iteration_values ⇒ Object
Constructor Details
#initialize(reader) ⇒ Iteration
Returns a new instance of Iteration.
70 71 72 73 74 75 76 77 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 70 def initialize(reader) @nodes = Enumerator.new do |yielder| until (reader.name == "Iteration" and reader.node_type == LibXML::XML::Reader::TYPE_END_ELEMENT) or !reader.read yielder << reader if reader.node_type == LibXML::XML::Reader::TYPE_ELEMENT end end setup_iteration_values end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def @message end |
#num ⇒ Object (readonly)
Returns the value of attribute num.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def num @num end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def parameters @parameters end |
#query_def ⇒ Object (readonly)
Returns the value of attribute query_def.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def query_def @query_def end |
#query_id ⇒ Object (readonly)
Returns the value of attribute query_id.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def query_id @query_id end |
#query_len ⇒ Object (readonly)
Returns the value of attribute query_len.
68 69 70 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 68 def query_len @query_len end |
Instance Method Details
#each ⇒ Object Also known as: each_hit
97 98 99 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 97 def each @nodes.each{|node| yield Hit.new(node) if node.name == "Hit"} end |
#setup_iteration_values ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 79 def setup_iteration_values @nodes.each do |node| return if node.name == 'Iteration_hits' case node.name when 'Iteration_iter-num' @num = node.read_inner_xml.to_i when 'Iteration_query-ID' @query_id = node.read_inner_xml when 'Iteration_query-def' @query_def = node.read_inner_xml when 'Iteration_query-len' @query_len = node.read_inner_xml.to_i when 'Iteration_message' @message = node.read_inner_xml end end end |