class MiGA::Cli::Action::QualityWf

Public Instance Methods

parse_cli() click to toggle source
# File lib/miga/cli/action/quality_wf.rb, line 10
def parse_cli
  default_opts_for_wf
  cli.defaults = { mytaxa: false, min_qual: 'no' }
  cli.parse do |opt|
    opt.on(
      '-m', '--mytaxa-scan',
      'Perform MyTaxa scan analysis'
    ) { |v| cli[:mytaxa] = v }
    opts_for_wf(opt, 'Input genome assemblies (nucleotides, FastA)')
  end
end
perform() click to toggle source
# File lib/miga/cli/action/quality_wf.rb, line 22
def perform
  # Input data
  p_metadata = Hash[
    %w[project_stats haai_distances aai_distances ani_distances clade_finding]
               .map { |i| ["run_#{i}", false] }
  ]
  d_metadata = { run_distances: false }
  d_metadata[:run_mytaxa_scan] = false unless cli[:mytaxa]
  p = create_project(:assembly, p_metadata, d_metadata)
  # Run
  run_daemon
  summarize
  if cli[:mytaxa]
    dir = File.expand_path('mytaxa_scan', cli[:outdir])
    Dir.mkdir(dir)
    p.each_dataset do |d|
      r = d.result(:mytaxa_scan) or next
      f = r.file_path(:report) or next
      FileUtils.cp(f, dir)
    end
  end
  cleanup
end