Class: Ensembl::Core::ExternalDb

Inherits:
DBConnection
  • Object
show all
Defined in:
lib/ensembl/core/activerecord.rb

Overview

DESCRIPTION

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.

USAGE

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

Class Method Summary collapse

Methods inherited from DBConnection

connect

Class Method Details

.find_all_by_display_label(label) ⇒ Object

DESCRIPTION

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.



1567
1568
1569
1570
1571
1572
1573
1574
1575
# File 'lib/ensembl/core/activerecord.rb', line 1567

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

DESCRIPTION

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.



1582
1583
1584
1585
1586
1587
1588
1589
# File 'lib/ensembl/core/activerecord.rb', line 1582

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



1558
1559
1560
# File 'lib/ensembl/core/activerecord.rb', line 1558

def self.inheritance_column
  nil
end