Class: Bio::BlastXMLParser::BlastXmlSplitter
- Inherits:
-
Object
- Object
- Bio::BlastXMLParser::BlastXmlSplitter
- 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
- #each ⇒ Object
-
#initialize(fn) ⇒ BlastXmlSplitter
constructor
A new instance of BlastXmlSplitter.
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
#each ⇒ Object
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 |