class Bio::ClustalW

Bio::ClustalW is a CLUSTAL W execution wrapper class. Its object is also called an alignment factory. CLUSTAL W is a very popular software for multiple sequence alignment.

Attributes

command[R]

Returns last command-line strings executed by this factory. Note that filenames described in the command-line may already be removed because they are temporary files. Returns an array.

data_stdout[RW]

Last output to the stdout.

exit_status[R]

Last exit status

options[RW]

options

output[R]

Returns last raw alignment result (String or nil).

output_dnd[R]

Returns last alignment guild-tree (file.dnd).

program[RW]

name of the program (usually ‘clustalw’ in UNIX)

report[R]

Returns last alignment result. Returns a Bio::ClustalW::Report object.

Public Class Methods

new(program = 'clustalw', opt = []) click to toggle source

Creates a new CLUSTAL W execution wrapper object (alignment factory).

   # File lib/bio/appl/clustalw.rb
41 def initialize(program = 'clustalw', opt = [])
42   @program = program
43   @options = opt
44   @command = nil
45   @output = nil
46   @report = nil
47   @data_stdout = nil
48   @exit_status = nil
49   @output_dnd = nil
50 end

Public Instance Methods

errorlog() click to toggle source

+ errorlog is deprecated (no replacement) and returns empty string.

    # File lib/bio/appl/clustalw.rb
196 def errorlog
197   warn "errorlog is deprecated (no replacement) and returns empty string."
198   ''
199 end
log() click to toggle source

This method will be deprecated.

Returns last messages of CLUSTAL W execution.

   # File lib/bio/appl/clustalw.rb
73 def log
74   #warn 'Bio::ClustalW#log will be deprecated.'
75   @data_stdout
76 end
option() click to toggle source

option is deprecated. Instead, please use options.

   # File lib/bio/appl/clustalw.rb
59 def option
60   warn "Bio::ClustalW#option is deprecated. Please use options."
61   options
62 end
query(seqs) click to toggle source

Executes the program(clustalw). If seqs is not nil, perform alignment for seqs. If seqs is nil, simply executes CLUSTAL W.

Compatibility note: When seqs is nil, returns true if the program exits normally, and returns false if the program exits abnormally.

    # File lib/bio/appl/clustalw.rb
108 def query(seqs)
109   if seqs then
110     query_align(seqs)
111   else
112     exec_local(@options)
113     @exit_status.exitstatus == 0 ? true : false
114   end
115 end
query_align(seqs) click to toggle source

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: Nucleic or amino is not determined by this method.

    # File lib/bio/appl/clustalw.rb
123 def query_align(seqs)
124   unless seqs.is_a?(Bio::Alignment)
125     seqs = Bio::Alignment.new(seqs)
126   end
127   query_string(seqs.output_fasta(:width => 70,
128                                  :avoid_same_name => true))
129 end
query_alignment(seqs) click to toggle source

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

    # File lib/bio/appl/clustalw.rb
133 def query_alignment(seqs)
134   query_align(seqs)
135 end
query_by_filename(path, *arg) click to toggle source

Performs alignment of sequences in the file named path.

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

    # File lib/bio/appl/clustalw.rb
159 def query_by_filename(path, *arg)
160   if arg.size > 0 then
161     warn '2nd argument of Bio::ClustalW#query_by_filename is ignored'
162   end
163 
164   tf_out = Tempfile.open('clustalout')
165   tf_out.close(false)
166   tf_dnd = Tempfile.open('clustaldnd')
167   tf_dnd.close(false)
168 
169   opt = [ "-align",
170     "-infile=#{path}",
171     "-outfile=#{tf_out.path}",
172     "-newtree=#{tf_dnd.path}",
173     "-outorder=input"
174   ]
175   #opt << "-type=#{seqtype}" if seqtype
176   opt.concat(@options)
177   exec_local(opt)
178   tf_out.open
179   @output = tf_out.read
180   tf_out.close(true)
181   tf_dnd.open
182   @output_dnd = tf_dnd.read
183   tf_dnd.close(true)
184   @report = Report.new(@output)
185   @report
186 end
query_string(str, *arg) click to toggle source

Performs alignment for str. str should be a string that can be recognized by CLUSTAL W.

Compatibility Note: 2nd argument is deprecated and ignored.

    # File lib/bio/appl/clustalw.rb
141 def query_string(str, *arg)
142   if arg.size > 0 then
143     warn '2nd argument of Bio::ClustalW#query_string is ignored'
144   end
145   begin
146     tf_in = Tempfile.open('align')
147     tf_in.print str
148   ensure
149     tf_in.close(false)
150   end
151   r = query_by_filename(tf_in.path)
152   tf_in.close(true)
153   r
154 end
reset() click to toggle source

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

   # File lib/bio/appl/clustalw.rb
92 def reset
93   @command = nil
94   @output = nil
95   @report = nil
96   @exit_status = nil
97   @data_stdout = nil
98   @output_dnd = nil
99 end