Sha256: 221788319c4f19ce7674f967792d673ec13fd5f7deda503181180ba7e853cd79

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

#
# = AUTOMATIC Table Definition of GO (gene ontology)
# Copyright::   Copyright (C) 2011, 2012
#               MISHIMA, Hiroyuki
#               <missy at be.to / hmishima at nagasaki-u.ac.jp> 
# License::     The Ruby licence (Ryby's / GPLv2 dual)
#

require "#{::File.dirname(__FILE__)}/table_class_detector"

module Bio
  module Ucsc
    module Go
      extend TableClassDetector

      def self.default
        DBConnection.default
      end

      def self.connect(param = Hash.new)
        DBConnection.db_adapter = param[:db_adapter] if param[:db_adapter]
        DBConnection.db_host = param[:db_host] if param[:db_host]
        DBConnection.db_username = param[:db_username] if param[:db_username]
        DBConnection.password = param[:password] if param[:password]
        DBConnection.connect
      end

      class DBConnection < ActiveRecord::Base
        include SafeAttributes

        @@db_adapter  ||= 'mysql'
        @@db_host     ||= 'genome-mysql.cse.ucsc.edu'
        @@db_username ||= 'genome'
        @@db_password ||= ''
        @@db_name     ||= 'go'

        cattr_accessor :db_adapter, :db_host, :db_username, :db_password

        self.abstract_class = true

        def self.default
          @@db_adapter  = 'mysql'
          @@db_host     = 'genome-mysql.cse.ucsc.edu'
          @@db_username = 'genome'
          @@db_password = ''
        end

        def self.connect
          establish_connection({ :adapter =>  @@db_adapter,
                                 :host =>     @@db_host,
                                 :database => @@db_name,
                                 :username => @@db_username,
                                 :password => @@db_password, })
        end
      end # class DBConnection
    end # module Go
    
  end # module Ucsc
end # moduel Bio

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bio-ucsc-api-0.6.3 lib/bio-ucsc/go.rb
bio-ucsc-api-0.6.2 lib/bio-ucsc/go.rb
bio-ucsc-api-0.6.1 lib/bio-ucsc/go.rb
bio-ucsc-api-0.6.0 lib/bio-ucsc/go.rb
bio-ucsc-api-0.5.3 lib/bio-ucsc/go.rb
bio-ucsc-api-0.5.2 lib/bio-ucsc/go.rb
bio-ucsc-api-0.5.1 lib/bio-ucsc/go.rb
bio-ucsc-api-0.5.0 lib/bio-ucsc/go.rb