Class: Biomart::Database

Inherits:
Object
  • Object
show all
Includes:
Biomart
Defined in:
lib/biomart/database.rb

Overview

Class representation for a biomart database. Will contain many Biomart::Dataset objects, and belong to a Biomart::Server.

Constant Summary

Constants included from Biomart

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Biomart

#request

Constructor Details

#initialize(url, args) ⇒ Database



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/biomart/database.rb', line 9

def initialize( url, args )
  @url = url or raise ArgumentError, "must pass :url"
  unless @url =~ /martservice/
    @url = @url + "/martservice"
  end
  
  @name         = args["name"] || args[:name]
  @display_name = args["displayName"] || args[:display_name]
  @visible      = ( args["visible"] || args[:visible] ) ? true : false
  @datasets     = {}
end

Instance Attribute Details

#display_nameObject (readonly)

Returns the value of attribute display_name.



7
8
9
# File 'lib/biomart/database.rb', line 7

def display_name
  @display_name
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/biomart/database.rb', line 7

def name
  @name
end

#visibleObject (readonly)

Returns the value of attribute visible.



7
8
9
# File 'lib/biomart/database.rb', line 7

def visible
  @visible
end

Instance Method Details

#datasetsHash

Returns a hash (keyed by the biomart ‘name’ for the dataset) of all of the Biomart::Dataset objects belonging to this server.



36
37
38
39
40
41
# File 'lib/biomart/database.rb', line 36

def datasets
  if @datasets.empty?
    fetch_datasets
  end
  return @datasets
end

#list_datasetsArray

Returns an array of the dataset names (biomart ‘name’) for this dataset.



25
26
27
28
29
30
# File 'lib/biomart/database.rb', line 25

def list_datasets
  if @datasets.empty?
    fetch_datasets
  end
  return @datasets.keys
end

#visible?Boolean

Returns true / false if this database is visbile in the default MartView interface.



47
48
49
# File 'lib/biomart/database.rb', line 47

def visible?
  @visible
end