Sha256: 5d1110942844a046317bcdc020381b08d75ec7ebb702cb7a88cb806b11063952

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 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  => false
    method_option :identity, :type => :numeric, :required => true
    method_option :output,   :type => :string,  :required => true
    method_option :strand,   :type => :string,  :default => 'plus'

    def cluster
      input    = File.expand_path(options[:input])
      database = File.expand_path(options[:database])
      threads  = options[:threads]
      identity = options[:identity]
      output   = File.expand_path(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 = False : use all threads (default)
      if threads != false
        cmd << "--threads #{threads}"
      end

      cmd = cmd.join(' ')

      run cmd
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lederhosen-1.3.10 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.8 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.7 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.6 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.5 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.4 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.3 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.2 lib/lederhosen/tasks/cluster.rb
lederhosen-1.3.1 lib/lederhosen/tasks/cluster.rb