miga-base 1.3.21.5 → 1.3.22.2

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: 9522358be2993d435fcece0ff3a1916919c955754bce64f02ebd32e50c1cdc11
4
- data.tar.gz: c3277224287f994d56fb1f0e27b0adc8d5dc2010ac00f48f124ca60ba55beee9
3
+ metadata.gz: 5e4cafb2b821ae172aa9537d5c71c1cafddd6ed73adfa993da1267876dddaedf
4
+ data.tar.gz: 9fe748cc53152b70fe03a3d85bcf56b517fdae772c7eb1a96329394253f5ca78
5
5
  SHA512:
6
- metadata.gz: 6cb5214b223052e199de0185960fe8371e2de08d82cdcc97dcd3e1089da28bf25e05438b3d33c4d2bb3d3ae9be4950144db9c0c79d48cbc2091292952cc88a26
7
- data.tar.gz: 1be4517ab0285d5bdbaf01b7aaa3514f459e623489c4887712a403a217268beb46b57f778d6bcd010d32cfb9716da76736c568b015b5ffc31f5b345d63ffd570
6
+ metadata.gz: 64c9508befc2bc9c7bf35041ab8ab2dc90aca74e38d80fc401dd6135e9a703135456a8cde5b88e61918007b6249b9e923b279ade15ade5c63ad2799d27b0350f
7
+ data.tar.gz: 3a74e3c63ca8332c16d5d3583890f6f4e47d8b0afd4cd178046877164083a73d918b37c04a8a8086c6c31d1b55efdf5bc913aa890869220ae5f2e68f8a976a1d
@@ -124,6 +124,13 @@ module MiGA::Cli::Action::Wf
124
124
  cli[:aai_p] = 'diamond'
125
125
  cli[:ani_p] = 'fastani'
126
126
  end
127
+ opt.on(
128
+ '--only-ani', 'Alias to: --haai-p no --aai-p no',
129
+ 'Use only for collections with expected AAI around or above 85%'
130
+ ) do
131
+ cli[:haai_p] = 'no'
132
+ cli[:aai_p] = 'no'
133
+ end
127
134
  opt.on(
128
135
  '--haai-p STRING',
129
136
  'hAAI search engine. One of: blast+, fastaai, blat, diamond, fastaai, no',
@@ -131,7 +138,7 @@ module MiGA::Cli::Action::Wf
131
138
  ) { |v| cli[:haai_p] = v }
132
139
  opt.on(
133
140
  '--aai-p STRING',
134
- 'AAI search engine. One of: blast+, blat, diamond (default)'
141
+ 'AAI search engine. One of: blast+, blat, diamond (default), no'
135
142
  ) { |v| cli[:aai_p] = v }
136
143
  opt.on(
137
144
  '--ani-p STRING',
data/lib/miga/daemon.rb CHANGED
@@ -183,7 +183,7 @@ class MiGA::Daemon < MiGA::MiGA
183
183
  end
184
184
 
185
185
  ##
186
- # Traverse datasets, and returns boolean indicating if at any reference
186
+ # Traverse datasets, and returns boolean indicating if any reference
187
187
  # datasets are incomplete
188
188
  def check_datasets
189
189
  l_say(2, 'Checking datasets')
@@ -196,11 +196,17 @@ class MiGA::Daemon < MiGA::MiGA
196
196
  queue_job(:d, ds)
197
197
  end
198
198
  unless show_log?
199
+ @_check_datasets_reported_done ||= false
199
200
  n = project.dataset_names.count
200
- k = jobs_to_run.size + jobs_running.size
201
- k -= 1 unless get_job(:maintenance).nil?
202
- advance('Datasets:', n - k, n, false)
203
- miga_say if k == 0
201
+ k = (jobs_to_run + jobs_running).select { |i| !i[:ds].nil? }.size
202
+ if k > 0
203
+ advance('Datasets:', n - k, n, false)
204
+ @_check_datasets_reported_done = false
205
+ elsif !@_check_datasets_reported_done
206
+ advance('Datasets:', n, n, false)
207
+ miga_say
208
+ @_check_datasets_reported_done = true
209
+ end
204
210
  end
205
211
  o
206
212
  end
@@ -142,7 +142,7 @@ module MiGA::Project::Base
142
142
  },
143
143
  aai_p: {
144
144
  desc: 'Value of aai.rb -p on AAI', default: 'diamond', type: String,
145
- in: %w[blast+ blast blat diamond]
145
+ in: %w[blast+ blast blat diamond no]
146
146
  },
147
147
  ani_p: {
148
148
  desc: 'Value of ani.rb -p on ANI', default: 'fastani', type: String,
@@ -154,7 +154,14 @@ module MiGA::Project::Base
154
154
  },
155
155
  aai_save_rbm: {
156
156
  desc: 'Should RBMs be saved for OGS analysis?',
157
- default: proc { |project| project.clade? },
157
+ default: proc do |project|
158
+ project.clade? && project.option(:aai_p) != 'no'
159
+ end,
160
+ in: [true, false]
161
+ },
162
+ run_ogs: {
163
+ desc: 'Should orthologous groups be estimated?',
164
+ default: proc { |project| project.option(:aai_save_rbm) },
158
165
  in: [true, false]
159
166
  },
160
167
  ogs_identity: {
@@ -31,9 +31,11 @@ module MiGA::Project::Result
31
31
  ##
32
32
  # Is this +task+ to be bypassed?
33
33
  def ignore_task?(task)
34
- return true if metadata["run_#{task}"] == false
34
+ opt = "run_#{task}"
35
+ return true if metadata[opt] == false
36
+ return true if option?(opt) && option(opt) == false
35
37
 
36
- !clade? && @@INCLADE_TASKS.include?(task) && metadata["run_#{task}"] != true
38
+ !clade? && @@INCLADE_TASKS.include?(task) && metadata[opt] != true
37
39
  end
38
40
 
39
41
  ##
@@ -72,20 +74,21 @@ module MiGA::Project::Result
72
74
  ##
73
75
  # Add result type +:clade_finding+ at +base+ (no +_opts+ supported).
74
76
  def add_result_clade_finding(base, _opts)
77
+ r = nil
75
78
  if result_files_exist?(base, %w[.empty])
76
79
  r = MiGA::Result.new("#{base}.json")
77
80
  r.add_file(:empty, 'miga-project.empty')
78
- return r
79
- end
80
- return nil unless result_files_exist?(base, %w[.proposed-clades])
81
- unless clade? ||
82
- result_files_exist?(
83
- base, %w[.pdf .classif .medoids .class.tsv .class.nwk]
84
- )
85
- return nil
81
+ else
82
+ return nil unless result_files_exist?(base, %w[.proposed-clades])
83
+ unless clade? ||
84
+ result_files_exist?(
85
+ base, %w[.pdf .classif .medoids .class.tsv .class.nwk]
86
+ )
87
+ return nil
88
+ end
89
+ r = add_result_iter_clades(base)
86
90
  end
87
91
 
88
- r = add_result_iter_clades(base)
89
92
  r.add_file(:aai_dist_rds, 'miga-project.dist.rds')
90
93
  r.add_file(:aai_dist_rda, 'miga-project.dist.rda')
91
94
  r.add_file(:aai_tree, 'miga-project.aai.nwk')
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.3, 21, 5].freeze
15
+ VERSION = [1.3, 22, 2].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(2025, 1, 16)
23
+ VERSION_DATE = Date.new(2025, 2, 20)
24
24
 
25
25
  ##
26
26
  # References of MiGA
@@ -60,10 +60,15 @@ module MiGA::DistanceRunner::Commands
60
60
  # Note that ANI values may be returned for lower (or failing) AAIs if the
61
61
  # value is already stored in the database
62
62
  def ani_after_aai(targets, aai_limit = 85.0)
63
- # Run AAI and select targets with AAI ≥ aai_limit
64
- aai = aai(targets)
65
- sbj = aai.each_with_index.map { |i, k| targets[k] if i&.> aai_limit }
66
- sbj.compact!
63
+ sbj =
64
+ if opts[:aai_p] == 'no'
65
+ # If we skip AAI, run ANI for all targets
66
+ targets
67
+ else
68
+ # Otherwise, run AAI and select targets with AAI ≥ aai_limit
69
+ aai = aai(targets)
70
+ aai.each_with_index.map { |i, k| targets[k] if i&.> aai_limit }.compact
71
+ end
67
72
 
68
73
  # Run ANI
69
74
  ani(sbj) unless sbj.empty?
@@ -110,37 +115,37 @@ module MiGA::DistanceRunner::Commands
110
115
  f1 = tmp_file('largecontigs.fa')
111
116
  return unless File.size?(f1)
112
117
 
113
- # Run FastANI
114
- empty = true
115
- File.open(f2 = tmp_file, 'w') do |fh|
116
- targets.each do |target|
117
- target_asm = target&.result(:assembly)&.file_path(:largecontigs)
118
- if target_asm
119
- fh.puts target_asm
120
- empty = false
121
- end
118
+ # Select targets with assemblies
119
+ target_asm =
120
+ targets.map do |target|
121
+ target&.result(:assembly)&.file_path(:largecontigs)
122
+ end.compact
123
+
124
+ # Run FastANI in batches of up to 100 genomes
125
+ until target_asm.empty?
126
+ File.open(f2 = tmp_file, 'w') do |fh|
127
+ target_asm.shift(100).each { |i| fh.puts i }
122
128
  end
123
- end
124
- return if empty
125
- run_cmd <<~CMD
126
- fastANI -q "#{f1}" --rl "#{f2}" -t #{opts[:thr]} \
127
- -o "#{f3 = tmp_file}"
128
- CMD
129
+ run_cmd <<~CMD
130
+ fastANI -q "#{f1}" --rl "#{f2}" -t #{opts[:thr]} \
131
+ -o "#{f3 = tmp_file}"
132
+ CMD
129
133
 
130
- # Retrieve resulting data and save to DB
131
- data = {}
132
- File.open(f3, 'r') do |fh|
133
- fh.each do |ln|
134
- row = ln.chomp.split("\t")
135
- n2 = File.basename(row[1], '.gz')
136
- n2 = File.basename(n2, '.LargeContigs.fna')
137
- data[n2] = [row[2].to_f, 0.0, row[3].to_i, row[4].to_i]
134
+ # Retrieve resulting data and save to DB
135
+ data = {}
136
+ File.open(f3, 'r') do |fh|
137
+ fh.each do |ln|
138
+ row = ln.chomp.split("\t")
139
+ n2 = File.basename(row[1], '.gz')
140
+ n2 = File.basename(n2, '.LargeContigs.fna')
141
+ data[n2] = [row[2].to_f, 0.0, row[3].to_i, row[4].to_i]
142
+ end
138
143
  end
139
- end
140
- batch_data_to_db(:ani, data)
144
+ batch_data_to_db(:ani, data)
141
145
 
142
- # Cleanup
143
- [f2, f3].each { |i| File.unlink(i) }
146
+ # Cleanup
147
+ [f2, f3].each { |i| File.unlink(i) }
148
+ end
144
149
  end
145
150
 
146
151
  ##
data/utils/subclades.R CHANGED
@@ -226,8 +226,9 @@ generate_empty_files <- function (out_base) {
226
226
  plot(1, t = "n", axes = F)
227
227
  legend("center", "No data", bty = "n")
228
228
  dev.off()
229
- file.create(paste(out_base, ".1.classif", sep = ""))
230
- file.create(paste(out_base, ".1.medoids", sep = ""))
229
+ file.create(paste0(out_base, ".1.classif"))
230
+ file.create(paste0(out_base, ".1.medoids"))
231
+ file.create(paste0(out_base, ".empty"))
231
232
  }
232
233
 
233
234
  write_text_report <- function (out_base, ani.d, ani.medoids, ani.types) {
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.3.21.5
4
+ version: 1.3.22.2
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: 2025-01-16 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons