miga-base 1.2.13.3 → 1.2.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d01c6cdd3ff689e80079b0bd59a63cc968b1b7e768518ce013d3c4d055032427
4
- data.tar.gz: 1701cbb3a0c75dfe96ce6c1543f3aac6b35ba0dd87fb0f3f7ccc5e2780eaf7a3
3
+ metadata.gz: 6af49f95d3280cf3cbba4bfb12ee9987ce7af7515a329aad9112f3a2ba2357d8
4
+ data.tar.gz: 024d90b9f7eca754af3dbc13ca2aaa7ad51c5871ad531bffec9bd6c43350b218
5
5
  SHA512:
6
- metadata.gz: deec1e53d9dae1c995e59406a53b653f503e901821884b1b400da17c5330bbef5d344613fc7896961739cc66253604ad73947d20f178bf92f00f01881f16d0a6
7
- data.tar.gz: d991c538708a72b3c9e65eb56a6e121fea4ab25f26838dbd706f27e16cb8d757346eabc9799a3f5b620df3f8e0c5456b65884e3d887f80d1f65f34b762bbfd59
6
+ metadata.gz: 2f9f66736037ab87ef93a83e08decf55813addc75151f28ac06e6c9d4ee54f21c450cbc2c6b681c90853e6b96974303ffe3ea2aac04d4fb4bbda79386af49b46
7
+ data.tar.gz: 99fae0ad085c5165bf5232c348b19f89adf3c4b21502ba09636e66e45faadfa2a2a4f4d833bb3878123ac0b11535e739dfbc394668bdb651d834e76b177844ae
@@ -25,7 +25,7 @@ module MiGA::Cli::Action::Download::Base
25
25
 
26
26
  def cli_save_actions(opt)
27
27
  cli.opt_flag(
28
- opt, '--only-metadata',
28
+ opt, 'only-metadata',
29
29
  'Create datasets without input data but retrieve all metadata',
30
30
  :only_md
31
31
  )
@@ -23,6 +23,9 @@ module MiGA::Cli::Action::Download::Gtdb
23
23
 
24
24
  def sanitize_cli
25
25
  cli.ensure_par(taxon: '-T')
26
+ unless cli[:taxon] =~ /^[a-z]__\S+$/
27
+ raise 'Taxon (-T) must be in GTDB format: s__Macondimonas_diazotrophica'
28
+ end
26
29
  cli[:save_every] = 1 if cli[:dry]
27
30
  end
28
31
 
@@ -31,6 +31,10 @@ class MiGA::Cli::Action::GtdbGet < MiGA::Cli::Action
31
31
  cli_name_modifiers(opt)
32
32
  cli_filters(opt)
33
33
  cli_save_actions(opt)
34
+ opt.on(
35
+ '--api-key STRING',
36
+ 'NCBI API key'
37
+ ) { |v| ENV['NCBI_API_KEY'] = v }
34
38
  end
35
39
  end
36
40
 
@@ -37,12 +37,16 @@ class MiGA::Cli::Action::Summary < MiGA::Cli::Action
37
37
  cli.ensure_par(result: '-r')
38
38
  ds = cli.load_and_filter_datasets
39
39
  cli.say 'Loading results'
40
+ k = 0
41
+ n = ds.size
40
42
  stats = ds.map do |d|
43
+ cli.advance('Datasets:', k += 1, n, false)
41
44
  r = d.result(cli[:result])
42
45
  r.compute_stats if cli[:compute] && !r.nil? && r[:stats].empty?
43
46
  s = r.nil? ? {} : r[:stats]
44
47
  s.tap { |i| i[:dataset] = d.name }
45
48
  end
49
+ cli.say ''
46
50
  keys = cli[:key_md].nil? ? stats.map(&:keys).flatten.uniq :
47
51
  [:dataset, cli[:key_md].downcase.miga_name.to_sym]
48
52
  keys.delete :dataset
@@ -35,10 +35,18 @@ module MiGA::Cli::Action::Wf
35
35
  '-T', '--ncbi-taxon STRING',
36
36
  'Download all the genomes in NCBI classified as this taxon'
37
37
  ) { |v| cli[:ncbi_taxon] = v }
38
+ opt.on(
39
+ '-G', '--gtdb-taxon STRING',
40
+ 'Download all the genomes in GTDB classified as this taxon'
41
+ ) { |v| cli[:gtdb_taxon] = v }
38
42
  opt.on(
39
43
  '--no-draft',
40
- 'Only download complete genomes, not drafts'
44
+ 'Only download complete genomes, not drafts (requires -T)'
41
45
  ) { |v| cli[:ncbi_draft] = v }
46
+ opt.on(
47
+ '--gtdb-ref',
48
+ 'Only download reference anchor genomes in GTDB (requires -G)'
49
+ ) { |v| cli[:gtdb_ref] = v }
42
50
  opt.on(
43
51
  '--max-download INT', Integer,
44
52
  'Maximum number of genomes to download (by default: unlimited)'
@@ -136,7 +144,7 @@ module MiGA::Cli::Action::Wf
136
144
  p.set_option(i, cli[i])
137
145
  end
138
146
 
139
- # Download datasets
147
+ # Download datasets from NCBI
140
148
  unless cli[:ncbi_taxon].nil?
141
149
  what = cli[:ncbi_draft] ? '--all' : '--complete'
142
150
  cmd = ['ncbi_get', '-P', cli[:outdir], '-T', cli[:ncbi_taxon], what]
@@ -144,6 +152,14 @@ module MiGA::Cli::Action::Wf
144
152
  call_cli(cmd)
145
153
  end
146
154
 
155
+ # Download datasets from GTDB
156
+ unless cli[:gtdb_taxon].nil?
157
+ cmd = ['gtdb_get', '-P', cli[:outdir], '-T', cli[:gtdb_taxon]]
158
+ cmd << '--reference' if cli[:gtdb_ref]
159
+ cmd += ['--max', cli[:ncbi_max]] if cli[:ncbi_max]
160
+ call_cli(cmd)
161
+ end
162
+
147
163
  # Add datasets
148
164
  call_cli(
149
165
  [
data/lib/miga/version.rb CHANGED
@@ -12,7 +12,7 @@ module MiGA
12
12
  # - String indicating release status:
13
13
  # - rc* release candidate, not released as gem
14
14
  # - [0-9]+ stable release, released as gem
15
- VERSION = [1.2, 13, 3].freeze
15
+ VERSION = [1.2, 14, 0].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
@@ -20,7 +20,7 @@ module MiGA
20
20
 
21
21
  ##
22
22
  # Date of the current gem relese.
23
- VERSION_DATE = Date.new(2023, 1, 3)
23
+ VERSION_DATE = Date.new(2023, 1, 16)
24
24
 
25
25
  ##
26
26
  # References of MiGA
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.13.3
4
+ version: 1.2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2023-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons