Class | Bio::SQL |
In: |
lib/bio/db/biosql/sequence.rb
lib/bio/io/biosql/ar-biosql.rb lib/bio/io/biosql/biosql.rb lib/bio/io/sql.rb |
Parent: | Object |
# File lib/bio/io/sql.rb, line 73 73: def self.delete_entry_accession(accession) 74: Bio::SQL::Bioentry.find_by_accession(accession.upcase).destroy! 75: end
# File lib/bio/io/sql.rb, line 69 69: def self.delete_entry_id(id) 70: Bio::SQL::Bioentry.delete(id) 71: end
no check is made
# File lib/bio/io/biosql/biosql.rb, line 23 23: def self.establish_connection(configurations, env) 24: # #configurations is an hash similar what YAML returns. 25: 26: #configurations.assert_valid_keys('development', 'production','test') 27: #configurations[env].assert_valid_keys('hostname','database','adapter','username','password') 28: DummyBase.configurations = configurations 29: connection = DummyBase.establish_connection "#{env}" 30: #Init of basis terms and ontologies 31: Ontology.first(:conditions => ["name = ?", 'Annotation Tags']) || Ontology.create({:name => 'Annotation Tags'}) 32: Ontology.first(:conditions => ["name = ?", 'SeqFeature Keys']) || Ontology.create({:name => 'SeqFeature Keys'}) 33: Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources']) ||Ontology.create({:name => 'SeqFeature Sources'}) 34: Term.first(:conditions => ["name = ?", 'EMBLGenBankSwit']) || Term.create({:name => 'EMBLGenBankSwit', :ontology => Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources'])}) 35: connection 36: end
# File lib/bio/io/sql.rb, line 47 47: def self.exists_accession(accession) 48: # Bio::SQL::Bioentry.find_by_accession(accession.upcase).nil? ? false : true 49: !Bio::SQL::Bioentry.find_by_accession(accession.upcase).nil? 50: end
# File lib/bio/io/sql.rb, line 52 52: def self.exists_database(name) 53: # Bio::SQL::Biodatabase.find_by_name(name).nil? ? false : true 54: !Bio::SQL::Biodatabase.first(:name=>name).nil? 55: end
# File lib/bio/io/sql.rb, line 42 42: def self.fetch_accession(accession) 43: # Bio::SQL::Bioentry.exists?(:accession => accession) ? Bio::SQL::Sequence.new(:entry=>Bio::SQL::Bioentry.find_by_accession(accession)) : nil 44: Bio::SQL::Sequence.new(:entry=>Bio::SQL::Bioentry.find_by_accession(accession.upcase)) 45: end
# File lib/bio/io/sql.rb, line 63 63: def self.list_databases 64: Bio::SQL::Biodatabase.all.collect do|entry| 65: {:id=>entry.biodatabase_id, :name => entry.name} 66: end 67: end