Class: Bio::SQL
- Inherits:
-
Object
- Object
- Bio::SQL
- Defined in:
- lib/bio/io/biosql/biosql.rb,
lib/bio/db/biosql/sequence.rb,
lib/bio/io/biosql/ar-biosql.rb
Defined Under Namespace
Classes: Biodatabase, Bioentry, BioentryDbxref, BioentryPath, BioentryQualifierValue, BioentryReference, BioentryRelationship, Biosequence, Comment, Dbxref, DbxrefQualifierValue, DummyBase, Location, LocationQualifierValue, Ontology, Reference, Seqfeature, SeqfeatureDbxref, SeqfeaturePath, SeqfeatureQualifierValue, SeqfeatureRelationship, Sequence, Taxon, TaxonName, Term, TermDbxref, TermPath, TermRelationship, TermRelationshipTerm, TermSynonym
Class Method Summary collapse
-
.establish_connection(configurations, env) ⇒ Object
#no check is made.
Class Method Details
.establish_connection(configurations, env) ⇒ Object
#no check is made
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bio/io/biosql/biosql.rb', line 23 def self.establish_connection(configurations, env) # #configurations is an hash similar what YAML returns. #configurations.assert_valid_keys('development', 'production','test') #configurations[env].assert_valid_keys('hostname','database','adapter','username','password') DummyBase.configurations = configurations connection = DummyBase.establish_connection "#{env}" #Init of basis terms and ontologies Ontology.first(:conditions => ["name = ?", 'Annotation Tags']) || Ontology.create({:name => 'Annotation Tags'}) Ontology.first(:conditions => ["name = ?", 'SeqFeature Keys']) || Ontology.create({:name => 'SeqFeature Keys'}) Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources']) ||Ontology.create({:name => 'SeqFeature Sources'}) Term.first(:conditions => ["name = ?", 'EMBLGenBankSwit']) || Term.create({:name => 'EMBLGenBankSwit', :ontology => Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources'])}) connection end |