Class: Bio::SRA::Connection

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/bio/sra/connect.rb

Class Method Summary collapse

Class Method Details

.connect(sra_metadb_path = File.join(File.dirname(__FILE__),'..','..','..','db','SRAmetadb.sqlite')) ⇒ Object

Connect to a metadata database.

  • sra_metadb_path: a path to the gunzipped SRAmetadb.sqlite file which is the database. By default this is in the db/ directory of this gem, but that probably isn’t where the db file is.

You can download the file like so:

$ wget http://watson.nci.nih.gov/~zhujack/SRAmetadb.sqlite.gz
# gunzip SRAmetadb.sqlite.gz


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bio/sra/connect.rb', line 18

def self.connect(sra_metadb_path=File.join(File.dirname(__FILE__),'..','..','..','db','SRAmetadb.sqlite'))
  log = Bio::Log::LoggerPlus['bio-sra']
  log.info "Attempting to connect to database #{sra_metadb_path}"
  
  # default:
    # adapter: sqlite3
    # database: db/SRAmetadb.sqlite
    # pool: 5
    # timeout: 5000
    
  options = {
    :adapter => 'sqlite3',
    :database => sra_metadb_path,
    :pool => 5,
    :timeout => 5000,
  }
  
  establish_connection(options)
end