Class: Ensembl::Core::ExternalDb

Inherits:
DBConnection show all
Defined in:
lib/bio-ensembl/core/activerecord.rb

Overview

The ExternalDb class provides an interface to the external_db table. This table contains references to databases to which xrefs can point to

This class uses ActiveRecord to access data in the Ensembl database. See the general documentation of the Ensembl module for more information on what this means and what methods are available.

Examples:

embl_db = ExternalDb.find_by_db_name('EMBL')
puts embl_db.xrefs.length.to_s

Class Method Summary collapse

Methods inherited from DBConnection

connect, ensemblgenomes_connect

Methods inherited from DBRegistry::Base

generic_connect, get_info, get_name_from_db

Class Method Details

.find_all_by_display_label(label) ⇒ Object

The ExternalDb#find_all_by_display_label method returns all external databases that have this label. There should normally be no more than one. If no databases are found with this name, this method returns an empty array.



1544
1545
1546
1547
1548
1549
1550
1551
1552
# File 'lib/bio-ensembl/core/activerecord.rb', line 1544

def self.find_all_by_display_label(label)
	answer = Array.new
  xrefs = Xref.find_all_by_display_label(label)
	xrefs.each do |xref|
    answer.push(self.class.find_by_xref_id(xref.xref_id))
  end

  return answer
end

.find_by_display_label(label) ⇒ Object

The ExternalDb#find_by_display_label method returns a database that has this label. If no databases are found with this name, this method returns nil. empty array.



1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/bio-ensembl/core/activerecord.rb', line 1558

def self.find_by_display_label(label)
  all_dbs = self.find_all_by_display_label(label)
  if all_dbs.length == 0
    return nil
  else
    return all_dbs[0]
  end
end

.inheritance_columnObject



1536
1537
1538
# File 'lib/bio-ensembl/core/activerecord.rb', line 1536

def self.inheritance_column
  nil
end