Class: Bio::FlatFileIndex::Indexer::Parser::GenBankParser

Inherits:
TemplateParser show all
Defined in:
lib/bio/io/flatfile/indexer.rb

Overview

class TemplateParser

Direct Known Subclasses

GenPeptParser

Constant Summary collapse

NAMESTYLE =
NameSpaces.new(
             NameSpace.new( 'VERSION', Proc.new { |x| x.acc_version } ),
             NameSpace.new( 'LOCUS', Proc.new { |x| x.entry_id } ),
             NameSpace.new( 'ACCESSION',
                           Proc.new { |x| x.accessions } ),
             NameSpace.new( 'GI', Proc.new { |x|
                             x.gi.to_s.gsub(/\AGI\:/, '') } )
)
PRIMARY =
'VERSION'

Instance Attribute Summary

Attributes inherited from TemplateParser

#dbclass, #errorlog, #fileid, #format, #primary, #secondary

Instance Method Summary collapse

Methods inherited from TemplateParser

#add_secondary_namespaces, #close_flatfile, #each, #open_flatfile, #parse_primary, #parse_secondary, #set_primary_namespace

Constructor Details

#initialize(pri_name = nil, sec_names = nil) ⇒ GenBankParser

Returns a new instance of GenBankParser.



183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/bio/io/flatfile/indexer.rb', line 183

def initialize(pri_name = nil, sec_names = nil)
  super()
  self.format = 'genbank'
  self.dbclass = Bio::GenBank
  self.set_primary_namespace((pri_name or PRIMARY))
  unless sec_names then
    sec_names = []
    @namestyle.each_value do |x|
      sec_names << x.name if x.name != self.primary.name
    end
  end
  self.add_secondary_namespaces(*sec_names)
end