class Bio::FlatFileIndex::Indexer::Parser::FastaFormatParser

Constants

NAMESTYLE
PRIMARY
SECONDARY

Public Class Methods

new(pri_name = nil, sec_names = nil) click to toggle source
# File lib/bio/io/flatfile/indexer.rb, line 275
def initialize(pri_name = nil, sec_names = nil)
  super()
  self.format = 'fasta'
  self.dbclass = Bio::FastaFormat
  self.set_primary_namespace((pri_name or PRIMARY))
  unless sec_names then
    sec_names = self.class::SECONDARY
  end
  self.add_secondary_namespaces(*sec_names)
end

Public Instance Methods

open_flatfile(fileid, file) click to toggle source
# File lib/bio/io/flatfile/indexer.rb, line 285
def open_flatfile(fileid, file)
  super
  @count = 1
  @flatfilename_base = File.basename(@flatfilename)
  @flatfile.pos = 0
  begin
    pos = @flatfile.pos
    line = @flatfile.gets
  end until (!line or line =~ /^\>/)
  @flatfile.pos = pos
end
parse_primary() click to toggle source
# File lib/bio/io/flatfile/indexer.rb, line 262
def parse_primary
  if p = self.primary.proc then
    r = p.call(@entry)
    unless r.is_a?(String) and r.length > 0
      #@fatal = true
      raise 'primary id must be a non-void string (skipped this entry)'
    end
    r
  else
    unique_primary_key
  end
end