Sha256: a02f8a1e130b1ecb9d5d77f97208b027208bfdd69f50a627dc0f7e1d77738b9a

Contents?: true

Size: 1.44 KB

Versions: 21

Compression:

Stored size: 1.44 KB

Contents

##
# FINALLY, CLUSTER!
#

module Lederhosen
  class CLI

    desc "cluster",
         "cluster a fasta file using UCLUST"

    method_option :input,       :type => :string,  :required => true
    method_option :output,      :type => :string,  :required => true
    method_option :identity,    :type => :numeric, :required => true
    method_option :stepwords,   :type => :numeric, :default  => 8
    method_option :wordlen,     :type => :numeric, :default  => 8
    method_option :maxaccepts,  :type => :numeric, :default  => 1
    method_option :maxrejects,  :type => :numeric, :default  => 8
    method_option :lib,         :type => :string

    def cluster
      identity   = options[:identity]
      output     = options[:output]
      input      = options[:input]
      stepwords  = options[:stepwords]
      maxaccepts = options[:maxaccepts]
      maxrejects = options[:maxrejects]
      wordlen    = options[:wordlen]
      lib        = options[:lib]

      ohai "clustering #{input}, saving to #{output}"

      options.each_pair do |key, value|
        ohai "#{key} = #{value}"
      end

      cmd = [
        'uclust',
        "--input #{input}",
        "--uc #{output}",
        "--id #{identity}",
        "--stepwords #{stepwords}",
        "--maxaccepts #{maxaccepts}",
        "--maxrejects #{maxrejects}",
        "--w #{wordlen}"
      ]

      cmd << "--lib #{lib}" unless lib.nil?

      cmd = cmd.join(' ')

      @shell.mute { run cmd }
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
lederhosen-0.2.10 lib/lederhosen/tasks/cluster.rb