class Database

Database

Creates a DSL for defining Databases which can be downloaded using ‘pipet pull`

Public Class Methods

all() click to toggle source

Returns a list of all objects that inherited from Database

# File lib/database.rb, line 7
def all
  ObjectSpace.each_object(Class).select { |klass| klass < self }
end
description(val=nil) click to toggle source

Provide a description for the database

# File lib/database_dsl.rb, line 29
def description(val=nil)
  @description ||= val
end
md5(val=nil) click to toggle source

Specify MD5 checksum of database

# File lib/database_dsl.rb, line 22
def md5(val=nil)
  @md5 ||= val
end
name(val=nil) click to toggle source

Name the database. This is used be ‘pipet pull`

# File lib/database_dsl.rb, line 36
def name(val=nil)
  @name ||= val
end
pull() click to toggle source

Downloads the database, checks the MD5 sum.

# File lib/database_dsl.rb, line 74
def pull
  `wget #{@url}`
end
type(val=nil) click to toggle source

Define type of database. This is like a tag. For example,

type :nucleotide for a database of nucleotide sequences

type :structure for a database of protein structures

# File lib/database_dsl.rb, line 50
def type(val=nil)
  @type ||= val
end
url(url=nil) click to toggle source

Specify the URL of a database

# File lib/database_dsl.rb, line 15
def url(url=nil)
  @url ||= url
end
validate() click to toggle source

Make sure all required attributes have been defined.

# File lib/database_dsl.rb, line 57
def validate
  required_attributes = [
    :name,
    :md5,
    :description,
    :type
  ]

  required_attributes.map do |ra|
    self.send(ra)
  end.include? nil

end