class Bio::BlastXMLParser::NokogiriBlastIterator

Attributes

parent[R]

Public Class Methods

new(iterator, parent, opts = { :prefix => nil }) click to toggle source
# File lib/bio/db/blast/parser/nokogiri.rb, line 140
def initialize iterator, parent, opts = { :prefix => nil }
  @parent = parent
  @prefix = opts[:prefix]
  @xml = if iterator.name == 'document'
           iterator.children.first
         else
           iterator
         end
  name2 = @xml.name
  raise "Error in BLAST XML, expected Iteration node, but got #{name2}" if name2 != 'Iteration'
  # p [:iter,@prefix,'@@Iteratition_iter-num',field('Iteration_iter-num')]
  # print @xml.to_s
end

Public Instance Methods

each() { |h| ... } click to toggle source
# File lib/bio/db/blast/parser/nokogiri.rb, line 168
def each
  hits.each { | h | yield h }
end
hits() click to toggle source
# File lib/bio/db/blast/parser/nokogiri.rb, line 154
def hits
  Enumerator.new { |yielder|
    @xml.children.each do | iter_field |
      if iter_field.name == 'Iteration_hits'
        iter_field.children.each do | hit |
          if hit.name == 'Hit'
            yielder.yield NokogiriBlastHit.new(hit,self)
          end
        end
      end
    end
  }
end
to_s() click to toggle source
# File lib/bio/db/blast/parser/nokogiri.rb, line 172
      def to_s
        s = <<EOM
iter_num=#{iter_num}, query_id=#{query_id}
EOM
      end