Class | Bio::MAFFT
In: | lib/bio/appl/mafft.rb lib/bio/appl/mafft/report.rb
Parent: | Object

Bio::MAFFT is a wrapper class to execute MAFFT. MAFFT is a very fast multiple sequence alignment software.

Though Bio::MAFFT class currently supports only MAFFT version 3, you can use MAFFT version 5 because the class is a wrapper class.

### Methods

fftns fftnsi log new new2 nwap nwns nwnsi option query query_align query_alignment query_by_filename query_string reset

### Classes and Modules

Class Bio::MAFFT::Report

### Attributes

command | [R] | Shows last command-line string. Returns nil or an array of String. Note that filenames described in the command-line may already be removed because they are temporary files.
data_stdout | [RW] | Last output to the stdout.
exit_status | [R] | Last exit status
options | [RW] | options
output | [R] | Shows latest raw alignment result. Return a string. (Changed in bioruby-1.1.0). Compatibility note: If you want an array of Bio::FastaFormat instances, you should use report.data instead.
program | [RW] | program name (usually ‘mafft’ in UNIX)
report | [R] | Shows last alignment result (instance of Bio::MAFFT::Report class) performed by the factory.

### Public Class methods

fftns(n = nil)

Creates a new alignment factory. When `n` is a number (1,2,3, …), performs ‘fftns n’. When `n` is :i or ‘i’, performs ‘fftnsi’.

[Source]

        # File lib/bio/appl/mafft.rb, line 47
    47:     def self.fftns(n = nil)
    48:       opt = []
    49:       if n.to_s == 'i' then
    50:         self.new2(nil, 'fftnsi', *opt)
    51:       else
    52:         opt << n.to_s if n
    53:         self.new2(nil, 'fftns', *opt)
    54:       end
    55:     end

fftnsi()

Creates a new alignment factory. Performs ‘fftnsi’.

[Source]

        # File lib/bio/appl/mafft.rb, line 59
    59:     def self.fftnsi
    60:       self.new2(nil, 'fftnsi')
    61:     end

new(program = 'mafft', opt = [])

Creates a new alignment factory. `program` is the name of the program. `opt` is options of the program.

[Source]

         # File lib/bio/appl/mafft.rb, line 108
    108:     def initialize(program = 'mafft', opt = [])
    109:       @program = program
    110:       @options = opt
    111:       @command = nil
    112:       @output = nil
    113:       @report = nil
    114:       @data_stdout = nil
    115:       @exit_status = nil
    116:     end

new2(dir, prog, *opt)

Creates a new alignment factory. `dir` is the path of the MAFFT program. `prog` is the name of the program. `opt` is options of the program.

[Source]

         # File lib/bio/appl/mafft.rb, line 98
     98:     def self.new2(dir, prog, *opt)
     99:       if dir then
    100:         prog = File.join(dir, prog)
    101:       end
    102:       self.new(prog, opt)
    103:     end

nwap(n = nil)

Creates a new alignment factory. Performs ‘nwns —all-positive n’ or ‘nwnsi —all-positive’. Same as Bio::MAFFT.nwap(n, true).

[Source]

        # File lib/bio/appl/mafft.rb, line 90
    90:     def self.nwap(n = nil)
    91:       self.nwns(n, true)
    92:     end

nwns(n = nil, ap = nil)

Creates a new alignment factory. When `n` is a number (1,2,3, …), performs ‘nwns n’. When `n` is :i or ‘i’, performs ‘nwnsi’. In both case, if all_positive is true, add option ’—all-positive’.

[Source]

        # File lib/bio/appl/mafft.rb, line 67
    67:     def self.nwns(n = nil, ap = nil)
    68:       opt = []
    69:       opt << '--all-positive' if ap
    70:       if n.to_s == 'i' then
    71:         self.new2(nil, 'nwnsi', *opt)
    72:       else
    73:         opt << n.to_s if n
    74:         self.new2(nil, 'nwns', *opt)
    75:       end
    76:     end

nwnsi(all_positive = nil)

Creates a new alignment factory. Performs ‘nwnsi’. If `all_positive` is true, add option ’—all-positive’.

[Source]

        # File lib/bio/appl/mafft.rb, line 81
    81:     def self.nwnsi(all_positive = nil)
    82:       opt = []
    83:       opt << '--all-positive' if all_positive
    84:       self.new2(nil, 'nwnsi', *opt)
    85:     end

### Public Instance methods

log()

log is deprecated (no replacement) and returns empty string.

[Source]

         # File lib/bio/appl/mafft.rb, line 141
    141:     def log
    142:       warn "Bio::MAFFT#log is deprecated (no replacement) and returns empty string."
    143:       ''
    144:     end

option()

option is deprecated. Instead, please use options.

[Source]

         # File lib/bio/appl/mafft.rb, line 125
    125:     def option
    126:       warn "Bio::MAFFT#option is deprecated. Please use options."
    127:       options
    128:     end

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.

[Source]

         # File lib/bio/appl/mafft.rb, line 179
    179:     def query(seqs)
    180:       if seqs then
    181:         query_align(seqs)
    182:       else
    183:         exec_local(@options)
    184:         @exit_status.exitstatus == 0 ? true : false
    185:       end
    186:     end

query_align(seqs, *arg)

Note that this method will be renamed to query_alignment.

Performs alignment for seqs. `seqs` should be Bio::Alignment or Array of sequences or nil.

Compatibility Note: arg is deprecated and ignored.

[Source]

         # File lib/bio/appl/mafft.rb, line 194
    194:     def query_align(seqs, *arg)
    195:       if arg.size > 0 then
    196:         warn '2nd and other arguments of Bio::MAFFT#query_align is ignored'
    197:       end
    198:       unless seqs.is_a?(Bio::Alignment)
    199:         seqs = Bio::Alignment.new(seqs)
    200:       end
    201:       query_string(seqs.output_fasta(:width => 70))
    202:     end

query_alignment(seqs)

Performs alignment for seqs. `seqs` should be Bio::Alignment or Array of sequences or nil.

[Source]

         # File lib/bio/appl/mafft.rb, line 206
    206:     def query_alignment(seqs)
    207:       query_align(seqs)
    208:     end

query_by_filename(fn, *arg)

Performs alignment of sequences in the file named `fn`.

Compatibility Note: 2nd argument (seqtype) is deprecated and ignored.

[Source]

         # File lib/bio/appl/mafft.rb, line 232
    232:     def query_by_filename(fn, *arg)
    233:       if arg.size > 0 then
    234:         warn '2nd argument of Bio::MAFFT#query_filename is ignored'
    235:       end
    236:       opt = @options + [ fn ]
    237:       exec_local(opt)
    238:       @report = Report.new(@output)
    239:       @report
    240:     end

query_string(str, *arg)

Performs alignment for `str`. Str should be a string that can be recognized by the program.

Compatibility Note: arg is deprecated and ignored.

[Source]

         # File lib/bio/appl/mafft.rb, line 214
    214:     def query_string(str, *arg)
    215:       if arg.size > 0 then
    216:         warn '2nd and other arguments of Bio::MAFFT#query_string is ignored'
    217:       end
    218:       begin
    219:         tf_in = Tempfile.open('align')
    220:         tf_in.print str
    221:       ensure
    222:         tf_in.close(false)
    223:       end
    224:       r = query_by_filename(tf_in.path, *arg)
    225:       tf_in.close(true)
    226:       r
    227:     end

reset()

Clear the internal data and status, except program and options.

[Source]

         # File lib/bio/appl/mafft.rb, line 164
    164:     def reset
    165:       @command = nil
    166:       @output = nil
    167:       @report = nil
    168:       @exit_status = nil
    169:       @data_stdout = nil
    170:     end

[Validate]