Class: Bio::Alignment::FactoryTemplate::Simple
- Inherits:
-
Object
- Object
- Bio::Alignment::FactoryTemplate::Simple
- Defined in:
- lib/bio/alignment.rb
Overview
Template class for alignment application factory. The program acts: input: stdin or file, format = fasta format output: stdout (parser should be specified by DEFAULT_PARSER)
Instance Attribute Summary (collapse)
-
- (Object) command
readonly
Last command-line string.
-
- (Object) data_stdout
Last output to the stdout.
-
- (Object) exit_status
readonly
Last exit status.
-
- (Object) options
options.
-
- (Object) output
readonly
Last raw result of the program.
-
- (Object) program
program name.
-
- (Object) report
readonly
Last result object performed by the factory.
Instance Method Summary (collapse)
-
- (Simple) initialize(program = self.class::DEFAULT_PROGRAM, options = [])
constructor
Creates a new alignment factory.
-
- (Object) query(seqs)
Executes the program.
-
- (Object) query_align(seqs)
alias of query_alignment.
-
- (Object) query_alignment(seqs)
Performs alignment for seqs.
-
- (Object) query_by_filename(filename_in)
Performs alignment of sequences in the file named fn.
-
- (Object) query_string(str)
Performs alignment for str.
-
- (Object) reset
Clear the internal data and status, except program and options.
Constructor Details
- (Simple) initialize(program = self.class::DEFAULT_PROGRAM, options = [])
Creates a new alignment factory
2221 2222 2223 2224 2225 2226 2227 2228 2229 |
# File 'lib/bio/alignment.rb', line 2221 def initialize(program = self.class::DEFAULT_PROGRAM, = []) @program = program @options = @command = nil @output = nil @report = nil @exit_status = nil @data_stdout = nil end |
Instance Attribute Details
- (Object) command (readonly)
Last command-line string. Returns nil or an array of String. Note that filenames described in the command-line may already be removed because these files may be temporary files.
2240 2241 2242 |
# File 'lib/bio/alignment.rb', line 2240 def command @command end |
- (Object) data_stdout
Last output to the stdout.
2253 2254 2255 |
# File 'lib/bio/alignment.rb', line 2253 def data_stdout @data_stdout end |
- (Object) exit_status (readonly)
Last exit status
2250 2251 2252 |
# File 'lib/bio/alignment.rb', line 2250 def exit_status @exit_status end |
- (Object) output (readonly)
Last raw result of the program. Return a string (or nil).
2244 2245 2246 |
# File 'lib/bio/alignment.rb', line 2244 def output @output end |
- (Object) program
program name
2232 2233 2234 |
# File 'lib/bio/alignment.rb', line 2232 def program @program end |
- (Object) report (readonly)
Last result object performed by the factory.
2247 2248 2249 |
# File 'lib/bio/alignment.rb', line 2247 def report @report end |
Instance Method Details
- (Object) query(seqs)
Executes the program. If seqs is not nil, perform alignment for seqs. If seqs is nil, simply executes the program.
Compatibility note: When seqs is nil, returns true if the program exits normally, and returns false if the program exits abnormally.
2271 2272 2273 2274 2275 2276 2277 2278 |
# File 'lib/bio/alignment.rb', line 2271 def query(seqs) if seqs then query_alignment(seqs) else exec_local(@options) @exit_status.exitstatus == 0 ? true : false end end |
- (Object) query_align(seqs)
alias of query_alignment.
Compatibility Note: query_align will renamed to query_alignment.
2292 2293 2294 2295 |
# File 'lib/bio/alignment.rb', line 2292 def query_align(seqs) #warn 'query_align is renamed to query_alignment.' query_alignment(seqs) end |
- (Object) query_alignment(seqs)
Performs alignment for seqs. seqs should be Bio::Alignment or Array of sequences or nil.
2282 2283 2284 2285 2286 2287 |
# File 'lib/bio/alignment.rb', line 2282 def query_alignment(seqs) unless seqs.respond_to?(:output_fasta) then seqs = Bio::Alignment.new(seqs) end query_string(seqs.output_fasta(:width => 70)) end |
- (Object) query_by_filename(filename_in)
Performs alignment of sequences in the file named fn.
2305 2306 2307 2308 |
# File 'lib/bio/alignment.rb', line 2305 def query_by_filename(filename_in) _query_local(filename_in, @options) @report end |
- (Object) query_string(str)
Performs alignment for str. The str should be a string that can be recognized by the program.
2299 2300 2301 2302 |
# File 'lib/bio/alignment.rb', line 2299 def query_string(str) _query_string(str, @options) @report end |
- (Object) reset
Clear the internal data and status, except program and options.
2256 2257 2258 2259 2260 2261 2262 |
# File 'lib/bio/alignment.rb', line 2256 def reset @command = nil @output = nil @report = nil @exit_status = nil @data_stdout = nil end |