miga-base 0.7.3.0 → 0.7.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/cli.rb +10 -8
  3. data/lib/miga/cli/action.rb +2 -3
  4. data/lib/miga/cli/action/about.rb +5 -6
  5. data/lib/miga/cli/action/add.rb +18 -12
  6. data/lib/miga/cli/action/add_result.rb +2 -3
  7. data/lib/miga/cli/action/archive.rb +1 -2
  8. data/lib/miga/cli/action/classify_wf.rb +8 -6
  9. data/lib/miga/cli/action/console.rb +0 -1
  10. data/lib/miga/cli/action/daemon.rb +7 -7
  11. data/lib/miga/cli/action/date.rb +0 -1
  12. data/lib/miga/cli/action/derep_wf.rb +5 -4
  13. data/lib/miga/cli/action/doctor.rb +71 -82
  14. data/lib/miga/cli/action/doctor/base.rb +102 -0
  15. data/lib/miga/cli/action/edit.rb +14 -2
  16. data/lib/miga/cli/action/files.rb +8 -8
  17. data/lib/miga/cli/action/find.rb +5 -6
  18. data/lib/miga/cli/action/generic.rb +7 -7
  19. data/lib/miga/cli/action/get.rb +20 -17
  20. data/lib/miga/cli/action/get_db.rb +8 -2
  21. data/lib/miga/cli/action/index_wf.rb +1 -1
  22. data/lib/miga/cli/action/init.rb +53 -41
  23. data/lib/miga/cli/action/init/daemon_helper.rb +65 -43
  24. data/lib/miga/cli/action/lair.rb +7 -7
  25. data/lib/miga/cli/action/ln.rb +6 -6
  26. data/lib/miga/cli/action/ls.rb +1 -2
  27. data/lib/miga/cli/action/ncbi_get.rb +11 -3
  28. data/lib/miga/cli/action/new.rb +4 -4
  29. data/lib/miga/cli/action/next_step.rb +0 -1
  30. data/lib/miga/cli/action/preproc_wf.rb +3 -3
  31. data/lib/miga/cli/action/quality_wf.rb +1 -1
  32. data/lib/miga/cli/action/rm.rb +2 -3
  33. data/lib/miga/cli/action/run.rb +8 -8
  34. data/lib/miga/cli/action/stats.rb +8 -4
  35. data/lib/miga/cli/action/summary.rb +7 -6
  36. data/lib/miga/cli/action/tax_dist.rb +8 -4
  37. data/lib/miga/cli/action/tax_index.rb +3 -4
  38. data/lib/miga/cli/action/tax_set.rb +7 -6
  39. data/lib/miga/cli/action/tax_test.rb +6 -5
  40. data/lib/miga/cli/action/wf.rb +21 -19
  41. data/lib/miga/cli/base.rb +34 -32
  42. data/lib/miga/cli/objects_helper.rb +27 -18
  43. data/lib/miga/cli/opt_helper.rb +3 -2
  44. data/lib/miga/common.rb +2 -5
  45. data/lib/miga/common/base.rb +15 -16
  46. data/lib/miga/common/format.rb +8 -5
  47. data/lib/miga/common/hooks.rb +1 -4
  48. data/lib/miga/common/path.rb +4 -9
  49. data/lib/miga/common/with_daemon.rb +6 -3
  50. data/lib/miga/common/with_daemon_class.rb +3 -2
  51. data/lib/miga/common/with_result.rb +2 -1
  52. data/lib/miga/daemon.rb +93 -44
  53. data/lib/miga/daemon/base.rb +30 -11
  54. data/lib/miga/dataset.rb +47 -37
  55. data/lib/miga/dataset/base.rb +52 -37
  56. data/lib/miga/dataset/hooks.rb +3 -4
  57. data/lib/miga/dataset/result.rb +17 -1
  58. data/lib/miga/dataset/status.rb +6 -5
  59. data/lib/miga/json.rb +5 -7
  60. data/lib/miga/lair.rb +4 -0
  61. data/lib/miga/metadata.rb +4 -3
  62. data/lib/miga/project.rb +29 -20
  63. data/lib/miga/project/base.rb +52 -37
  64. data/lib/miga/project/dataset.rb +33 -26
  65. data/lib/miga/project/hooks.rb +0 -3
  66. data/lib/miga/project/result.rb +14 -5
  67. data/lib/miga/remote_dataset.rb +85 -72
  68. data/lib/miga/remote_dataset/base.rb +11 -13
  69. data/lib/miga/remote_dataset/download.rb +34 -12
  70. data/lib/miga/result.rb +34 -25
  71. data/lib/miga/result/base.rb +0 -2
  72. data/lib/miga/result/dates.rb +1 -3
  73. data/lib/miga/result/source.rb +15 -16
  74. data/lib/miga/result/stats.rb +37 -27
  75. data/lib/miga/tax_dist.rb +6 -4
  76. data/lib/miga/tax_index.rb +17 -17
  77. data/lib/miga/taxonomy.rb +6 -1
  78. data/lib/miga/taxonomy/base.rb +19 -15
  79. data/lib/miga/version.rb +19 -16
  80. data/scripts/project_stats.bash +3 -0
  81. data/scripts/stats.bash +1 -1
  82. data/test/common_test.rb +3 -11
  83. data/test/daemon_helper.rb +38 -0
  84. data/test/daemon_test.rb +91 -99
  85. data/test/dataset_test.rb +63 -59
  86. data/test/format_test.rb +3 -11
  87. data/test/hook_test.rb +50 -55
  88. data/test/json_test.rb +7 -8
  89. data/test/lair_test.rb +22 -28
  90. data/test/metadata_test.rb +6 -14
  91. data/test/project_test.rb +33 -40
  92. data/test/remote_dataset_test.rb +26 -32
  93. data/test/result_stats_test.rb +17 -27
  94. data/test/result_test.rb +41 -34
  95. data/test/tax_dist_test.rb +2 -4
  96. data/test/tax_index_test.rb +4 -10
  97. data/test/taxonomy_test.rb +7 -9
  98. data/test/test_helper.rb +42 -1
  99. data/test/with_daemon_test.rb +14 -22
  100. data/utils/adapters.fa +13 -0
  101. data/utils/cleanup-databases.rb +6 -5
  102. data/utils/distance/base.rb +0 -1
  103. data/utils/distance/commands.rb +19 -12
  104. data/utils/distance/database.rb +25 -21
  105. data/utils/distance/pipeline.rb +16 -10
  106. data/utils/distance/runner.rb +19 -13
  107. data/utils/distance/temporal.rb +7 -4
  108. data/utils/distances.rb +1 -1
  109. data/utils/domain-ess-genes.rb +7 -7
  110. data/utils/index_metadata.rb +5 -4
  111. data/utils/mytaxa_scan.rb +18 -16
  112. data/utils/representatives.rb +5 -4
  113. data/utils/requirements.txt +1 -1
  114. data/utils/subclade/base.rb +0 -1
  115. data/utils/subclade/pipeline.rb +7 -6
  116. data/utils/subclade/runner.rb +9 -9
  117. data/utils/subclade/temporal.rb +0 -2
  118. data/utils/subclades-compile.rb +39 -37
  119. data/utils/subclades.rb +1 -1
  120. metadata +6 -4
@@ -8,12 +8,14 @@ module MiGA::Cli::Action::Init::DaemonHelper
8
8
  cli.puts 'Default daemon configuration:'
9
9
  daemon_f = File.expand_path('.miga_daemon.json', ENV['HOME'])
10
10
  unless File.exist?(daemon_f) and cli.ask_user(
11
- 'A template daemon already exists, do you want to preserve it?',
12
- 'yes', %w(yes no)) == 'yes'
13
- v = {created: Time.now.to_s, updated: Time.now.to_s}
11
+ 'A template daemon already exists, do you want to preserve it?',
12
+ 'yes', %w(yes no)
13
+ ) == 'yes'
14
+ v = { created: Time.now.to_s, updated: Time.now.to_s }
14
15
  v[:type] = cli.ask_user(
15
16
  'Please select the type of daemon you want to setup',
16
- cli[:dtype], %w(bash ssh qsub msub slurm))
17
+ cli[:dtype], %w(bash ssh qsub msub slurm)
18
+ )
17
19
  case v[:type]
18
20
  when 'bash'
19
21
  v = configure_bash_daemon(v)
@@ -36,52 +38,61 @@ module MiGA::Cli::Action::Init::DaemonHelper
36
38
  v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
37
39
  cli.puts 'Setting up internal daemon defaults.'
38
40
  cli.puts 'If you don\'t understand this just leave default values:'
39
- v[:cmd] = cli.ask_user(
41
+ v[:cmd] = cli.ask_user(
40
42
  "How should I launch tasks?\n" \
41
43
  " {{variables}}: script, vars, cpus, log, task_name, miga\n ",
42
- "{{vars}} {{miga}} run -r '{{script}}' -l '{{log}}' -e")
43
- v[:var] = cli.ask_user(
44
+ "{{vars}} {{miga}} run -r '{{script}}' -l '{{log}}' -e"
45
+ )
46
+ v[:var] = cli.ask_user(
44
47
  "How should I pass variables?\n" \
45
48
  " {{variables}}: key, value\n ",
46
- "{{key}}={{value}}")
49
+ "{{key}}={{value}}"
50
+ )
47
51
  v[:varsep] = cli.ask_user('What should I use to separate variables?', ' ')
48
52
  v[:alive] = cli.ask_user(
49
53
  "How can I know that a process is still alive?\n" \
50
54
  " Output should be 1 for running and 0 for non-running\n" \
51
55
  " {{variables}}: pid\n ",
52
- "ps -p '{{pid}}' | tail -n +2 | wc -l")
53
- v[:kill] = cli.ask_user(
56
+ "ps -p '{{pid}}' | tail -n +2 | wc -l"
57
+ )
58
+ v[:kill] = cli.ask_user(
54
59
  "How should I terminate tasks?\n" \
55
60
  " {{variables}}: pid\n ",
56
- "kill -9 '{{pid}}'")
61
+ "kill -9 '{{pid}}'"
62
+ )
57
63
  v
58
64
  end
59
65
 
60
66
  def configure_ssh_daemon(v)
61
67
  v[:latency] = cli.ask_user('How long should I sleep? (in secs)', '3').to_i
62
68
  v[:nodelist] = cli.ask_user(
63
- 'What environmental variable points to node list?', '$MIGA_NODELIST')
64
- v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
69
+ 'What environmental variable points to node list?', '$MIGA_NODELIST'
70
+ )
71
+ v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
65
72
  cli.puts 'Setting up internal daemon defaults.'
66
73
  cli.puts 'If you don\'t understand this just leave default values:'
67
- v[:cmd] = cli.ask_user(
74
+ v[:cmd] = cli.ask_user(
68
75
  "How should I launch tasks?\n" \
69
76
  " {{variables}}: script, vars, cpus, log, task_name, miga, host\n ",
70
- "{{vars}} {{miga}} run -r '{{script}}' -l '{{log}}' -R {{host}} -e")
71
- v[:var] = cli.ask_user(
77
+ "{{vars}} {{miga}} run -r '{{script}}' -l '{{log}}' -R {{host}} -e"
78
+ )
79
+ v[:var] = cli.ask_user(
72
80
  "How should I pass variables?\n" \
73
81
  " {{variables}}: key, value\n ",
74
- "{{key}}={{value}}")
82
+ "{{key}}={{value}}"
83
+ )
75
84
  v[:varsep] = cli.ask_user('What should I use to separate variables?', ' ')
76
85
  v[:alive] = cli.ask_user(
77
86
  "How can I know that a process is still alive?\n" \
78
87
  " Output should be 1 for running and 0 for non-running\n" \
79
88
  " {{variables}}: pid\n ",
80
- "ps -p '{{pid}}' | tail -n +2 | wc -l")
81
- v[:kill] = cli.ask_user(
89
+ "ps -p '{{pid}}' | tail -n +2 | wc -l"
90
+ )
91
+ v[:kill] = cli.ask_user(
82
92
  "How should I terminate tasks?\n" \
83
93
  " {{variables}}: pid\n ",
84
- "kill -9 '{{pid}}'")
94
+ "kill -9 '{{pid}}'"
95
+ )
85
96
  v
86
97
  end
87
98
 
@@ -92,29 +103,34 @@ module MiGA::Cli::Action::Init::DaemonHelper
92
103
  v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
93
104
  cli.puts 'Setting up internal daemon defaults'
94
105
  cli.puts 'If you don\'t understand this just leave default values:'
95
- v[:cmd] = cli.ask_user(
106
+ v[:cmd] = cli.ask_user(
96
107
  "How should I launch tasks?\n" \
97
108
  " {{variables}}: script, vars, cpus, log, task_name, miga\n ",
98
109
  "{{vars}} sbatch --partition='#{queue}' --export=ALL " \
99
110
  "--nodes=1 --ntasks-per-node={{cpus}} --output='{{log}}' " \
100
111
  "--job-name='{{task_name}}' --mem=9G --time=12:00:00 {{script}} " \
101
- "| perl -pe 's/.* //'")
102
- v[:var] = cli.ask_user(
112
+ "| perl -pe 's/.* //'"
113
+ )
114
+ v[:var] = cli.ask_user(
103
115
  "How should I pass variables?\n" \
104
116
  " {{variables}}: key, value\n ",
105
- "{{key}}={{value}}")
106
- v[:varsep] = cli.ask_user(
107
- 'What should I use to separate variables?', ' ')
108
- v[:alive] = cli.ask_user(
117
+ "{{key}}={{value}}"
118
+ )
119
+ v[:varsep] = cli.ask_user(
120
+ 'What should I use to separate variables?', ' '
121
+ )
122
+ v[:alive] = cli.ask_user(
109
123
  "How can I know that a process is still alive?\n" \
110
124
  " Output should be 1 for running and 0 for non-running\n" \
111
125
  " {{variables}}: pid\n ",
112
126
  "squeue -h -o %t -j '{{pid}}' | grep '^PD\\|R\\|CF\\|CG$' " \
113
- "| tail -n 1 | wc -l")
114
- v[:kill] = cli.ask_user(
127
+ "| tail -n 1 | wc -l"
128
+ )
129
+ v[:kill] = cli.ask_user(
115
130
  "How should I terminate tasks?\n" \
116
131
  " {{variables}}: pid\n ",
117
- "scancel '{{pid}}'")
132
+ "scancel '{{pid}}'"
133
+ )
118
134
  v
119
135
  end
120
136
 
@@ -125,29 +141,34 @@ module MiGA::Cli::Action::Init::DaemonHelper
125
141
  v[:ppn] = cli.ask_user('How many CPUs can I use per job?', '2').to_i
126
142
  cli.puts 'Setting up internal daemon defaults.'
127
143
  cli.puts 'If you don\'t understand this just leave default values:'
128
- v[:cmd] = cli.ask_user(
144
+ v[:cmd] = cli.ask_user(
129
145
  "How should I launch tasks?\n" \
130
146
  " {{variables}}: script, vars, cpus, log, task_name\n ",
131
147
  "#{v[:type]} -q '#{queue}' -v '{{vars}}' -l nodes=1:ppn={{cpus}} " \
132
148
  "{{script}} -j oe -o '{{log}}' -N '{{task_name}}' -l mem=9g " \
133
- "-l walltime=12:00:00 | grep .")
134
- v[:var] = cli.ask_user(
149
+ "-l walltime=12:00:00 | grep ."
150
+ )
151
+ v[:var] = cli.ask_user(
135
152
  "How should I pass variables?\n" \
136
153
  " {{variables}}: key, value\n ",
137
- "{{key}}={{value}}")
138
- v[:varsep] = cli.ask_user(
139
- 'What should I use to separate variables?', ',')
154
+ "{{key}}={{value}}"
155
+ )
156
+ v[:varsep] = cli.ask_user(
157
+ 'What should I use to separate variables?', ','
158
+ )
140
159
  if v[:type] == 'qsub'
141
160
  v[:alive] = cli.ask_user(
142
161
  "How can I know that a process is still alive?\n" \
143
162
  " Output should be 1 for running and 0 for non-running\n" \
144
163
  " {{variables}}: pid\n ",
145
164
  "qstat -f '{{pid}}' | grep ' job_state =' | perl -pe 's/.*= //' " \
146
- "| grep '[^C]' | tail -n 1 | wc -l | awk '{print $1}'")
147
- v[:kill] = cli.ask_user(
165
+ "| grep '[^C]' | tail -n 1 | wc -l | awk '{print $1}'"
166
+ )
167
+ v[:kill] = cli.ask_user(
148
168
  "How should I terminate tasks?\n" \
149
169
  " {{variables}}: pid\n ",
150
- "qdel '{{pid}}'")
170
+ "qdel '{{pid}}'"
171
+ )
151
172
  else # msub
152
173
  v[:alive] = cli.ask_user(
153
174
  "How can I know that a process is still alive?\n" \
@@ -155,13 +176,14 @@ module MiGA::Cli::Action::Init::DaemonHelper
155
176
  " {{variables}}: pid\n ",
156
177
  "checkjob '{{pid}}'|grep '^State:' | perl -pe 's/.*: //' " \
157
178
  "| grep 'Deferred\\|Hold\\|Idle\\|Starting\\|Running\\|Blocked'" \
158
- "| tail -n 1 | wc -l | awk '{print $1}'")
159
- v[:kill] = cli.ask_user(
179
+ "| tail -n 1 | wc -l | awk '{print $1}'"
180
+ )
181
+ v[:kill] = cli.ask_user(
160
182
  "How should I terminate tasks?\n" \
161
183
  " {{variables}}: pid\n ",
162
- "canceljob '{{pid}}'")
184
+ "canceljob '{{pid}}'"
185
+ )
163
186
  end
164
187
  v
165
188
  end
166
-
167
189
  end
@@ -5,19 +5,19 @@ require 'miga/cli/action'
5
5
  require 'miga/lair'
6
6
 
7
7
  class MiGA::Cli::Action::Lair < MiGA::Cli::Action
8
-
9
8
  def parse_cli
10
9
  cli.defaults = { daemon_opts: [] }
11
10
  cli.expect_operation = true
12
11
  cli.parse do |opt|
13
12
  opt.separator 'Available operations:'
14
- { start: 'Start an instance of the application',
15
- stop: 'Start an instance of the application',
16
- run: 'Start the application and stay on top',
17
- status: 'Show status (PID) of application instances',
18
- list: 'List all daemons and their status',
13
+ {
14
+ start: 'Start an instance of the application',
15
+ stop: 'Start an instance of the application',
16
+ run: 'Start the application and stay on top',
17
+ status: 'Show status (PID) of application instances',
18
+ list: 'List all daemons and their status',
19
19
  terminate: 'Terminate all daemons in the lair and exit'
20
- }.each { |k,v| opt.separator sprintf ' %*s%s', -33, k, v }
20
+ }.each { |k, v| opt.separator sprintf(' %*s%s', -33, k, v) }
21
21
  opt.separator ''
22
22
 
23
23
  opt.separator 'MiGA options:'
@@ -4,27 +4,26 @@
4
4
  require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::Ln < MiGA::Cli::Action
7
-
8
7
  def parse_cli
9
- cli.defaults = {info: false, force: false, method: :hardlink}
8
+ cli.defaults = { info: false, force: false, method: :hardlink }
10
9
  cli.parse do |opt|
11
10
  cli.opt_object(opt, [:project, :dataset_opt])
12
11
  opt.on(
13
12
  '-Q', '--project-target PATH',
14
13
  '(Mandatory) Path to the project where to link the dataset'
15
- ){ |v| cli[:project2] = v }
14
+ ) { |v| cli[:project2] = v }
16
15
  opt.on(
17
16
  '-f', '--force',
18
17
  'Force linking, even if dataset\'s preprocessing is incomplete'
19
- ){ |v| cli[:force] = v }
18
+ ) { |v| cli[:force] = v }
20
19
  opt.on(
21
20
  '-s', '--symlink',
22
21
  'Create symlinks instead of the default hard links'
23
- ){ cli[:method] = :symlink }
22
+ ) { cli[:method] = :symlink }
24
23
  opt.on(
25
24
  '-c', '--copy',
26
25
  'Create copies instead of the default hard links'
27
- ){ cli[:method] = :copy }
26
+ ) { cli[:method] = :copy }
28
27
  cli.opt_filter_datasets(opt)
29
28
  end
30
29
  end
@@ -35,6 +34,7 @@ class MiGA::Cli::Action::Ln < MiGA::Cli::Action
35
34
  ds = cli.load_and_filter_datasets
36
35
  ds.each do |d|
37
36
  next unless cli[:force] or d.done_preprocessing?
37
+
38
38
  cli.puts d.name
39
39
  q.import_dataset(d, cli[:method])
40
40
  end
@@ -4,7 +4,6 @@
4
4
  require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::Ls < MiGA::Cli::Action
7
-
8
7
  def parse_cli
9
8
  cli.defaults = { info: false, processing: false, silent: false }
10
9
  cli.parse do |opt|
@@ -51,7 +50,7 @@ class MiGA::Cli::Action::Ls < MiGA::Cli::Action
51
50
  exit(ds.empty? ? 1 : 0) if cli[:silent]
52
51
  if !cli[:datum].nil?
53
52
  cli[:tabular] = true
54
- format_table(ds, [nil,nil]) { |d| [d.name, d.metadata[cli[:datum]]] }
53
+ format_table(ds, [nil, nil]) { |d| [d.name, d.metadata[cli[:datum]]] }
55
54
  elsif !cli[:fields].nil?
56
55
  format_table(ds, [:name] + cli[:fields]) do |d|
57
56
  [d.name] + cli[:fields].map { |f| d.metadata[f] }
@@ -53,6 +53,7 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
53
53
  end
54
54
  end
55
55
  return unless cli[:unlink]
56
+
56
57
  unlink = p.dataset_names - d
57
58
  unlink.each { |i| p.unlink_dataset(i).remove! }
58
59
  cli.say "Datasets unlinked: #{unlink.size}"
@@ -105,14 +106,16 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
105
106
  ) { |v| cli[:ignore_until] = v }
106
107
  cli.opt_flag(
107
108
  opt, 'get-metadata',
108
- 'Only download and update metadata for existing datasets', :get_md)
109
+ 'Only download and update metadata for existing datasets', :get_md
110
+ )
109
111
  end
110
112
 
111
113
  def cli_save_actions(opt)
112
114
  cli.opt_flag(
113
115
  opt, 'only-metadata',
114
116
  'Create datasets without input data but retrieve all metadata',
115
- :only_md)
117
+ :only_md
118
+ )
116
119
  opt.on(
117
120
  '--save-every INT', Integer,
118
121
  'Save project every this many downloaded datasets',
@@ -139,6 +142,7 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
139
142
  unless tasks.any? { |i| cli[i.to_sym] }
140
143
  raise 'No action requested: pick at least one type of genome'
141
144
  end
145
+
142
146
  cli[:save_every] = 1 if cli[:dry]
143
147
  end
144
148
 
@@ -151,12 +155,13 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
151
155
  asm = r['assembly']
152
156
  next if asm.nil? || asm.empty? || asm == '-'
153
157
  next unless r['ftp_path_genbank']
158
+
154
159
  rep = remote_row_replicons(r)
155
160
  n = remote_row_name(r, rep, asm)
156
161
 
157
162
  # Register for download
158
163
  fna_url = '%s/%s_genomic.fna.gz' %
159
- [r['ftp_path_genbank'], File.basename(r['ftp_path_genbank'])]
164
+ [r['ftp_path_genbank'], File.basename(r['ftp_path_genbank'])]
160
165
  ds[n] = {
161
166
  ids: [fna_url], db: :assembly_gz, universe: :web,
162
167
  md: {
@@ -173,6 +178,7 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
173
178
 
174
179
  def remote_row_replicons(r)
175
180
  return if r['replicons'].nil?
181
+
176
182
  r['replicons']
177
183
  .split('; ')
178
184
  .map { |i| i.gsub(/.*:/, '') }
@@ -181,6 +187,7 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
181
187
 
182
188
  def remote_row_name(r, rep, asm)
183
189
  return r['#organism'].miga_name if cli[:legacy_name] && cli[:reference]
190
+
184
191
  if cli[:legacy_name] && ['Complete', ' Chromosome'].include?(r['level'])
185
192
  acc = rep.nil? ? '' : rep.first
186
193
  else
@@ -240,6 +247,7 @@ class MiGA::Cli::Action::NcbiGet < MiGA::Cli::Action
240
247
  cli.puts name
241
248
  ignore = false if ignore && name == cli[:ignore_until]
242
249
  next if ignore || p.dataset(name).nil? == cli[:get_md]
250
+
243
251
  downloaded += 1
244
252
  unless cli[:dry]
245
253
  save_entry(name, body, p)
@@ -4,7 +4,6 @@
4
4
  require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::New < MiGA::Cli::Action
7
-
8
7
  def parse_cli
9
8
  cli.parse do |opt|
10
9
  cli.opt_object(opt, [:project, :project_type_req])
@@ -36,13 +35,14 @@ class MiGA::Cli::Action::New < MiGA::Cli::Action
36
35
  def perform
37
36
  cli.ensure_type(MiGA::Project)
38
37
  cli.ensure_par(project: '-P')
39
- unless File.exist? "#{ENV["HOME"]}/.miga_rc" and
40
- File.exist? "#{ENV["HOME"]}/.miga_daemon.json"
38
+ unless File.exist?(File.join(ENV['HOME'], '.miga_rc')) &&
39
+ File.exist?(File.join(ENV['HOME'], '.miga_daemon.json'))
41
40
  raise "You must initialize MiGA before creating the first project.\n" +
42
- 'Please use "miga init".'
41
+ 'Please use "miga init".'
43
42
  end
44
43
  cli.say "Creating project: #{cli[:project]}"
45
44
  raise 'Project already exists, aborting.' if Project.exist? cli[:project]
45
+
46
46
  p = Project.new(cli[:project], false)
47
47
  p = cli.add_metadata(p)
48
48
  if cli[:fast]
@@ -4,7 +4,6 @@
4
4
  require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::NextStep < MiGA::Cli::Action
7
-
8
7
  def parse_cli
9
8
  cli.parse do |opt|
10
9
  cli.opt_object(opt, [:project, :dataset_opt])
@@ -15,14 +15,14 @@ class MiGA::Cli::Action::PreprocWf < MiGA::Cli::Action
15
15
  opt.on(
16
16
  '-i', '--input-type STRING',
17
17
  '(Mandatory) Type of input data, one of the following:',
18
- *MiGA::Cli::Action::Add.INPUT_TYPES.map{ |k,v| "~ #{k}: #{v[0]}" }
18
+ *MiGA::Cli::Action::Add.INPUT_TYPES.map { |k, v| "~ #{k}: #{v[0]}" }
19
19
  ) { |v| cli[:input_type] = v.downcase.to_sym }
20
20
  opt.on(
21
21
  '-m', '--mytaxa_scan',
22
22
  'Perform MyTaxa scan analysis'
23
23
  ) { |v| cli[:mytaxa] = v }
24
24
  opts_for_wf(opt, 'Input files as defined by --input-type',
25
- multi: true, cleanup: false, ncbi: false)
25
+ multi: true, cleanup: false, ncbi: false)
26
26
  end
27
27
  end
28
28
 
@@ -31,7 +31,7 @@ class MiGA::Cli::Action::PreprocWf < MiGA::Cli::Action
31
31
  cli.ensure_par(input_type: '-i')
32
32
  p_metadata = Hash[
33
33
  %w[project_stats haai_distances aai_distances ani_distances clade_finding]
34
- .map { |i| ["run_#{i}", false] }
34
+ .map { |i| ["run_#{i}", false] }
35
35
  ]
36
36
  d_metadata = { run_distances: false }
37
37
  unless cli[:mytaxa]
@@ -23,7 +23,7 @@ class MiGA::Cli::Action::QualityWf < MiGA::Cli::Action
23
23
  # Input data
24
24
  p_metadata = Hash[
25
25
  %w[project_stats haai_distances aai_distances ani_distances clade_finding]
26
- .map { |i| ["run_#{i}", false] }
26
+ .map { |i| ["run_#{i}", false] }
27
27
  ]
28
28
  d_metadata = { run_distances: false }
29
29
  d_metadata[:run_mytaxa_scan] = false unless cli[:mytaxa]
@@ -4,16 +4,15 @@
4
4
  require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::Rm < MiGA::Cli::Action
7
-
8
7
  def parse_cli
9
- cli.defaults = {remove: false}
8
+ cli.defaults = { remove: false }
10
9
  cli.parse do |opt|
11
10
  cli.opt_object(opt)
12
11
  opt.on(
13
12
  '-r', '--remove',
14
13
  'Also remove all associated files',
15
14
  'By default, only unlinks from metadata'
16
- ){ |v| cli[:remove] = v }
15
+ ) { |v| cli[:remove] = v }
17
16
  end
18
17
  end
19
18