Class: Bio::FlatFileIndex::Indexer::Parser::PDBChemicalComponentParser

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

Overview

class BlastDefaultReportParser

Constant Summary collapse

NAMESTYLE =
NameSpaces.new(
             NameSpace.new( 'UNIQUE', Proc.new { |x| x.entry_id } )
)
PRIMARY =
'UNIQUE'

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, #parse_primary, #parse_secondary, #set_primary_namespace

Constructor Details

#initialize(klass, pri_name = nil, sec_names = nil) ⇒ PDBChemicalComponentParser

Returns a new instance of PDBChemicalComponentParser



425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/bio/io/flatfile/indexer.rb', line 425

def initialize(klass, pri_name = nil, sec_names = nil)
  super()
  self.format = 'raw'
  self.dbclass = Bio::PDB::ChemicalComponent
  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

Instance Method Details

#open_flatfile(fileid, file) ⇒ Object



438
439
440
441
442
443
444
445
446
# File 'lib/bio/io/flatfile/indexer.rb', line 438

def open_flatfile(fileid, file)
  super
  @flatfile.pos = 0
  begin
    pos = @flatfile.pos
    line = @flatfile.gets
  end until (!line or line =~ /^RESIDUE /)
  @flatfile.pos = pos
end