miga-base 1.2.2.3 → 1.2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b3fd16e90667560b5cba41046eb92613187279fd7194d1825cc3dee9690273d
4
- data.tar.gz: 84043b09c234b825ba0b89ca057b4301a97d5234a87282583516abffbc377e05
3
+ metadata.gz: 6fbc57d93921f48449936b8af3a44de4cb2cfddd14becca1f1fcf434dd8eb9ef
4
+ data.tar.gz: b4486a1cc7fee96070321b1d59c444f2a784daa50f536998e890d059767dc56a
5
5
  SHA512:
6
- metadata.gz: 2e0d76139cfd93f77a91ee266bd596d74e8881da94fb750d97b03bb6c491424e75af208177687525d284ae3fe96e77f1e373f0bdce0583445a4070f3ed09cac0
7
- data.tar.gz: 5bd98ea9eb89bcb4af4b74128c2d84ac1f32047322bb2177f7d47543efcc4122a4f8c23f463e8ae8291c8e6dff753182a39fd11fbdf42679975e5b2dba0ca571
6
+ metadata.gz: 7520ddd688f9767cf0baed5c53f5ba2b948d56f0bb847a2826e17fae823f2b3e34141c645196544c3269165aba0bbb83959c62d2187ad3d8151c1b180fb885b7
7
+ data.tar.gz: 643f3ddc30c470977089dc8fa812a69dd8d549e00bd1cd5afde928eb5ec4f457d2ababf6d5d1533c5835f2bd3f9df4228e12ef712b31767ae501084180d0291c
@@ -128,7 +128,9 @@ class MiGA::Cli::Action::Get < MiGA::Cli::Action
128
128
  end
129
129
 
130
130
  sub_cli.say 'Locating remote dataset'
131
- RemoteDataset.new(sub_cli[:ids], sub_cli[:db], sub_cli[:universe])
131
+ RemoteDataset.new(
132
+ sub_cli[:ids].chomp, sub_cli[:db].chomp, sub_cli[:universe].chomp
133
+ )
132
134
  end
133
135
 
134
136
  def update_metadata(sub_cli, p, rd)
@@ -5,7 +5,7 @@ require 'miga/cli/action'
5
5
 
6
6
  class MiGA::Cli::Action::Run < MiGA::Cli::Action
7
7
  def parse_cli
8
- cli.defaults = { try_load: false, thr: 1, env: false }
8
+ cli.defaults = { try_load: false, thr: 1, env: false, check_first: false }
9
9
  cli.parse do |opt|
10
10
  cli.opt_object(opt, [:project, :dataset_opt, :result_opt])
11
11
  opt.on(
@@ -25,6 +25,10 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
25
25
  '-e', '--environment',
26
26
  'Load PROJECT, DATASET, and CORES from the environment'
27
27
  ) { |v| cli[:env] = v }
28
+ opt.on(
29
+ '--check-first',
30
+ 'Check if the result exists, and run only if it does not'
31
+ ) { |v| cli[:check_first] = v }
28
32
  end
29
33
  end
30
34
 
@@ -51,6 +55,15 @@ class MiGA::Cli::Action::Run < MiGA::Cli::Action
51
55
  # Load project
52
56
  p = cli.load_project
53
57
 
58
+ # Check if result already exists
59
+ if cli[:check_first]
60
+ obj = cli[:dataset] ? p.dataset(cli[:dataset]) : p
61
+ if obj.result(cli[:result])
62
+ cli.say('Result already exists')
63
+ return
64
+ end
65
+ end
66
+
54
67
  # Prepare command
55
68
  miga = MiGA.root_path
56
69
  opts = {}
@@ -69,15 +69,20 @@ module MiGA::Cli::Action::Wf
69
69
  'By default: ~/.miga_daemon.json'
70
70
  ) { |v| cli[:daemon_json] = v }
71
71
  opt.on(
72
- '-j', '--jobs INT',
72
+ '-j', '--jobs INT', Integer,
73
73
  'Number of parallel jobs to execute',
74
74
  'By default controlled by the daemon configuration (maxjobs)'
75
- ) { |v| cli[:jobs] = v.to_i }
75
+ ) { |v| cli[:jobs] = v }
76
76
  opt.on(
77
- '-t', '--threads INT',
77
+ '-t', '--threads INT', Integer,
78
78
  'Number of CPUs to use per job',
79
79
  'By default controlled by the daemon configuration (ppn)'
80
- ) { |v| cli[:threads] = v.to_i }
80
+ ) { |v| cli[:threads] = v }
81
+ opt.on(
82
+ '--threads-project INT', Integer,
83
+ 'Number of CPUs to use per project-wide job',
84
+ 'By default controlled by the daemon configuration (ppn_project or ppn)'
85
+ ) { |v| cli[:threads_project] = v }
81
86
  end
82
87
 
83
88
  def opts_for_wf_distances(opt)
@@ -184,9 +189,10 @@ module MiGA::Cli::Action::Wf
184
189
 
185
190
  def run_daemon
186
191
  cmd = ['daemon', 'run', '-P', cli[:outdir], '--shutdown-when-done']
187
- cmd += ['--json', cli[:daemon_json]] unless cli[:daemon_json].nil?
188
- cmd += ['--max-jobs', cli[:jobs]] unless cli[:jobs].nil?
189
- cmd += ['--ppn', cli[:threads]] unless cli[:threads].nil?
192
+ cmd += ['--json', cli[:daemon_json]] if cli[:daemon_json]
193
+ cmd += ['--max-jobs', cli[:jobs]] if cli[:jobs]
194
+ cmd += ['--ppn', cli[:threads]] if cli[:threads]
195
+ cmd += ['--ppn-project', cli[:threads_project]] if cli[:threads_project]
190
196
  cmd += ['--debug', MiGA::MiGA.debug_trace? ? '2' : '1'] if MiGA::MiGA.debug?
191
197
  cwd = Dir.pwd
192
198
  call_cli(cmd)
@@ -29,7 +29,7 @@ module MiGA::Common::WithDaemonClass
29
29
  return nil if c.nil? || c.empty?
30
30
 
31
31
  Time.parse(c)
32
- rescue Errno::ENOENT
32
+ rescue Errno::ENOENT, ArgumentError
33
33
  return nil
34
34
  end
35
35
  end
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, 2, 3].freeze
15
+ VERSION = [1.2, 4, 1].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(2022, 2, 9)
23
+ VERSION_DATE = Date.new(2022, 4, 27)
24
24
 
25
25
  ##
26
26
  # References of MiGA
@@ -216,11 +216,12 @@ module MiGA::DistanceRunner::Commands
216
216
  next unless target_ess
217
217
 
218
218
  # hAAI
219
- h = aairb_cmd(
220
- tmp_file('ess_genes.fa'), target_ess,
221
- dataset.name, target.name, tmp_dbs[:haai],
222
- aai_save_rbm: false, aai_p: opts[:haai_p], checkpoint: :haai
223
- )&.chomp&.to_f
219
+ aairb_cmd(
220
+ tmp_file('ess_genes.fa'), target_ess,
221
+ dataset.name, target.name, tmp_dbs[:haai],
222
+ aai_save_rbm: false, aai_p: opts[:haai_p], checkpoint: :haai
223
+ )
224
+ h = value_from_db(dataset.name, target.name, tmp_dbs[:haai], :haai)
224
225
  next if h.nil? || h.zero? || h > 90.0
225
226
 
226
227
  # Estimated AAI
@@ -19,6 +19,7 @@ end
19
19
  p.each_dataset do |d|
20
20
  next unless d.ref? && d.active?
21
21
 
22
+ db.execute('BEGIN TRANSACTION')
22
23
  searchable(db, d, :name, d.name)
23
24
  d.metadata.each do |k, v|
24
25
  next if [:created, :updated].include? k
@@ -26,4 +27,5 @@ p.each_dataset do |d|
26
27
  v = v.sorted_ranks.map { |r| r[1] }.join(' ') if k == :tax
27
28
  searchable(db, d, k, v)
28
29
  end
30
+ db.execute('COMMIT')
29
31
  end
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.2.3
4
+ version: 1.2.4.1
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: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons