[BioRuby] bioruby as a rails plugin.

Toshiaki Katayama ktym at hgc.jp
Tue Oct 23 03:27:20 UTC 2007


Hi George,

On 2007/10/23, at 7:08, George wrote:
> Hi all,
> I have a rails project in which i need to access the bioruby library.
> Currently, i have just done a require 'bio' in the environment.rb

I think this is the right way.

> However i had a rumor that bioruby is possible as a rails plugin. and on 
> checking from
> http://rubyforge.org/pm/task.php?func=detailtask&project_task_id=820&group_id=769&group_project_id=194
> I found that the implementation is a 100% complete.

I have implemented a Rails generator for BioRuby shell and it is
bundled in the BioRuby v1.1.0 release.

It is called "BioRuby shell", and the "bioruby" command can be used as
a better replacement for the "script/console", and if you use "--rails"
option, it will generate a web interface and acts as a replacement for
the "script/server".

The strength of the bioruby command is that it can store your command line
history and objects across the sessions.

This functionality is generally applicable for any rails application,
and not necessary to be prefixed with bio-, but as a historical reason,
and I can't spare enough time for refactoring, it remains as it was born.

You can invoke it as

  % bioruby --rails foo

or on top of the existing rails app as

  % rails bar
  % bioruby --rails bar

This will create 'data' and 'shell' directories in addition to the
rails defaults, and installs bioruby_controller, related views,
stylesheets and icons for the following functionality.

Then you can access to http://localhost:3000/bioruby/ where
you can type in any Ruby code including BioRuby shell commands to execute.

For example,

  cdc28 = getent("uniprot:CDC28_YEAST")
  genes = keggapi.get_genes_by_pathway("path:hsa00010")

You can use all Bio::* classes in BioRuby as well.

  seq = Bio::Sequence::NA.new("atgc" * 10).randomize
  seq.translate

You can also use your Rails models as in script/console.

  user = User.find(:first)
  user.name

The goal of this interface is to make it as a front end of
the workflow of the bioinformatics analysis.

For example,
  1) find a specific gene, select orthologs, alignment,
     build trees, visualize it with ape in R thorough RSruby.
  2) load expression profiles, map to KEGG, generate sub graphs,
     rendering it in Cytoscape.
  3) ...


More work should be done:
  * prettier rendering of various kind of objects including images
  * auto complementation of the variables, methods and services
  * integrating more web services, applications


Here is a snippet from a changelog of 2007-06-08

http://cvs.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi/bioruby/ChangeLog?rev=1.68&cvsroot=bioruby&content-type=text/vnd.viewcvs-markup

	  If --rails (-r) option is applied, 'bioruby' command will run in
	  the Rails server mode, and the server will start in the :savedir.

	  (A) IRB mode

	  1. run in the current directory and the session will be saved
	     in the ~/.bioruby directory

	       % bioruby

	  2. run in the current directory and the session will be saved
	     in the foo/bar directory

	       % bioruby foo/bar

	  3. run in the current directory and the session will be saved
	     in the /tmp/foo/bar directory

	       % bioruby /tmp/foo/bar

	  (B) Rails mode

	  4. run in the ~/.bioruby directory and the session will also be saved
	     in the ~/.bioruby directory

	       % bioruby -r

	  5. run in the foo/bar directory and the session will also be saved
	     in the foo/bar directory

	       % bioruby -r foo/bar

	  6. run in the /tmp/foo/bar directory and the session will also be
	     saved in the /tmp/foo/bar directory

	       % bioruby -r /tmp/foo/bar

	  (C) Script mode

	  7. run in the current directory using the session saved
	     in the ~/.bioruby directory

	       % bioruby ~/.bioruby/shell/script.rb

	  8. run in the current directory using the session saved
	     in the foo/bar directory

	       % bioruby foo/bar/shell/script.rb

	  9. run in the current directory using the session saved
	     in the /tmp/foo/bar directory

	       % bioruby /tmp/foo/bar/shell/script.rb





More information about the BioRuby mailing list