Class: Ensembl::Core::Marker

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

Overview

The Marker class provides an interface to the marker table. This table contains primer sequences and PCR product lengths.

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:

marker = Marker.find(52194)
puts marker.left_primer
puts marker.right_primer
puts marker.min_primer_dist.to_s

Class Method Summary collapse

Instance 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_name(name) ⇒ Array

The Marker#find_all_by_name class method returns all markers with this name. If no marker is found, it returns an empty array.

Returns:

  • (Array)

    Empty array or array of Marker objects



853
854
855
856
857
858
859
860
861
# File 'lib/bio-ensembl/core/activerecord.rb', line 853

def self.find_all_by_name(name)
	marker_synonyms = Ensembl::Core::MarkerSynonym.find_all_by_name(name)
  answers = Array.new
	marker_synonyms.each do |ms|
    answers.push(Ensembl::Core::Marker.find_all_by_marker_id(ms.marker_id))
  end
	answers.flatten!
  return answers
end

.find_by_name(name) ⇒ Marker?

The Marker#find_by_name class method returns one marker with this name.

Returns:

  • (Marker, nil)

    Marker object or nil



840
841
842
843
844
845
846
847
# File 'lib/bio-ensembl/core/activerecord.rb', line 840

def self.find_by_name(name)
  all_names = self.find_all_by_name(name)
  if all_names.length == 0
    return nil
  else
    return all_names[0]
  end
end

.inheritance_columnObject



823
824
825
# File 'lib/bio-ensembl/core/activerecord.rb', line 823

def self.inheritance_column
  nil
end

Instance Method Details

#nameObject

The Marker#name method returns a comma-separated list of synonyms of this marker

Examples:

marker = Marker.find(1)
puts marker.name    --> 58017,D29149


833
834
835
# File 'lib/bio-ensembl/core/activerecord.rb', line 833

def name
	self.marker_synonyms.collect{|ms| ms.name}.join(',')
end