Class | Bio::FlatFileIndex::Indexer::Parser::FastaFormatParser
In: | lib/bio/io/flatfile/indexer.rb
Parent: | TemplateParser

### Methods

new open_flatfile parse_primary

### Constants

NAMESTYLE | = | NameSpaces.new( NameSpace.new( 'UNIQUE', nil ), NameSpace.new( 'entry_id', Proc.new { |x| x.entry_id } ), NameSpace.new( 'accession', Proc.new { |x| x.accessions } ), NameSpace.new( 'id_string', Proc.new { |x| x.identifiers.id_strings
PRIMARY | = | 'UNIQUE'
SECONDARY | = | [ 'entry_id', 'accession', 'id_string', 'word' ]

### Public Class methods

new(pri_name = nil, sec_names = nil)

[Source]

         # File lib/bio/io/flatfile/indexer.rb, line 275
    275:           def initialize(pri_name = nil, sec_names = nil)
    276:             super()
    277:             self.format = 'fasta'
    278:             self.dbclass = Bio::FastaFormat
    279:             self.set_primary_namespace((pri_name or PRIMARY))
    280:             unless sec_names then
    281:               sec_names = self.class::SECONDARY
    282:             end
    283:             self.add_secondary_namespaces(*sec_names)
    284:           end

### Public Instance methods

open_flatfile(fileid, file)

[Source]

         # File lib/bio/io/flatfile/indexer.rb, line 285
    285:           def open_flatfile(fileid, file)
    286:             super
    287:             @count = 1
    288:             @flatfilename_base = File.basename(@flatfilename)
    289:             @flatfile.pos = 0
    290:             begin
    291:               pos = @flatfile.pos
    292:               line = @flatfile.gets
    293:             end until (!line or line =~ /^\>/)
    294:             @flatfile.pos = pos
    295:           end

parse_primary()

[Source]

         # File lib/bio/io/flatfile/indexer.rb, line 262
    262:           def parse_primary
    263:             if p = self.primary.proc then
    264:               r = p.call(@entry)
    265:               unless r.is_a?(String) and r.length > 0
    266:                 #@fatal = true
    267:                 raise 'primary id must be a non-void string (skipped this entry)'
    268:               end
    269:               r
    270:             else
    271:               unique_primary_key
    272:             end
    273:           end

[Validate]