class Bio::Blast::Report::BlastXmlSplitter
Flatfile splitter for NCBI BLAST XML format. It is internally used when reading BLAST XML. Normally, users do not need to use it directly.
Public Class Methods
new(klass, bstream)
click to toggle source
creates a new splitter object
Calls superclass method
Bio::FlatFile::Splitter::Default.new
# File lib/bio/appl/blast/report.rb, line 486 def initialize(klass, bstream) super(klass, bstream) @parsed_entries = [] @raw_unsupported = false end
Public Instance Methods
entry()
click to toggle source
current raw entry as a String
Calls superclass method
# File lib/bio/appl/blast/report.rb, line 531 def entry raise 'not supported for new BLAST XML format' if @raw_unsupported super end
entry_ended_pos()
click to toggle source
(end position of the entry) + 1
Calls superclass method
# File lib/bio/appl/blast/report.rb, line 545 def entry_ended_pos if entry_pos_flag then raise 'not supported for new BLAST XML format' if @raw_unsupported end super end
entry_start_pos()
click to toggle source
start position of the entry
Calls superclass method
# File lib/bio/appl/blast/report.rb, line 537 def entry_start_pos if entry_pos_flag then raise 'not supported for new BLAST XML format' if @raw_unsupported end super end
get_entry()
click to toggle source
get an entry and return the entry as a string
Calls superclass method
Bio::FlatFile::Splitter::Default#get_entry
# File lib/bio/appl/blast/report.rb, line 506 def get_entry if @parsed_entries.empty? then @raw_unsupported = false ent = super prepare_parsed_entries(ent) self.parsed_entry = @parsed_entries.shift else raise 'not supported for new BLAST XML format' end ent end
get_parsed_entry()
click to toggle source
get an entry as a Bio::Blast::Report object
# File lib/bio/appl/blast/report.rb, line 519 def get_parsed_entry if @parsed_entries.empty? then ent = get_entry else self.parsed_entry = @parsed_entries.shift self.entry = nil @raw_unsupported = true end self.parsed_entry end
rewind()
click to toggle source
rewinds
Calls superclass method
Bio::FlatFile::Splitter::Template#rewind
# File lib/bio/appl/blast/report.rb, line 493 def rewind ret = super @parsed_entries.clear @raw_unsupported = false ret end
skip_leader()
click to toggle source
do nothing
# File lib/bio/appl/blast/report.rb, line 501 def skip_leader nil end
Private Instance Methods
prepare_parsed_entries(ent)
click to toggle source
(private method) to prepare parsed entry
# File lib/bio/appl/blast/report.rb, line 554 def prepare_parsed_entries(ent) if ent then blast = dbclass.new(ent) if blast.reports and blast.reports.size >= 1 then # new blast xml using <Iteration> for multiple queries @parsed_entries.concat blast.reports else # traditional blast xml @parsed_entries.push blast end end end