Class: PlasmoDB

Inherits:
Object
  • Object
show all
Defined in:
lib/protk/plasmodb.rb

Overview

Provides fast indexed access to a swissprot database in a flat .dat file

Instance Method Summary collapse

Constructor Details

#initialize(env = nil) ⇒ PlasmoDB

Returns a new instance of PlasmoDB.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/protk/plasmodb.rb', line 10

def initialize(env=nil)
  if ( env!=nil)
    @genv=env
  else
    @genv=Constants.instance
  end

  database_file="#{@genv.protein_database_root}/#{@genv.plasmodb_annotation_database}/raw.txt"

  throw "The plasmodb database at \"#{database_file}\" does not exist"  if ( database_file==nil || !FileTest.exist?(database_file) )

  @db_object=EuPathDBGeneInformationFileExtractor.new(database_file)

end

Instance Method Details

#get_entry_for_name(name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/protk/plasmodb.rb', line 26

def get_entry_for_name(name)
  
  @genv.log("Getting entry for #{name}",:info)
  
  begin
    result=nil 
    result=@db_object.extract_gene_info(name,10000)
    
  rescue
    
    
    if result==nil
      if ( @genv!=nil)
        @genv.log("Failed to find PlasmoDB entry for gene named #{name} in database",:warn)
      end
    end
    
    
    return result
  end
    
    
end