Class: SwissprotDatabase
- Inherits:
-
Object
- Object
- SwissprotDatabase
- Defined in:
- lib/protk/swissprot_database.rb
Overview
Provides fast indexed access to a swissprot database in a flat .dat file
Instance Method Summary collapse
- #get_entry_for_name(name) ⇒ Object
-
#initialize(datfile_path, skip_indexing = false) ⇒ SwissprotDatabase
constructor
A new instance of SwissprotDatabase.
Constructor Details
#initialize(datfile_path, skip_indexing = false) ⇒ SwissprotDatabase
Returns a new instance of SwissprotDatabase.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/protk/swissprot_database.rb', line 10 def initialize(datfile_path,skip_indexing=false) dbpath=Pathname.new(datfile_path) dbclass=Bio::SPTR unless skip_indexing parser = Bio::FlatFileIndex::Indexer::Parser.new(dbclass, nil, nil) Bio::FlatFileIndex::Indexer::makeindexFlat(dbpath.realpath.dirname.to_s, parser, {}, \ dbpath.realpath.to_s) end @db_object=Bio::FlatFileIndex.new("#{dbpath.realpath.dirname.to_s}") @db_object.always_check_consistency=false end |
Instance Method Details
#get_entry_for_name(name) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/protk/swissprot_database.rb', line 27 def get_entry_for_name(name) result=@db_object.get_by_id(name) if result=="" return nil else Bio::SPTR.new(result) end end |