BioRuby
BioRuby is a collection of open-source Ruby code, comprising classes for computational molecular biology and bioinformatics. It contains classes for DNA and protein sequence analysis, sequence alignment, biological database parsing, structural biology and other bioinformatics tasks.
BioRuby is released under the GNU GPL version 2 or Ruby licence and is one of a number of Bio* projects, designed to reduce code duplication.
In 2011, the BioRuby project introduced the Biogem software plugin system and are listed on , with two or three new plugins added every month.
BioRuby is managed via the website and .
History
BioRuby
The BioRuby project was first started in 2000 by Toshiaki Katayama as a Ruby implementation of similar bioinformatics packages such as BioPerl and BioPython. The initial release of version 0.1 has been frequently updated by contributors both informally and at organised “hackathon” events, with the most recent release of version 1.4.3.0001 in May 2013.In June 2005, BioRuby was funded by IPA as an Exploratory Software Project, culminating with the release of version 1.0.0 in February 2006.
BioRuby has been the focus of a number of Google Summer of Code projects, including;
- 2009:
- 2010:
- 2010:
- 2011:
- 2012:
Version history
- 0.7.0 December 18, 2005
- 1.0.0 February 26, 2006
- 1.4.3.0001 May 24, 2013
Installation
BioRuby is able to be installed onto any instance of Ruby; as Ruby is a highly cross platform language, BioRuby is available on most modern operating systems.It is required that Ruby be installed prior to BioRuby installation.
Installation of BioRuby
macOS/Unix/Linux
macOS has Ruby and RubyGems installed by default and for Unix/Linux installation of RubyGems is recommended.If Ruby and RubyGems are installed, BioRuby can be installed using this command via the terminal;
% sudo gem install bio
If you need to install from the source code distribution, obtain the latest package from the and in the bioruby source directory, run the following commands;
% su
- ruby setup.rb
Windows
Installation via RubyGems is highly recommended; this requires Ruby and RubyGems be installed, then the following command run at the command prompt;> gem install bio
Usage
BioRuby can be accessed via the terminal, Ruby IDEs or via a BioRubyOnRails implementation. Instructions for the installation and use of BioRubyOnRails can be found at .Basic Syntax
The following are examples of basic sequence manipulations using BioRuby. You can find more syntax examples at .https://web.archive.org/web/20140911100526/http://bioruby.open-bio.org/wiki/SampleCodes#Basic_Sequence_Manipulation Basic Sequence Manipulation
String to Bio::Sequence object
Parsing a string into Bio::Sequence object.- !/usr/bin/env ruby
- create a DNA sequence object from a String
- create an RNA sequence object from a String
- create a Protein sequence from a String
- you can check if the sequence contains illegal characters
- that is not an accepted IUB character for that symbol
- translate and concatenate a DNA sequence to Protein sequence
puts newseq # => "AGFAVENDSAIGRL"
Bio::Sequence object to String
This an example that showcases the simplicity of BioRuby. It does not require any method call to convert the sequence object to a string.Parsing a sequence object into a string.
- you can use Bio::Sequence object as a String object to print, seamlessly
puts dna # => "atgc"
str = dna.to_s
puts str # => "atgc"
https://web.archive.org/web/20140911100526/http://bioruby.open-bio.org/wiki/SampleCodes#Translation Translation
Translating a DNA or RNA sequence or SymbolList to orotein
There is no need to convert DNA sequence to RNA sequence or vice versa before its translation in BioRuby. You can simply call a translate method for Bio::Sequence::NA object.require 'bio'
- create a DNA sequence
- translate to protein
- prove that it worked
puts prot # => "MAIE*"
Translating a single codon to a single amino acid
The general translation example shows how to use the translate method of Bio::Sequence::NA object but most of what goes on is hidden behind the convenience method. If you only want to translate a single codon into a single amino acid you get exposed to a bit more of the gory detail but you also get a chance to figure out more of what is going on under the hood.require 'bio'
- make a 'codon'
- you can translate the codon as described in the previous section.
Another way to do this is the following
require 'bio'
- make a 'codon'
- select the standard codon table
- You need to convert RNA codon to DNA alphabets because the
- CodonTable in BioRuby is implemented as a static Hash with keys
- expressed in DNA alphabets.
- get the representation of that codon and translate to amino acid.
puts amino_acid # => "L"
https://web.archive.org/web/20140911100526/http://bioruby.open-bio.org/wiki/SampleCodes#Sequence_I.2FO Sequence I/O
Writing sequences in Fasta format
To print out any Bio::Sequence object in FASTA format, All you need is to call is "puts objectName.is_fasta"require 'bio'
- Generates a sample 100bp sequence.
- Naming this sequence as "testseq" and print in FASTA format
- .
Reading in a Fasta file
This program opens FASTA format file for reading and iterates on each sequence in the file.require 'bio'
file = Bio::FastaFormat.open
file.each do |entry|
- do something on each fasta sequence entry
This program automatically detects and reads FASTA format files given as its arguments.
require 'bio'
Bio::FlatFile.auto do |ff|
ff.each do |entry|
# do something on each fasta sequence entry
end
end
Similar but specify FASTA format explicitly.
require 'bio'
Bio::FlatFile.open do |ff|
ff.each do |entry|
# do something on each fasta sequence entry
end
end
See more syntax examples on
Classes and modules
Major classes
The below classes have been identified by a group of major code contributors as major classes.Basic data structure
These classes allow you to natively store complicated biological data structure effectively.Class names | Description |
, | Nucleic and amino acid sequences |
, | Locations / Annotations |
, | Literatures |
, Bio::Relation | Graphs |
Alignments |
Databases and sequence file formats
Accesses online biological databases and reads from common file-formats.Class names | Description |
, | GenBank / EMBL |
, , | SwissProt and TrEMBL / PIR / PDB |
FANTOM DB | |
KEGG database parsers | |
, | Bio::PROSITE FASTA format / PROSITE motifs |
, | FASTA format / PROSITE motifs |
Wrapper and parsers for bioinformatics tool
These classes allow for easy access to commonly used bioinformatics tools.Class names | Description |
, , | Sequence similarity |
, | Multiple sequence alignment |
, | Protein subcellular localization |
, | Transmembrane helix prediction |
Gene finding |
File, network and database I/O
A full list of classes and modules can be found at .Biogem
Biogem provides a set of tools for bioinformaticians who want to code an application or library that uses or extends BioRuby's core library, as well as share the code as a gem on . Any gem published via the Biogem framework is also listed at .The aim of Biogem is to promote a modular approach to the BioRuby package and simplify the creation of modules by automating process of setting up directory/file scaffolding, a git repository and releasing online package databases.
Biogem makes use of github.com and rubygems.org and requires the setup of unique accounts on these websites.
Popular Biogems
Plugins
BioRuby will have a completed plugin system at the 1.5 release.BioRuby
-
Ruby/bioinformatics links
-
Sister projects
- The Open Bioinformatics Foundation
- BioPerl
- BioPython
- BioJava
- BioJS
-
Blogs
- Saaien Tist - http://saaientist.blogspot.com.au/
- "aac".translate # => "N" - http://bioruby.g.hatena.ne.jp/nakao_mitsuteru/
- BioRelated - http://biorelated.wordpress.com/category/bioruby/