Sha256: 890f8b2207b7772f0fbe40a896ab5d871c2d307d693d55c47750b7930cc3fc3e

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

module Lederhosen

  class CLI

    desc 'cluster', 'reference-based clustering using usearch'

    method_option :input,    :type => :string,  :required => true
    method_option :database, :type => :string,  :required => true
    method_option :threads,  :type => :numeric, :default  => 0
    method_option :identity, :type => :numeric, :required => true
    method_option :output,   :type => :string,  :required => true
    method_option :strand,   :type => :string,  :default => 'plus'

    def cluster
      input    = options[:input]
      database = options[:database]
      threads  = options[:threads]
      identity = options[:identity]
      output   = options[:output]
      strand   = options[:strand]

      ohai "clustering #{input} to #{database} and saving to #{output}"

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

      cmd = ['usearch',
        "--usearch_local #{input}",
        "--id #{identity}",
        "--uc #{output}",
        "--db #{database}",
        "--strand #{strand}"
      ]

      # threads = 0 : use all threads (default)
      if threads != 0
        cmd << "--threads #{threads}"
      end

      cmd = cmd.join(' ')

      run cmd
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lederhosen-1.2.1 lib/lederhosen/tasks/cluster.rb
lederhosen-1.2.0 lib/lederhosen/tasks/cluster.rb
lederhosen-1.1.1 lib/lederhosen/tasks/cluster.rb
lederhosen-1.1.0 lib/lederhosen/tasks/cluster.rb
lederhosen-1.0.2 lib/lederhosen/tasks/cluster.rb
lederhosen-1.0.1 lib/lederhosen/tasks/cluster.rb
lederhosen-1.0.0 lib/lederhosen/tasks/cluster.rb