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
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) click to toggle source
    # File lib/bio/io/flatfile/indexer.rb
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() click to toggle source
    # File lib/bio/io/flatfile/indexer.rb
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