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.[1]

BioRuby
A BioRuby shell on Rails
Stable release
1.5.2 / 19 November 2018 (2018-11-19)
Repository
Written inRuby
TypeBioinformatics
LicenseGPL
Websitebioruby.open-bio.org

BioRuby is released under the GNU GPL version 2 or Ruby licence[2] and is one of a number of Bio* projects, designed to reduce code duplication.[3]

In 2011, the BioRuby project introduced the Biogem software plugin system[4] and are listed on biogems.info, with two or three new plugins added every month.

BioRuby is managed via the bioruby.org website and BioRuby GitHub repository.

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.[5]

In June 2005, BioRuby was funded by IPA as an Exploratory Software Project,[6] culminating with the release of version 1.0.0 in February 2006.[7]

BioRuby has been the focus of a number of Google Summer of Code projects, including;

Version history[8]

  • 0.7.0 December 18, 2005 (438 KB)
  • 1.0.0 February 26, 2006 (528 KB)
  • 1.4.3.0001 May 24, 2013 (1.42 MB)

The above list of releases is abbreviated; the full list can be found here.

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.[9]

It is required that Ruby be installed prior to BioRuby installation.

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 archive 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 bioruby.open-bio.org/wiki/BioRubyOnRails.

Basic Syntax[10]

The following are examples of basic sequence manipulations using BioRuby. You can find more syntax examples at bioruby.open-bio.org/wiki/SampleCodes#.

String to Bio::Sequence object

Parsing a string into Bio::Sequence object.

#!/usr/bin/env ruby
require 'bio'

# create a DNA sequence object from a String
dna = Bio::Sequence::NA.new("atcggtcggctta")

# create an RNA sequence object from a String
rna = Bio::Sequence::NA.new("auugccuacauaggc")

# create a Protein sequence from a String
aa = Bio::Sequence::AA.new("AGFAVENDSA")
 
# you can check if the sequence contains illegal characters
# that is not an accepted IUB character for that symbol
# (should prepare a Bio::Sequence::AA#illegal_symbols method also)
puts dna.illegal_bases

# translate and concatenate a DNA sequence to Protein sequence
newseq = aa + dna.translate
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.

#!/usr/bin/env ruby
 
# you can use Bio::Sequence object as a String object to print, seamlessly
dna = Bio::Sequence::NA.new("atgc")
puts dna        # => "atgc"
str = dna.to_s
puts str        # => "atgc"

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.

#!/usr/bin/env ruby

require 'bio'

# create a DNA sequence
seq = Bio::Sequence::NA.new("atggccattgaatga")
 
# translate to protein
prot = seq.translate
 
# prove that it worked
puts seq   # => "atggccattgaatga"
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.

#!/usr/bin/env ruby
 
require 'bio'
 
# make a 'codon'
codon = Bio::Sequence::NA.new("uug")
 
# you can translate the codon as described in the previous section.
puts codon.translate  # => "L"

Another way to do this is the following

#!/usr/bin/env ruby
 
require 'bio'
 
# make a 'codon'
codon = Bio::Sequence::NA.new("uug")
 
# select the standard codon table
codon_table = Bio::CodonTable[1]
 
# 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 (not RNA alphabets).
codon2 = codon.dna
 
# get the representation of that codon and translate to amino acid.
amino_acid = codon_table[codon2]
puts amino_acid        # => "L"

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()"

#!/usr/bin/env ruby
 
require 'bio'
 
# Generates a sample 100bp sequence.
seq1 = Bio::Sequence::NA.new("aatgacccgt" * 10)
 
# Naming this sequence as "testseq" and print in FASTA format
# (folded by 60 chars per line).
puts seq1.to_fasta("testseq", 60)

Reading in a Fasta file

This program opens FASTA format file for reading and iterates on each sequence in the file.

#!/usr/bin/env ruby
 
require 'bio'
 
file = Bio::FastaFormat.open(ARGV.shift)
file.each do |entry|
# do something on each fasta sequence entry
end

This program automatically detects and reads FASTA format files given as its arguments.

#!/usr/bin/env ruby
 
require 'bio'
 
Bio::FlatFile.auto(ARGF) do |ff|
ff.each do |entry|
  # do something on each fasta sequence entry
end
end

Similar but specify FASTA format explicitly.

#!/usr/bin/env ruby
 
require 'bio'
 
Bio::FlatFile.open(Bio::FastaFormat, ARGV[0]) do |ff|
  ff.each do |entry|
    # do something on each fasta sequence entry
  end
end

See more syntax examples on SampleCodes

Classes and modules

Major classes

The below classes have been identified by a group of major code contributors as major classes.[11]

Basic data structure

These classes allow you to natively store complicated biological data structure effectively.[11]

Class namesDescription
Bio::Sequence::NA, Bio::Sequence::AANucleic and amino acid sequences
Bio::Locations, Bio::FeaturesLocations / Annotations
Bio::Reference, Bio::PubMedLiteratures
Bio::Pathway, Bio::RelationGraphs
Bio::AlignmentAlignments

Databases and sequence file formats

Accesses online biological databases and reads from common file-formats.

Class namesDescription
Bio::GenBank, Bio::EMBLGenBank / EMBL
Bio::SPTR, Bio::NBRF, Bio::PDBSwissProt and TrEMBL / PIR / PDB
Bio::FANTOMFANTOM DB (Functional annotation of mouse)
Bio::KEGGKEGG database parsers
Bio::GO, Bio::GFFBio::PROSITE FASTA format / PROSITE motifs
Bio::FastaFormat, Bio::PROSITEFASTA format / PROSITE motifs

Wrapper and parsers for bioinformatics tool

These classes allow for easy access to commonly used bioinformatics tools.

Class namesDescription
Bio::Blast, Bio::Fasta, Bio::HMMERSequence similarity (BLAST / FASTA / HMMER)
Bio::ClustalW, Bio::MAFFTMultiple sequence alignment (ClustalW / MAFFT)
Bio::PSORT, Bio::TargetPProtein subcellular localization (PSORT / TargetP)
Bio::SOSUI, Bio::TMHMMTransmembrane helix prediction (SOSUI / TMHMM)
Bio::GenScanGene finding (GenScan)

File, network and database I/O

Class namesDescription
Bio::RegistryOBDA Registry service
Bio::SQLOBDA BioSQL RDB schema
Bio::FetchOBDA BioFetch via HTTP
Bio::FlatFileIndexOBDA flat file indexing system
OBDA flat file indexing systemFlat file reader with data format autodetection
Bio::DASDistributed Annotation System (DAS)
Bio::KEGG::APISOAP/WSDL intarface for KEGG

A full list of classes and modules can be found at bioruby.org/rdoc/.

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 rubygems.org. Any gem published via the Biogem framework is also listed at biogems.info.

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.[12]

Biogem makes use of github.com and rubygems.org and requires the setup of unique accounts on these websites.

#BiogemDescriptionVersion
1bioBioinformatics Library1.4.3.0001
2biodiversityParser of scientific names3.1.5
3Simple Spreadsheet extractorBasic spreadsheet content extraction using Apache poi0.13.3
4Bio gemSoftware generator for Ruby1.36
5Bio samtoolsBinder of samtools for Ruby2.1.0
6t2 serverSupport for interacting with the taverna 2 server1.1.0
7bio ucsc apiThe Ruby ucsc api0.6.2
8entrezhttp request to entrez e-utilities0.5.8.1
9bio gadgetGadget for bioinformatics0.4.8
10sequenceserverBlast search made easy!0.8.7

Plugins

BioRuby will have a completed plugin system at the 1.5 release.[13]

See also[14]

BioRuby

Sister projects

Blogs

References

  1. Goto N, Prins P, Nakao M, Bonnal R, Aerts J, Katayama T (October 2010). "BioRuby: bioinformatics software for the Ruby programming language". Bioinformatics. 26 (20): 2617–9. doi:10.1093/bioinformatics/btq475. PMC 2951089. PMID 20739307.
  2. "bioruby/README.rdoc at master · bioruby/bioruby". 2014-05-08. Retrieved 2014-11-09.
  3. Mangalam H (2002). "The Bio* toolkits--a brief overview". Brief Bioinform. 3 (3): 296–302. doi:10.1093/bib/3.3.296. PMID 12230038.
  4. Bonnal R, Aerts J, Githinji G, Goto N, MacLean D, Miller C, Mishima H, Pagani M, Ramirez-Gonzalez R, Smant G, Strozzi F, Syme R, Vos R, Wennblom T, Woodcroft B, Katayama T, Prins P (April 2012). "Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics". Bioinformatics. 28 (7): 1035–7. doi:10.1093/bioinformatics/bts080. PMC 3315718. PMID 22332238.
  5. "History - BioRuby". 2014-05-30. Retrieved 2014-09-10.
  6. "IPA Information-technology Promotion Agency, Japan : IPA:Exploratory IT Human Resources Project (The MITOH Program)".
  7. "[BioRuby] BioRuby 1.0.0 released". 2006-02-27. Retrieved 2014-09-10.
  8. "History - BioRuby". 2014-05-30. Retrieved 2014-09-11.
  9. Ruby (programming language)#Platform support
  10. "SampleCodes - BioRuby". Archived from the original on 2014-09-11.
  11. "BioRuby: Open-Source Bioinformatics Library" (PDF). Cite journal requires |journal= (help)
  12. "Plugins - BioRuby".
  13. "BioRuby - Plugins". 2012-03-20. Archived from the original on 2011-10-07. Retrieved 2014-11-09.
  14. "Links - BioRuby". 2012-12-28. Archived from the original on 2014-10-09. Retrieved 2014-10-09.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.