class Bio::BlastXMLParser::BlastXmlSplitter
Reads a full XML result and splits it out into a buffer for each Iteration (query result).
Public Class Methods
new(fn)
click to toggle source
# File lib/bio/db/blast/xmlsplitter.rb, line 8 def initialize fn @fn = fn end
Public Instance Methods
each() { |buf| ... }
click to toggle source
# File lib/bio/db/blast/xmlsplitter.rb, line 11 def each 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 | yield buf end end
Private Instance Methods
each_iteration(f) { |b| ... }
click to toggle source
# File lib/bio/db/blast/xmlsplitter.rb, line 27 def each_iteration f # b = ["<?xml version=\"1.0\"?>\n","<Iteration>\n"] # b = [] b = ["<Iteration>\n"] f.each_line do | line | b << line if line.strip == "</Iteration>" yield b b = [] end end end