| Class | Bio::FlatFileIndex::Indexer::Parser::BlastDefaultParser |
| In: |
lib/bio/io/flatfile/indexer.rb
|
| Parent: | TemplateParser |
| NAMESTYLE | = | NameSpaces.new( NameSpace.new( 'QUERY', Proc.new { |x| x.query_def } ), NameSpace.new( 'query_id', Proc.new { |x| a = Bio::FastaDefline.new(x.query_def.to_s).id_strings |
| PRIMARY | = | 'QUERY' |
| SECONDARY | = | [ 'query_id', 'hit' ] |
# File lib/bio/io/flatfile/indexer.rb, line 392
392: def initialize(klass, pri_name = nil, sec_names = nil)
393: super()
394: self.format = 'raw'
395: self.dbclass = klass
396: self.set_primary_namespace((pri_name or PRIMARY))
397: unless sec_names then
398: sec_names = []
399: @namestyle.each_value do |x|
400: sec_names << x.name if x.name != self.primary.name
401: end
402: end
403: self.add_secondary_namespaces(*sec_names)
404: end
# File lib/bio/io/flatfile/indexer.rb, line 405
405: def open_flatfile(fileid, file)
406: super
407: @flatfile.rewind
408: @flatfile.dbclass = nil
409: @flatfile.autodetect
410: @flatfile.dbclass = self.dbclass unless @flatfile.dbclass
411: @flatfile.rewind
412: begin
413: pos = @flatfile.pos
414: line = @flatfile.gets
415: end until (!line or line =~ /^T?BLAST/)
416: @flatfile.pos = pos
417: end