Class: Bio::LazyBlast::Report::Iteration::Hit
- Inherits:
-
Object
- Object
- Bio::LazyBlast::Report::Iteration::Hit
- Includes:
- Enumerable
- Defined in:
- lib/bio/appl/blast/lazyblastxml.rb
Defined Under Namespace
Classes: Hsp
Instance Attribute Summary collapse
-
#accession ⇒ Object
readonly
Returns the value of attribute accession.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#hit_id ⇒ Object
readonly
Returns the value of attribute hit_id.
-
#len ⇒ Object
readonly
Returns the value of attribute len.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
Instance Method Summary collapse
- #each ⇒ Object (also: #each_hsp)
-
#initialize(reader) ⇒ Hit
constructor
A new instance of Hit.
- #setup_hit_values ⇒ Object
Constructor Details
#initialize(reader) ⇒ Hit
Returns a new instance of Hit.
106 107 108 109 110 111 112 113 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 106 def initialize(reader) @nodes = Enumerator.new do |yielder| until (reader.name == "Hit" 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_hit_values end |
Instance Attribute Details
#accession ⇒ Object (readonly)
Returns the value of attribute accession.
104 105 106 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 104 def accession @accession end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
104 105 106 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 104 def definition @definition end |
#hit_id ⇒ Object (readonly)
Returns the value of attribute hit_id.
104 105 106 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 104 def hit_id @hit_id end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
104 105 106 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 104 def len @len end |
#num ⇒ Object (readonly)
Returns the value of attribute num.
104 105 106 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 104 def num @num end |
Instance Method Details
#each ⇒ Object Also known as: each_hsp
133 134 135 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 133 def each @nodes.each{|node| yield Hsp.new(node) if node.name == "Hsp"} end |
#setup_hit_values ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 115 def setup_hit_values @nodes.each do |node| return if node.name == 'Hit_hsps' case node.name when 'Hit_num' @num = node.read_inner_xml.to_i when 'Hit_id' @hit_id = node.read_inner_xml.to_i when 'Hit_def' @definition = node.read_inner_xml when 'Hit_accession' @accession = node.read_inner_xml when 'Hit_len' @len = node.read_inner_xml end end end |