Class: Bio::BlastXMLParser::BlastXmlSplitter

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(fn) ⇒ BlastXmlSplitter

Returns a new instance of BlastXmlSplitter.



8
9
10
# File 'lib/bio/db/blast/xmlsplitter.rb', line 8

def initialize fn
  @fn = fn
end

Instance Method Details

#eachObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# 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