Class: Bio::EMBOSS
Overview
Description
This file holds classes pertaining to the EMBOSS software suite.
This class provides a wrapper for the applications of the EMBOSS suite, which is a mature and stable collection of open-source applications that can handle a huge range of sequence formats. Applications include:
-
Sequence alignment
-
Rapid database searching with sequence patterns
-
Protein motif identification, including domain analysis
-
Nucleotide sequence pattern analysis—for example to identify CpG islands or repeats
-
Codon usage analysis for small genomes
-
Rapid identification of sequence patterns in large scale sequence sets
-
Presentation tools for publication
See the emboss website for more information: emboss.sourceforge.net.
Usage
require 'bio'
# Suppose that you could get the sequence for XLRHODOP by running
# the EMBOSS command +seqret embl:xlrhodop+ on the command line.
# Then you can get the output of that command in a Bio::EMBOSS object
# by creating a new Bio::EMBOSS object and subsequently executing it.
xlrhodop = Bio::EMBOSS.new('seqret embl:xlrhodop')
puts xlrhodop.exec
# Or all in one go:
puts Bio::EMBOSS.new('seqret embl:xlrhodop').exec
# Similarly:
puts Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop')
puts Bio::EMBOSS.new('showfeat embl:xlrhodop').exec
puts Bio::EMBOSS.new('seqret embl:xlrhodop -osformat acedb').exec
# A shortcut exists for this two-step process for +seqret+ and +entret+.
puts Bio::EMBOSS.seqret('embl:xlrhodop')
puts Bio::EMBOSS.entret('embl:xlrhodop')
Pre-requisites
You must have the EMBOSS suite installed locally. You can download from the project website (see References below).
Rereferences
-
Rice P, Longden I and Bleasby A. \
EMBOSS: the European Molecular Biology Open Software Suite. \ Trends Genet. 2000 Jun ; 16(6): 276-7
Instance Attribute Summary collapse
-
#io ⇒ Object
readonly
Pipe for the command.
-
#result ⇒ Object
readonly
Result of the executed command.
Class Method Summary collapse
-
.entret(arg) ⇒ Object
Combines the initialization and execution for the emboss
entret
command. -
.seqret(arg) ⇒ Object
Combines the initialization and execution for the emboss
seqret
command.
Instance Method Summary collapse
-
#exec ⇒ Object
A Bio::EMBOSS object has to be executed before it can return any result.
-
#initialize(cmd_line) ⇒ EMBOSS
constructor
Initializes a new Bio::EMBOSS object.
Constructor Details
#initialize(cmd_line) ⇒ EMBOSS
Initializes a new Bio::EMBOSS object. This provides a holder that can subsequently be executed (see Bio::EMBOSS.exec). The object does not hold any actual data when initialized.
e = Bio::EMBOSS.new('seqret embl:xlrhodop')
For e to actually hold data, it has to be executed:
puts e.exec
For an overview of commands that can be used with this method, see the emboss website.
Arguments:
-
(required) command: emboss command
- Returns
-
Bio::EMBOSS object
116 117 118 |
# File 'lib/bio/appl/emboss.rb', line 116 def initialize(cmd_line) @cmd_line = cmd_line + ' -stdout -auto' end |
Instance Attribute Details
#io ⇒ Object (readonly)
Pipe for the command
140 141 142 |
# File 'lib/bio/appl/emboss.rb', line 140 def io @io end |
#result ⇒ Object (readonly)
Result of the executed command
143 144 145 |
# File 'lib/bio/appl/emboss.rb', line 143 def result @result end |
Class Method Details
.entret(arg) ⇒ Object
97 98 99 |
# File 'lib/bio/appl/emboss.rb', line 97 def self.entret(arg) str = self.retrieve('entret', arg) end |
.seqret(arg) ⇒ Object
81 82 83 |
# File 'lib/bio/appl/emboss.rb', line 81 def self.seqret(arg) str = self.retrieve('seqret', arg) end |
Instance Method Details
#exec ⇒ Object
A Bio::EMBOSS object has to be executed before it can return any result.
obj_A = Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop')
puts obj_A.result #=> nil
obj_A.exec
puts obj_A.result #=> a FASTA-formatted sequence
obj_B = Bio::EMBOSS.new('showfeat embl:xlrhodop')
obj_B.exec
puts obj_B.result
129 130 131 132 133 134 135 136 137 |
# File 'lib/bio/appl/emboss.rb', line 129 def exec begin @io = IO.popen(@cmd_line, "w+") @result = @io.read return @result ensure @io.close end end |