class Bio::Fasta::Report::FastaFormat10Splitter

Splitter for Bio::FlatFile

Public Class Methods

new(klass, bstream) click to toggle source

creates a new splitter object

Calls superclass method Bio::FlatFile::Splitter::Template.new
# File lib/bio/appl/fasta/format10.rb, line 23
def initialize(klass, bstream)
  super(klass, bstream)
  @delimiter = '>>>'
  @real_delimiter = /^\s*\d+\>\>\>\z/
end

Public Instance Methods

get_entry() click to toggle source

gets an entry

# File lib/bio/appl/fasta/format10.rb, line 35
def get_entry
  p0 = stream_pos()
  pieces = []
  overrun = nil
  first = true
  while e = stream.gets(@delimiter)
    pieces.push e
    if @real_delimiter =~ e then
      if first then
        first = nil
      else
        overrun = $&
        break
      end
    end
  end

  ent = (pieces.empty? ? nil : pieces.join(''))
  if ent and overrun then
    ent[-overrun.length, overrun.length] = ''
    stream.ungets(overrun)
  end

  p1 = stream_pos()
  self.entry_start_pos = p0
  self.entry = ent
  self.entry_ended_pos = p1
  return ent
end
skip_leader() click to toggle source

do nothing and returns nil

# File lib/bio/appl/fasta/format10.rb, line 30
def skip_leader
  nil
end