Class: Bio::Sim4
- Inherits:
-
Object
- Object
- Bio::Sim4
- Defined in:
- lib/bio/appl/sim4.rb,
lib/bio/appl/sim4/report.rb
Overview
The sim4 execution wrapper class.
Defined Under Namespace
Classes: Report
Instance Attribute Summary (collapse)
-
- (Object) command
readonly
last command-line strings executed by the object.
-
- (Object) database
default file name of database('seq2').
-
- (Object) options
options.
-
- (Object) output
readonly
last result text (String).
-
- (Object) program
readonly
name of the program (usually 'sim4' in UNIX).
-
- (Object) report
readonly
last result.
Instance Method Summary (collapse)
-
- (Object) exec_local(filename1, filename2 = nil)
(also: #exec)
Executes the sim4 program.
-
- (Sim4) initialize(program = 'sim4', database = nil, opt = [])
constructor
Creates a new sim4 execution wrapper object.
-
- (Object) log
log is deprecated (no replacement) and returns empty string.
-
- (Object) option
option is deprecated.
-
- (Object) query(seq1)
Executes the sim4 program.
-
- (Object) query_pairwise(seq1, seq2)
Executes the sim4 program.
Constructor Details
- (Sim4) initialize(program = 'sim4', database = nil, opt = [])
Creates a new sim4 execution wrapper object.
- program
-
Program name. Usually 'sim4' in UNIX.
- database
-
Default file name of database('seq2').
- option
-
Options (array of strings).
32 33 34 35 36 37 38 39 |
# File 'lib/bio/appl/sim4.rb', line 32 def initialize(program = 'sim4', database = nil, opt = []) @program = program @options = opt @database = database #seq2 @command = nil @output = nil @report = nil end |
Instance Attribute Details
- (Object) command (readonly)
last command-line strings executed by the object
57 58 59 |
# File 'lib/bio/appl/sim4.rb', line 57 def command @command end |
- (Object) database
default file name of database('seq2')
42 43 44 |
# File 'lib/bio/appl/sim4.rb', line 42 def database @database end |
- (Object) output (readonly)
last result text (String)
71 72 73 |
# File 'lib/bio/appl/sim4.rb', line 71 def output @output end |
- (Object) program (readonly)
name of the program (usually 'sim4' in UNIX)
45 46 47 |
# File 'lib/bio/appl/sim4.rb', line 45 def program @program end |
- (Object) report (readonly)
last result. Returns a Bio::Sim4::Report object.
74 75 76 |
# File 'lib/bio/appl/sim4.rb', line 74 def report @report end |
Instance Method Details
- (Object) exec_local(filename1, filename2 = nil) Also known as: exec
Executes the sim4 program. Perform mRNA-genome alignment between sequences in given files. filename1 and filename2 should be file name strings. If filename2 is not specified, using self.database.
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/bio/appl/sim4.rb', line 109 def exec_local(filename1, filename2 = nil) @command = [ @program, filename1, (filename2 or @database), *@options ] @output = nil @report = nil Bio::Command.call_command(@command) do |io| io.close_write @output = io.read @report = Bio::Sim4::Report.new(@output) end @report end |
- (Object) log
log is deprecated (no replacement) and returns empty string.
65 66 67 68 |
# File 'lib/bio/appl/sim4.rb', line 65 def log warn "log is deprecated (no replacement) and returns empty string." '' end |
- (Object) option
option is deprecated. Instead, please use options.
51 52 53 54 |
# File 'lib/bio/appl/sim4.rb', line 51 def option warn "option is deprecated. Please use options." end |
- (Object) query(seq1)
Executes the sim4 program. seq1 shall be a Bio::Sequence object. Returns a Bio::Sim4::Report object.
79 80 81 82 83 84 85 86 |
# File 'lib/bio/appl/sim4.rb', line 79 def query(seq1) tf = Tempfile.open('sim4') tf.print seq1.to_fasta('seq1', 70) tf.close(false) r = exec_local(tf.path) tf.close(true) r end |
- (Object) query_pairwise(seq1, seq2)
Executes the sim4 program. Perform mRNA-genome alignment between given sequences. seq1 and seq2 should be Bio::Sequence objects. Returns a Bio::Sim4::Report object.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/bio/appl/sim4.rb', line 92 def query_pairwise(seq1, seq2) tf = Tempfile.open('sim4') tf.print seq1.to_fasta('seq1', 70) tf.close(false) tf2 = Tempfile.open('seq2') tf2.print seq1.to_fasta('seq2', 70) tf2.close(false) r = exec_local(tf.path, tf2.path) tf.close(true) tf2.close(true) r end |