Class: Bio::BlastXMLParser::NokogiriBlastHit

Inherits:
Object
  • Object
show all
Includes:
MapXPath
Defined in:
lib/bio/db/blast/parser/nokogiri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MapXPath

#[], define_f, define_i, define_s

Methods included from XPath

#field

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

#parentObject (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

#eachObject



117
118
119
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 117

def each
  hsps.each { | h | yield h }
end

#hspsObject



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_sObject



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