Class: MiGA::Cli::Action::TaxTest
- Inherits:
-
MiGA::Cli::Action
- Object
- MiGA
- MiGA::Cli::Action
- MiGA::Cli::Action::TaxTest
- Defined in:
- lib/miga/cli/action/tax_test.rb
Instance Attribute Summary
Attributes inherited from MiGA::Cli::Action
Instance Method Summary collapse
Methods inherited from MiGA::Cli::Action
#complete, #empty_action, #initialize, #launch, load, #name
Constructor Details
This class inherits a constructor from MiGA::Cli::Action
Instance Method Details
#parse_cli ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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 ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |