Class: Bio::EMBOSS
Overview
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. -
.run(program, *options) ⇒ Object
Runs an emboss program and get the result as string.
-
.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
WARNING: Bio::EMBOSS.new will be changed in the future because Bio::EMBOSS.new(cmd_line) is inconvenient and potential security hole.
Constructor Details
#initialize(cmd_line) ⇒ EMBOSS
WARNING: Bio::EMBOSS.new will be changed in the future because Bio::EMBOSS.new(cmd_line) is inconvenient and potential security hole. Using Bio::EMBOSS.run(program, options…) is strongly recommended.
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
132 133 134 135 |
# File 'lib/bio/appl/emboss.rb', line 132 def initialize(cmd_line) warn 'Bio::EMBOSS.new(cmd_line) is inconvenient and potential security hole. Using Bio::EMBOSS.run(program, options...) is strongly recommended.' @cmd_line = cmd_line + ' -stdout -auto' end |
Instance Attribute Details
#io ⇒ Object (readonly)
Pipe for the command
157 158 159 |
# File 'lib/bio/appl/emboss.rb', line 157 def io @io end |
#result ⇒ Object (readonly)
Result of the executed command
160 161 162 |
# File 'lib/bio/appl/emboss.rb', line 160 def result @result end |
Class Method Details
.entret(arg) ⇒ Object
109 110 111 |
# File 'lib/bio/appl/emboss.rb', line 109 def self.entret(arg) str = self.retrieve('entret', arg) end |
.run(program, *options) ⇒ Object
Runs an emboss program and get the result as string. Note that “-auto -stdout” are automatically added to the options.
Example 1:
result = Bio::EMBOSS.run('seqret', 'embl:xlrhodop')
Example 2:
result = Bio::EMBOSS.run('water',
'-asequence', 'swissprot:slpi_human',
'-bsequence', 'swissprot:slpi_mouse')
Example 3:
= %w( -asequence swissprot:slpi_human
-bsequence swissprot:slpi_mouse )
result = Bio::EMBOSS.run('needle', *)
For an overview of commands that can be used with this method, see the emboss website.
Arguments:
-
(required) program: command name, or filename of an emboss program
-
options: options given to the emboss program
- Returns
-
String
187 188 189 190 191 192 |
# File 'lib/bio/appl/emboss.rb', line 187 def self.run(program, *) cmd = [ program, * ] cmd.push '-auto' cmd.push '-stdout' return Bio::Command.query_command(cmd) end |
.seqret(arg) ⇒ Object
93 94 95 |
# File 'lib/bio/appl/emboss.rb', line 93 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
146 147 148 149 150 151 152 153 154 |
# File 'lib/bio/appl/emboss.rb', line 146 def exec begin @io = IO.popen(@cmd_line, "w+") @result = @io.read return @result ensure @io.close end end |