Class: Bio::BlastXMLParser::NokogiriBlastHit
- Inherits:
-
Object
- Object
- Bio::BlastXMLParser::NokogiriBlastHit
- Includes:
- MapXPath
- Defined in:
- lib/bio/db/blast/parser/nokogiri.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #each ⇒ Object
- #hsps ⇒ Object
-
#initialize(hit, parent) ⇒ NokogiriBlastHit
constructor
A new instance of NokogiriBlastHit.
- #to_s ⇒ Object
Methods included from MapXPath
#[], define_f, define_i, define_s
Methods included from XPath
Constructor Details
#initialize(hit, parent) ⇒ NokogiriBlastHit
Returns a new instance of NokogiriBlastHit.
98 99 100 101 |
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 98 def initialize hit, parent @xml = hit @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
91 92 93 |
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 91 def parent @parent end |
Instance Method Details
#each ⇒ Object
117 118 119 |
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 117 def each hsps.each { | h | yield h } end |
#hsps ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 103 def hsps Enumerator.new { |yielder| @xml.children.each do | hit_field | if hit_field.name == 'Hit_hsps' hit_field.children.each do | hsp | if hsp.name == 'Hsp' yielder.yield NokogiriBlastHsp.new(hsp,self) end end end end } end |
#to_s ⇒ Object
122 123 124 125 126 |
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 122 def to_s s = <<EOM iter_num=#{parent.iter_num}, hit_id=#{hit_id}, hit_def=#{hit_def}, hit_num=#{hit_num} EOM end |