Class: Bio::SQL
- Inherits:
-
Object
show all
- Defined in:
- lib/bio/io/sql.rb,
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
Class Method Details
.delete_entry_accession(accession) ⇒ Object
73
74
75
|
# File 'lib/bio/io/sql.rb', line 73
def self.delete_entry_accession(accession)
Bio::SQL::Bioentry.find_by_accession(accession.upcase).destroy!
end
|
.delete_entry_id(id) ⇒ Object
69
70
71
|
# File 'lib/bio/io/sql.rb', line 69
def self.delete_entry_id(id)
Bio::SQL::Bioentry.delete(id)
end
|
.establish_connection(configurations, env) ⇒ Object
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)
DummyBase.configurations = configurations
connection = DummyBase.establish_connection "#{env}"
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
|
.exists_accession(accession) ⇒ Object
47
48
49
50
|
# File 'lib/bio/io/sql.rb', line 47
def self.exists_accession(accession)
!Bio::SQL::Bioentry.find_by_accession(accession.upcase).nil?
end
|
.exists_database(name) ⇒ Object
52
53
54
55
|
# File 'lib/bio/io/sql.rb', line 52
def self.exists_database(name)
!Bio::SQL::Biodatabase.first(:name=>name).nil?
end
|
.fetch_accession(accession) ⇒ Object
42
43
44
45
|
# File 'lib/bio/io/sql.rb', line 42
def self.fetch_accession(accession)
Bio::SQL::Sequence.new(:entry=>Bio::SQL::Bioentry.find_by_accession(accession.upcase))
end
|
.fetch_id(id) ⇒ Object
38
39
40
|
# File 'lib/bio/io/sql.rb', line 38
def self.fetch_id(id)
Bio::SQL::Bioentry.find(id)
end
|
.list_databases ⇒ Object
63
64
65
66
67
|
# File 'lib/bio/io/sql.rb', line 63
def self.list_databases
Bio::SQL::Biodatabase.all.collect do|entry|
{:id=>entry.biodatabase_id, :name => entry.name}
end
end
|
.list_entries ⇒ Object
57
58
59
60
61
|
# File 'lib/bio/io/sql.rb', line 57
def self.list_entries
Bio::SQL::Bioentry.all.collect do|entry|
{:id=>entry.bioentry_id, :accession=>entry.accession}
end
end
|