class MiGA::Cli::Action::TaxTest

Public Instance Methods

parse_cli() click to toggle source
# File lib/miga/cli/action/tax_test.rb, line 8
def parse_cli
  cli.defaults = { test: 'both', ref_project: false }
  cli.parse do |opt|
    cli.opt_object(opt, [:project, :dataset])
    opt.on(
      '--ref-project',
      'Use the taxonomy from the reference project, not the current project'
    ) { |v| cli[:ref_project] = v }
    opt.on(
      '-t', '--test STRING',
      'Test to perform. Supported values: intax, novel, both'
    ) { |v| cli[:test] = v.downcase }
  end
end
perform() click to toggle source
# File lib/miga/cli/action/tax_test.rb, line 23
def perform
  d = cli.load_dataset
  cli.say 'Finding closest relative'
  cr = d.closest_relatives(1, cli[:ref_project])
  if cr.nil? or cr.empty?
    raise 'Action not supported for the project or dataset' if cr.nil?

    raise 'No close relatives found'
  else
    query_probability_distributions(d, cr[0])
  end
end