ActiveUnimod

ActiveRecord models for the Unimod database.

Description

ActiveUnimod is a generator gem containing ActiveRecord models and database migrations to setup and utilize the Unimod database. The ActiveUnimod models implement associations as documented in the unimod schema.

ActiveUnimod is a part of the BioActive project and is not a part of Unimod itself.

Features/Problems

  • ActiveUnimod can be used to generate models within a rails project, or programatically as a gem.

  • ActiveUnimod includes tasks to update a local database using the web-available data.

  • Several associations could not be implemented cleanly because they join tables based on fields other than the primary key. (ex: the associations based on bricks.brick)

Installation

ActiveUnimod is available as a gem on RubyForge. Use:

% gem install active_unimod_generator

Generator Usage

Use like any other generator gem:

% script/generate active_unimod

Migrate in the Unimod tables as normal:

% rake db:migrate

Update the data in the database:

% rake active_unimod:database:update

Usage

require 'active_unimod'
# establish a connection... for instance using sqlite (see below)
ActiveRecord::Base.establish_connection(
  :adapter => 'sqlite3',
  :database => 'unimod')
# update the database if needed
require 'active_unimod/database'
ActiveUnimod::Database.create_tables
ActiveUnimod::Database.update_from_web
# now use the models
Classification.find_by_classification("Other glycosylation").modifications.collect do |m| 
  m.full_name
end.uniq
# => ["Hexose",
#        "N-Acetylhexosamine",
#        "N-acetylglucosamine-1-phosphoryl",
#        "phosphoglycosyl-D-mannose-1-phosphoryl",
#        "ADP  Ribose addition",
#        "Lactosylation",
#        "propyl-1,2-dideoxy-2\\'-methyl-alpha-D-glucopyranoso-[2,1-d]-Delta2\\'-thiazoline"]

Info

Copyright © 2006-2007, Regents of the University of Colorado.

Developer

Simon Chiang, Biomolecular Structure Program, Hansen Lab

Support

CU Denver School of Medicine Deans Academic Enrichment Fund

Licence

MIT-Style

SQLite installation

ActiveRecord can connect to a wide variety of databases. SQLite is used in the examples because it is the easiest to get running. Here are the basic installation instructions.

Install the binaries

On Mac OSX/Unix, sqlite3 is usually pre-installed. Try calling sqlite3 from a command prompt to check (see below). If it isn’t installed, check the sqlite website for installation instructions.

On Windows: # Download the sqlite3 command line program and .dll from the

{downloads page}[http://www.sqlite.org/download.html].  They 
 will be named like sqlite-3_version.zip and sqlitedll-3_version.zip 
 respectively.

# Extract/copy these files (sqlite3.exe and sqlite3.dll) into C:rubybin,

or the bin directory of wherever you installed ruby.

Now you should be able to access sqlite3 from a command prompt:

% sqlite3
SQLite version 3.[version]
Enter ".help" for instructions
sqlite>

Install the ruby bindings

% gem install sqlite3-ruby

And that’s it!