Class | Bio::SQL
In: | lib/bio/db/biosql/sequence.rb lib/bio/io/sql.rb lib/bio/io/biosql/biosql.rb lib/bio/io/biosql/ar-biosql.rb
Parent: | Object

### Methods

delete_entry_accession delete_entry_id establish_connection exists_accession exists_database fetch_accession fetch_id list_databases list_entries

### Classes and Modules

Class Bio::SQL::Biodatabase
Class Bio::SQL::Bioentry
Class Bio::SQL::BioentryDbxref
Class Bio::SQL::BioentryPath
Class Bio::SQL::BioentryQualifierValue
Class Bio::SQL::BioentryReference
Class Bio::SQL::BioentryRelationship
Class Bio::SQL::Biosequence
Class Bio::SQL::Comment
Class Bio::SQL::Dbxref
Class Bio::SQL::DbxrefQualifierValue
Class Bio::SQL::DummyBase
Class Bio::SQL::Location
Class Bio::SQL::LocationQualifierValue
Class Bio::SQL::Ontology
Class Bio::SQL::Reference
Class Bio::SQL::Seqfeature
Class Bio::SQL::SeqfeatureDbxref
Class Bio::SQL::SeqfeaturePath
Class Bio::SQL::SeqfeatureQualifierValue
Class Bio::SQL::SeqfeatureRelationship
Class Bio::SQL::Sequence
Class Bio::SQL::Taxon
Class Bio::SQL::TaxonName
Class Bio::SQL::Term
Class Bio::SQL::TermDbxref
Class Bio::SQL::TermPath
Class Bio::SQL::TermRelationship
Class Bio::SQL::TermRelationshipTerm
Class Bio::SQL::TermSynonym

### Public Class methods

delete_entry_accession(accession)

[Source]

        # 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

delete_entry_id(id)

[Source]

        # File lib/bio/io/sql.rb, line 69
    69:     def self.delete_entry_id(id)
    70:       Bio::SQL::Bioentry.delete(id)
    71:     end

establish_connection(configurations, env)

no check is made

[Source]

        # 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

exists_accession(accession)

[Source]

        # 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

exists_database(name)

[Source]

        # 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

fetch_accession(accession)

[Source]

        # 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

fetch_id(id)

[Source]

        # File lib/bio/io/sql.rb, line 38
    38:     def self.fetch_id(id)
    39:       Bio::SQL::Bioentry.find(id)
    40:     end

list_databases()

[Source]

        # 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

list_entries()

[Source]

        # File lib/bio/io/sql.rb, line 57
    57:     def self.list_entries
    58:       Bio::SQL::Bioentry.all.collect do|entry|
    59:         {:id=>entry.bioentry_id, :accession=>entry.accession}
    60:       end
    61:     end

[Validate]