Class: MiGA::Cli::Action::PreprocWf

Inherits:
MiGA::Cli::Action show all
Includes:
Wf
Defined in:
lib/miga/cli/action/preproc_wf.rb

Instance Attribute Summary

Attributes inherited from MiGA::Cli::Action

#cli

Instance Method Summary collapse

Methods included from Wf

#call_cli, #cleanup, #create_project, #default_opts_for_wf, #download_datasets, #import_datasets, #initialize_empty_project, #opts_for_wf, #opts_for_wf_distances, #run_daemon, #summarize, #transfer_metadata

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_cliObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/miga/cli/action/preproc_wf.rb', line 11

def parse_cli
  default_opts_for_wf
  cli.defaults = { mytaxa: false, assembly: true }
  cli.parse do |opt|
    opt.on(
      '-i', '--input-type STRING',
      '(Mandatory) Type of input data, one of the following:',
      *MiGA::Cli::Action::Add.INPUT_TYPES.map { |k, v| "~ #{k}: #{v[0]}" }
    ) { |v| cli[:input_type] = v.downcase.to_sym }
    opt.on(
      '-m', '--mytaxa',
      'Perform MyTaxa/MyTaxa scan analyses'
    ) { |v| cli[:mytaxa] = v }
    opt.on(
      '--no-assembly',
      'Do not assemble the datasets or perform downstream analyses'
    ) { |v| cli[:assembly] = v }
    opts_for_wf(
      opt, 'Input files as defined by --input-type',
      multi: true, cleanup: false, ncbi: false, project_type: true
    )
  end
end

#performObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/miga/cli/action/preproc_wf.rb', line 35

def perform
  # Input data
  cli.ensure_par(input_type: '-i')
  norun = %w[
    project_stats haai_distances aai_distances ani_distances clade_finding
  ]
   = Hash[norun.map { |i| ["run_#{i}", false] }]
   = { run_distances: false }
  cli[:mytaxa] = false unless cli[:assembly]
  unless cli[:mytaxa]
    [:run_mytaxa_scan] = false
    [:run_mytaxa] = false
  end
  unless cli[:assembly]
    %w[assembly cds essential_genes ssu].each do |i|
      [:"run_#{i}"] = false
    end
  end
  p = create_project(cli[:input_type], , )

  # Run
  run_daemon
  summaries = []
  if cli[:input_type].to_s =~ /^raw_reads_/
    summaries += %w[raw_reads trimmed_reads]
  end
  summaries += %w[trimmed_fasta] if cli[:input_type].to_s =~ /^trimmed_reads_/
  summaries += %w[cds assembly essential_genes ssu] if cli[:assembly]
  summarize(summaries)
end