Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Juul committed Nov 22, 2011
0 parents commit 8ac4691
Show file tree
Hide file tree
Showing 308 changed files with 15,317 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*~
config/database.yml
config/settings.yml
config/unicorn.yml
.bundle
db/*.sqlite3
db/*.sqlite
log/*.log
tmp/
.sass-cache/
Gemfile.lock
test/*
data/*
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "r_scripts/fcs-analysis"]
path = r_scripts/fcs-analysis
url = git://github.com/BIOFAB/fcs-analysis.git
[submodule "java/libSBOLxml"]
path = java/libSBOLxml
url = git://github.com/SynBioDex/libSBOLxml.git
54 changes: 54 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
source 'http://rubygems.org'

gem 'rails', '3.1.0'

gem 'sqlite3'

gem 'activeadmin'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end

group :development do
gem 'rails-erd'
end

gem 'jquery-rails'

# Use unicorn as the web server
gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

gem 'execjs'
gem 'therubyracer'

gem 'sorcery' # access control

gem 'formtastic' # better forms

gem 'rjb' # ruby java bridge

gem 'thin' # better webserver than webrick

gem 'delayed_job' # queueing

gem 'pry' # nicer rails console

gem 'rsruby' # R interface

gem 'spreadsheet' # xls file output

gem 'zip' # required by roo
gem 'roo' # google docs import
174 changes: 174 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
== General information ==

This is the new BIOFAB web app for internal lab workflows as well as public access to BIOFAB part sequence, measurement, performance and reliability data.

It is implemented in Ruby on Rails 3.1

Currently it includes:

The BIOFAB data model (SQL and ORM).

Flow cytometer integration:
Import of data from FCS3 files.
Gating and clustering analysis (using R and BioConductor).
Queued background jobs for batch processing.
Email notification upon analysis completion/error.

Plate layout management and import from xlsx.

Plate data viewing:
View in browser with distribution plots.
Xls export of characterization and performance data.

Parts import from google docs.

SBOL parts export (work in progress).

Parts management (work in progress).

User signup and authentication.

== Installation instructions ==

These instructions have been tested on Ubuntu only and are a work in progress.

Install dependencies:
sudo aptitude install ruby-full openjdk-6-jdk openjdk-6-jre r-base r-base-dev

The openjdk packages are only needed if you want SBOL support. The R packages are only needed if you want flow cytometry data analysis support.

If you don't have aptitude, don't worry about it, just replace aptitude with apt-get in this document. Aptitude is the preferred over apt-get according to Debian GNU/Linux.

If you're running an older distro, you may want to manually get the newest version of rubygems [http://rubygems.org/ https://rubygems.org/pages/download], install it and create the following symlink:

cd /usr/bin
sudo ln -s gem1.8 gem

For newer distros you can just do:

sudo aptitude install rubygems

Install rails:

sudo gem install rails --no-rdoc --no-ri

Install rsruby (allows calling of R functions from ruby, only required if you want flow cytometry analysis support):

sudo gem install rsruby -- --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include

Start R as root:

sudo R

Use the R command line to install bioconductor packages (again, only required for flow cytometry analysis support):

source("http://bioconductor.org/biocLite.R")
biocLite("flowCore")
biocLite("flowClust")
biocLite("flowViz")

While still in the R command line, install RSvgDevice (for flow cytometry plot output support);

install.packages('RSvgDevice')

Exit the R command line by hitting ctrl+d and answering 'n' to the question.

Run these commands and put them at the end of your /etc/profile:

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export R_HOME=/usr/lib/R

Get the web app:

git clone git://github.com/Juul/biofab-web.git

Switch into the web app dir:

cd biofab-web/

Get submodules:

git submodule init
git submodule update

Get nested SBOL submodule:

cd java/libSBOLxml
git submodule init
git submodule update

Compile libSBOLxml jar

ant clean build jar

Compile libSBOLcore jar:

cd core/
ant clean build jar

Return to Rails root dir:

cd ../../../

Install gem dependencies:

sudo bundle install

Configure the database:

cp config/database.yml.example config/database.yml
chmod 600 config/database.yml

The example database.yml will cause the web app to use a locally stored sqlite database. You can edit the database.yml file if you want to use a different database, such as your existing postgresql or mysql database.

Configure the site:

cp config/settings.yml.example config/settings.yml

Edit this file to change e.g. hostname and default reply-to email address for the web app.

Initialize the database, creating the required tables:

rake db:migrate

The web app is now installed!

== Importing BIOFAB data ==

TODO writeme

== Usage ==

To start the web app, simply cd into the web app directory and run:

rails s thin

The web app is now accessible at http://localhost:3000/

Some processing, such as flow cytometer data analysis, take a long time and uses a background processor. To start the background processor run:

./script/delayed_job_nodaemon

To start the background processor as a daemon, run:

./script/delayed_job

An admin user with username admin and password admin will have been created.

An entity-relationship diagram for the database is in the ERD.pdf file. It can be regenerated from the current database by running:

./script/generate_er_diagram

A dump of the current schema is in db/schema.rb. It can be regenerated from the current database by running ./script/schema_dump.

== Production use ==

If you plan to run the web app in a production environment, there are a few things you need to know.

Per default, the web app will run in the development environment. This has a few advantages, such as showing nice readable errors with stack traces when something goes wrong, and caching very few files. For production, you should run the web app in the production environment. You probably also want to run it on port 80. For the thin webserver, this can be done like so:

rails s thin -p 80 -e production

You should take a look at using [https://github.com/blog/517-unicorn Unicorn] and [http://nginx.org/ nginx] in combination, since a single instance of the thin web server will likely not be adequate.

Make sure you aren't running the server as root. It's probably a good idea to create a separate rails user to run the server. Remember to change ownership of the appropriate files to the rails user.
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

BiofabWeb::Application.load_tasks
38 changes: 38 additions & 0 deletions app/admin/dashboards.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ActiveAdmin::Dashboards.build do

# Define your dashboard sections here. Each block will be
# rendered on the dashboard in the context of the view. So just
# return the content which you would like to display.

# == Simple Dashboard Section
# Here is an example of a simple dashboard section
#
# section "Recent Posts" do
# ul do
# Post.recent(5).collect do |post|
# li link_to(post.title, admin_post_path(post))
# end
# end
# end

# == Render Partial Section
# The block is rendered within the context of the view, so you can
# easily render a partial rather than build content in ruby.
#
# section "Recent Posts" do
# div do
# render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
# end
# end

# == Section Ordering
# The dashboard sections are ordered by a given priority from top left to
# bottom right. The default priority is 10. By giving a section numerically lower
# priority it will be sorted higher. For example:
#
# section "Recent Posts", :priority => 10
# section "Recent User", :priority => 1
#
# Will render the "Recent Users" then the "Recent Posts" sections on the dashboard.

end
Binary file added app/assets/images/rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/javascripts/active_admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require active_admin/base
Loading

0 comments on commit 8ac4691

Please sign in to comment.