Class Bio::ClustalW
In: lib/bio/appl/clustalw.rb  (CVS)
lib/bio/appl/clustalw/report.rb  (CVS)
Parent: Object

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.

Methods

Classes and Modules

Class Bio::ClustalW::Report

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

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

[Source]

# File lib/bio/appl/clustalw.rb, line 41
    def initialize(program = 'clustalw', opt = [])
      @program = program
      @options = opt
      @command = nil
      @output = nil
      @report = nil
      @data_stdout = nil
      @exit_status = nil
      @output_dnd = nil
    end

Public Instance methods

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

[Source]

# File lib/bio/appl/clustalw.rb, line 196
    def errorlog
      warn "errorlog is deprecated (no replacement) and returns empty string."
      ''
    end

This method will be deprecated.

Returns last messages of CLUSTAL W execution.

[Source]

# File lib/bio/appl/clustalw.rb, line 73
    def log
      #warn 'Bio::ClustalW#log will be deprecated.'
      @data_stdout
    end

option is deprecated. Instead, please use options.

[Source]

# File lib/bio/appl/clustalw.rb, line 59
    def option
      warn "Bio::ClustalW#option is deprecated. Please use options."
      options
    end

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.

[Source]

# File lib/bio/appl/clustalw.rb, line 108
    def query(seqs)
      if seqs then
        query_align(seqs)
      else
        exec_local(@options)
        @exit_status.exitstatus == 0 ? true : false
      end
    end

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.

[Source]

# File lib/bio/appl/clustalw.rb, line 123
    def query_align(seqs)
      unless seqs.is_a?(Bio::Alignment)
        seqs = Bio::Alignment.new(seqs)
      end
      query_string(seqs.output_fasta(:width => 70,
                                     :avoid_same_name => true))
    end

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

[Source]

# File lib/bio/appl/clustalw.rb, line 133
    def query_alignment(seqs)
      query_align(seqs)
    end

Performs alignment of sequences in the file named path.

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

[Source]

# File lib/bio/appl/clustalw.rb, line 159
    def query_by_filename(path, *arg)
      if arg.size > 0 then
        warn '2nd argument of Bio::ClustalW#query_by_filename is ignored'
      end

      tf_out = Tempfile.open('clustalout')
      tf_out.close(false)
      tf_dnd = Tempfile.open('clustaldnd')
      tf_dnd.close(false)

      opt = [ "-align",
        "-infile=#{path}",
        "-outfile=#{tf_out.path}",
        "-newtree=#{tf_dnd.path}",
        "-outorder=input"
      ]
      #opt << "-type=#{seqtype}" if seqtype
      opt.concat(@options)
      exec_local(opt)
      tf_out.open
      @output = tf_out.read
      tf_out.close(true)
      tf_dnd.open
      @output_dnd = tf_dnd.read
      tf_dnd.close(true)
      @report = Report.new(@output)
      @report
    end

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

Compatibility Note: 2nd argument is deprecated and ignored.

[Source]

# File lib/bio/appl/clustalw.rb, line 141
    def query_string(str, *arg)
      if arg.size > 0 then
        warn '2nd argument of Bio::ClustalW#query_string is ignored'
      end
      begin
        tf_in = Tempfile.open('align')
        tf_in.print str
      ensure
        tf_in.close(false)
      end
      r = query_by_filename(tf_in.path)
      tf_in.close(true)
      r
    end

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

[Source]

# File lib/bio/appl/clustalw.rb, line 92
    def reset
      @command = nil
      @output = nil
      @report = nil
      @exit_status = nil
      @data_stdout = nil
      @output_dnd = nil
    end

[Validate]