class MiGA::Cli::Action::DerepWf

Public Instance Methods

parse_cli() click to toggle source
# File lib/miga/cli/action/derep_wf.rb, line 10
def parse_cli
  default_opts_for_wf
  cli.defaults = {
    metric: :ani, threshold: 95.0, criterion: :quality,
    summaries: true, collection: true
  }
  cli.parse do |opt|
    opt.on(
      '--aai',
      'Use Average Amino Acid Identity (AAI) as genome similarity metric',
      'By default: Use Average Nucleotide Identity (ANI)'
    ) { cli[:metric] = :aai }
    opt.on(
      '--ani',
      'Use Average Nucleotide Identity (ANI) as similarity metric (default)'
    ) { cli[:metric] = :ani }
    opt.on(
      '--threshold FLOAT', Float,
      "Metric threshold (%) to dereplicate. By default: #{cli[:threshold]}"
    ) { |v| cli[:threshold] = v }
    opt.on(
      '--quality',
      'Use genome with highest quality as clade representatives (default)'
    ) { |v| cli[:criterion] = :quality }
    opt.on(
      '--medoids',
      'Use medoids as clade representatives'
    ) { |v| cli[:criterion] = :medoids }
    opt.on(
      '--no-collection',
      'Do not generate a dereplicated collection of assemblies'
    ) { |v| cli[:collection] = v }
    opt.on(
      '--no-summaries',
      'Do not generate intermediate step summaries'
    ) { |v| cli[:summaries] = v }
    opts_for_wf_distances(opt)
    opts_for_wf(opt, 'Input genome assemblies (nucleotides, FastA)')
  end
end
perform() click to toggle source
# File lib/miga/cli/action/derep_wf.rb, line 51
def perform
  # Input data
  p = create_project(
    :assembly,
    { run_clades: false },
    { run_mytaxa_scan: false, run_ssu: false }
  )
  p.set_option(:gsp_metric, cli[:metric].to_s)
  p.set_option(:"gsp_#{cli[:metric]}", cli[:threshold])

  # Run
  run_daemon
  dereplicate(p)
  summarize(%w[cds assembly essential_genes]) if cli[:summaries]
  cleanup
end