miga-base 0.3.10.0 → 0.3.11.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: 27d4c5ad304eb34c537ac2e625501b21682421567c555eb7152453d00b65a49e
4
- data.tar.gz: bacf38077a05bec6c25dcbdd630b7a4f18f140ed4588877ac78254f3d9fc381d
3
+ metadata.gz: 0ff35e9287b082caf6870106450201c9153fcc4a9dc9788f5774460eb7751b38
4
+ data.tar.gz: e697b18e2df16c2c1fd4d8ee98ec837c78686e293f724b411a09a7f28bac10f1
5
5
  SHA512:
6
- metadata.gz: 9b4d8fe08eaa514a76d3c6b62d0788aa44eb2f95e4cb56eb256671033a6f2ee29482c8ffc5186c614d4f587a4af1a6d85dd1b87a980fd2edc11ebb94330b4e07
7
- data.tar.gz: a02db245387ff5185541ad98fb7556d018320eb69763cafbb37a96e1fb2fe8918b9701f13de6513a97ecd5902104414b47d380a62abf7528bb0dab5d35dc61cd
6
+ metadata.gz: 99face7b9b75edcf2e3f1e9210448a32a08b53ee2853e4548774405b276e6c3e82e475bbe9a876d91ee0c41d0df924756fd965828a1bc121cfcf0d4bc62f82cd
7
+ data.tar.gz: 42477e3181d69fc1959f78f6e8711d84890cd401467715378f0e4df8e0520944efacbc475cb40f612d4b64449f3b9f5dc3e44b2a6de15852f7442f3a3e10bd75
data/actions/doctor.rb CHANGED
@@ -5,35 +5,37 @@
5
5
 
6
6
  require "sqlite3"
7
7
 
8
- o = {q:true, ld:false,
9
- db: true, dist: true, files: true,
10
- ess: true, mts: true, start: true, tax: true}
8
+ tasks = {
9
+ db: ['databases', 'Check database files integrity'],
10
+ dist: ['distances', 'Check distance summary tables.'],
11
+ files: ['files', 'Check for outdated files.'],
12
+ ess: ['essential-genes', 'Check for unarchived essential genes'],
13
+ mts: ['mytaxa-scan', 'Check for unarchived MyTaxa scan'],
14
+ start: ['start', 'Check for lingering .start files'],
15
+ tax: ['taxonomy', 'Check for taxonomy consistency (not implemented)']
16
+ }
17
+ o = {q: true, ld: false}
18
+ tasks.keys.each{ |i| o[i] = true }
19
+ tasks_n = Hash[tasks.map{ |k,v| [v[0], k] }]
20
+
11
21
  OptionParser.new do |opt|
12
22
  opt_banner(opt)
13
23
  opt_object(opt, o, [:project])
14
- opt.on("-l", "--list-datasets",
15
- "List all fixed datasets on advance."){ |v| o[:ld]=v }
16
- opt.on("--ignore-databases",
17
- "Do not check database files integrity."){ |v| o[:db]=!v }
18
- opt.on("--ignore-distances",
19
- "Do not check distance tables."){ |v| o[:dist]=!v }
20
- opt.on("--ignore-files",
21
- "Do not check for outdated files."){ |v| o[:files]=!v }
22
- opt.on("--ignore-essential-genes",
23
- "Do not check unarchived essential genes."){ |v| o[:ess]=!v }
24
- opt.on("--ignore-mytaxa-scan",
25
- "Do not check unarchived MyTaxa scan."){ |v| o[:mts]=!v }
26
- opt.on("--ignore-start",
27
- "Do not check lingering legacy .start files."){ |v| o[:start]=!v }
28
- opt.on("--ignore-taxonomy",
29
- "Do not check taxonomy consistency."){ |v| o[:tax]=!v }
30
- opt_common(opt, o)
24
+ opt.on('-l', '--list-datasets',
25
+ 'List all fixed datasets on advance.'){ |v| o[:ld]=v }
26
+ opt.on('--ignore TASK1,TASK2', Array,
27
+ 'Do not perform the task(s) listed. Available tasks are:',
28
+ * tasks.values.map{ |v| "#{v[0]}: #{v[1]}" }
29
+ ){ |v| v.map{ |i| o[tasks_n[i]] = false } }
30
+ opt.on('--only TASK',
31
+ 'Perform only the specified task (see --ignore).'
32
+ ){ |v| tasks.keys.each{ |i| o[i] = false }; o[v] = true }
31
33
  end.parse!
32
34
 
33
35
  ##=> Main <=
34
- opt_require(o, project:"-P")
36
+ opt_require(o, project: '-P')
35
37
 
36
- $stderr.puts "Loading project" unless o[:q]
38
+ $stderr.puts 'Loading project' unless o[:q]
37
39
  p = MiGA::Project.load(o[:project])
38
40
  raise "Impossible to load project: #{o[:project]}" if p.nil?
39
41
 
@@ -48,7 +50,7 @@ def check_sqlite3_database(db_file, metric)
48
50
  end
49
51
 
50
52
  if o[:db]
51
- $stderr.puts "o Checking databases integrity" unless o[:q]
53
+ $stderr.puts 'o Checking databases integrity' unless o[:q]
52
54
  p.each_dataset do |d|
53
55
  [:distances, :taxonomy].each do |r_key|
54
56
  r = d.result(r_key) or next
@@ -97,20 +99,20 @@ end
97
99
 
98
100
  unless notok.empty?
99
101
  unless o[:q]
100
- $stderr.puts " - Unregistered datasets detected: "
102
+ $stderr.puts ' - Unregistered datasets detected: '
101
103
  if notok.size < 3
102
- $stderr.puts " - #{notok.keys.join(", ")}"
104
+ $stderr.puts " - #{notok.keys.join(', ')}"
103
105
  else
104
- $stderr.puts " - #{notok.keys.first} and other #{notok.size-1}"
106
+ $stderr.puts " - #{notok.size}, including #{notok.keys.first}"
105
107
  end
106
- $stderr.puts " - Removing tables, recompute"
108
+ $stderr.puts ' - Removing tables, recompute'
107
109
  end
108
110
  res.remove!
109
111
  end
110
112
  end if o[:dist]
111
113
 
112
114
  if o[:files]
113
- $stderr.puts "o Looking for outdated files in results" unless o[:q]
115
+ $stderr.puts 'o Looking for outdated files in results' unless o[:q]
114
116
  p.each_dataset do |d|
115
117
  d.each_result do |r_k, r|
116
118
  ok = true
@@ -122,14 +124,14 @@ if o[:files]
122
124
  end
123
125
  unless ok
124
126
  $stderr.puts " > Registering again #{d.name}:#{r_k}" if o[:ld]
125
- d.add_result(r_k, true, force:true)
127
+ d.add_result(r_k, true, force: true)
126
128
  end
127
129
  end
128
130
  end
129
131
  end
130
132
 
131
133
  if o[:ess]
132
- $stderr.puts "o Looking for unarchived essential genes." unless o[:q]
134
+ $stderr.puts 'o Looking for unarchived essential genes.' unless o[:q]
133
135
  p.each_dataset do |d|
134
136
  res = d.result(:essential_genes)
135
137
  next if res.nil?
@@ -148,7 +150,7 @@ if o[:ess]
148
150
  end
149
151
 
150
152
  if o[:mts]
151
- $stderr.puts "o Looking for unarchived MyTaxa Scan runs." unless o[:q]
153
+ $stderr.puts 'o Looking for unarchived MyTaxa Scan runs.' unless o[:q]
152
154
  p.each_dataset do |d|
153
155
  res = d.result(:mytaxa_scan)
154
156
  next if res.nil?
@@ -178,7 +180,7 @@ if o[:mts]
178
180
  end
179
181
 
180
182
  if o[:start]
181
- $stderr.puts "o Looking for legacy .start files lingering." unless o[:q]
183
+ $stderr.puts 'o Looking for legacy .start files lingering.' unless o[:q]
182
184
  p.each_dataset do |d|
183
185
  d.each_result do |r_k, r|
184
186
  if File.exist? r.path(:start)
@@ -194,5 +196,5 @@ if o[:tax]
194
196
  # TODO: Find 95%ANI clusters with entries from different species
195
197
  end
196
198
 
197
- $stderr.puts "Done" unless o[:q]
199
+ $stderr.puts 'Done' unless o[:q]
198
200
 
data/lib/miga/daemon.rb CHANGED
@@ -192,9 +192,16 @@ class MiGA::Daemon < MiGA::MiGA
192
192
  def flush!
193
193
  # Check for finished jobs
194
194
  @jobs_running.select! do |job|
195
- r = (job[:ds].nil? ? project : job[:ds]).add_result(job[:job], false)
196
- say "Completed pid:#{job[:pid]} for #{job[:task_name]}." unless r.nil?
197
- r.nil?
195
+ ongoing = case job[:job].to_s
196
+ when 'd'
197
+ not job[:ds].next_preprocessing(false).nil?
198
+ when 'p'
199
+ not project.next_task(nil, false).nil?
200
+ else
201
+ (job[:ds].nil? ? project : job[:ds]).add_result(job[:job], false).nil?
202
+ end
203
+ say "Completed pid:#{job[:pid]} for #{job[:task_name]}." unless ongoing
204
+ ongoing
198
205
  end
199
206
  # Avoid single datasets hogging resources
200
207
  @jobs_to_run.rotate! rand(jobs_to_run.size)
@@ -58,8 +58,10 @@ module MiGA::Project::Result
58
58
 
59
59
  ##
60
60
  # Get the next task from +tasks+, saving intermediate results if +save+.
61
+ # If +tasks+ is +nil+ (default), it uses the entire list of tasks.
61
62
  # Returns a Symbol.
62
- def next_task(tasks = @@DISTANCE_TASKS+@@INCLADE_TASKS, save = true)
63
+ def next_task(tasks = nil, save = true)
64
+ tasks ||= @@DISTANCE_TASKS+@@INCLADE_TASKS
63
65
  tasks.find do |t|
64
66
  if metadata["run_#{t}"] == false or
65
67
  (!is_clade? and @@INCLADE_TASKS.include?(t) and
data/lib/miga/version.rb CHANGED
@@ -10,7 +10,7 @@ module MiGA
10
10
  # - Float representing the major.minor version.
11
11
  # - Integer representing gem releases of the current version.
12
12
  # - Integer representing minor changes that require new version number.
13
- VERSION = [0.3, 10, 0]
13
+ VERSION = [0.3, 11, 0]
14
14
 
15
15
  ##
16
16
  # Nickname for the current major.minor version.
@@ -18,7 +18,7 @@ module MiGA
18
18
 
19
19
  ##
20
20
  # Date of the current gem release.
21
- VERSION_DATE = Date.new(2019, 04, 9)
21
+ VERSION_DATE = Date.new(2019, 04, 17)
22
22
 
23
23
  ##
24
24
  # Reference 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: 0.3.10.0
4
+ version: 0.3.11.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: 2019-04-09 00:00:00.000000000 Z
11
+ date: 2019-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons