Class: Bio::Blast::XmlSplitterIterator
- Inherits:
-
Object
- Object
- Bio::Blast::XmlSplitterIterator
- Defined in:
- lib/bio/db/blast/xmlsplitter.rb
Overview
Reads a full XML result and splits it out into a buffer for each Iteration (query result).
Instance Method Summary collapse
-
#initialize(fn) ⇒ XmlSplitterIterator
constructor
include Enumerable.
- #to_enum ⇒ Object
Constructor Details
#initialize(fn) ⇒ XmlSplitterIterator
include Enumerable
10 11 12 |
# File 'lib/bio/db/blast/xmlsplitter.rb', line 10 def initialize fn @fn = fn end |
Instance Method Details
#to_enum ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bio/db/blast/xmlsplitter.rb', line 14 def to_enum Enumerator.new do | yielder | logger = Bio::Log::LoggerPlus['bio-blastxmlparser'] logger.info("split file parsing #{@fn}") f = File.open(@fn) # Skip BLAST header f.each_line do | line | break if line.strip == "<Iteration>" end # Return each Iteration as an XML DOM each_iteration(f) do | buf | iteration = Nokogiri::XML.parse(buf.join) { | cfg | cfg.noblanks } yielder.yield NokogiriBlastIterator.new(iteration,self,:prefix=>nil) end end end |