miga-base 0.7.25.0 → 0.7.26.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: fefd5ed0ec84f2b49d25243ecaec7e567000c04598605ba8a78d0a866c35e5b1
4
- data.tar.gz: b0f473401ccf64d31fcfc0ed19b54a2b84d29c138e3f983a69083659fcfe547e
3
+ metadata.gz: 74e57f731ce86c12ef281aedd1e30448d432f793d3e1c1be85b91dc360f3e50b
4
+ data.tar.gz: 50ee4a65a402a35be72b21f4258b6b74b1cc2fb90bb4a675f77ad7ecf6090cc2
5
5
  SHA512:
6
- metadata.gz: 2520f7169e91e38aed0027e679d0cbc126271a6948ce27916bef9a34299eb50df249568d06bbdb09c5ff13754ec7628d48d7154a18c5bf363628b69d241757c2
7
- data.tar.gz: 0e684e321ec13e022f95d0499c2c83fea6230bbcadbaacce226e20423cda9ea7466fac929b579e29b6a50745b243da53b9d1697a5e08876b2d423d577205e269
6
+ metadata.gz: 8148b3c9693200bd02168118967122c0d77ba32bcf512b73e3c3951593f921f81d18f579f64c791859d4de3aba3d742ed06cbbd9926baa00dff832be7062a193
7
+ data.tar.gz: aa4d25c09558448455ee08a25b584802de1354298d5b3cc9881dd87b116bf2c98c834d6ae54efa097a7e3b802996db24714abbc76bc68d069533133b155c9d5d
@@ -14,6 +14,8 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
14
14
  cli.defaults = {
15
15
  mytaxa: nil,
16
16
  rdp: nil,
17
+ reads: nil,
18
+ optional: nil,
17
19
  config: File.join(ENV['MIGA_HOME'], '.miga_modules'),
18
20
  ask: false,
19
21
  auto: false,
@@ -35,6 +37,16 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
35
37
  'Should I try setting up the RDP classifier?',
36
38
  'By default: interactive (true if --auto)'
37
39
  ) { |v| cli[:rdp] = v }
40
+ opt.on(
41
+ '--[no-]read-processing',
42
+ 'Should I try setting up read processing software?',
43
+ 'By default: interactive (true if --auto)'
44
+ ) { |v| cli[:reads] = v }
45
+ opt.on(
46
+ '--[no-]optional',
47
+ 'Should I try setting up the optional software?',
48
+ 'Automatically sets answers for mytaxa, rdp, and reads'
49
+ ) { |v| cli[:optional] = v }
38
50
  opt.on(
39
51
  '--daemon-type STRING',
40
52
  'Type of daemon launcher, one of: bash, ssh, qsub, msub, slurm',
@@ -104,6 +116,8 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
104
116
  rc_fh.puts "export MIGA_MYTAXA='#{cli[:mytaxa] ? 'yes' : 'no'}'"
105
117
  ask_for_optional(:rdp, 'RDP classifier')
106
118
  rc_fh.puts "export MIGA_RDP='#{cli[:rdp] ? 'yes' : 'no'}'"
119
+ ask_for_optional(:reads, 'read processing')
120
+ rc_fh.puts "export MIGA_READS='#{cli[:reads] ? 'yes' : 'no'}'"
107
121
  paths = {}
108
122
  rc_fh.puts 'MIGA_PATH=""'
109
123
  req_path = File.expand_path('utils/requirements.txt', MiGA.root_path)
@@ -123,20 +137,20 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
123
137
  def define_software(ln)
124
138
  r = ln.chomp.split(/\t+/)
125
139
  return if %w[Software --------].include?(r[0])
126
- return if r[0] =~ /\(mytaxa\)$/ && !cli[:mytaxa]
127
- return if r[0] =~ /\(rdp\)$/ && !cli[:rdp]
140
+ %i[mytaxa rdp reads].each { |i| return if r[0] =~ /\(#{i}\)$/ && !cli[i] }
128
141
 
129
142
  r
130
143
  end
131
144
 
132
145
  def ask_for_optional(symbol, name)
133
- if cli[symbol].nil?
134
- cli[symbol] =
135
- cli.ask_user(
136
- "Should I include #{name} modules?",
137
- 'yes', %w(yes no)
138
- ) == 'yes'
139
- end
146
+ cli[symbol] = cli[:optional] if !cli[:optional].nil? && cli[symbol].nil?
147
+ return cli[symbol] unless cli[symbol].nil?
148
+
149
+ cli[symbol] =
150
+ cli.ask_user(
151
+ "Should I include #{name} modules?",
152
+ 'yes', %w(yes no)
153
+ ) == 'yes'
140
154
  end
141
155
 
142
156
  def find_software(exec)
@@ -220,7 +234,7 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
220
234
  run_cmd(cli, x)
221
235
  when :python
222
236
  x = "#{paths['python3'].shellescape} \
223
- -m pip install #{pkg.shellescape} 2>&1"
237
+ -m pip install --user #{pkg.shellescape} 2>&1"
224
238
  run_cmd(cli, x)
225
239
  else
226
240
  raise "Unrecognized language: #{language}"
@@ -17,6 +17,14 @@ class MiGA::Cli::Action::Option < MiGA::Cli::Action
17
17
  'Value of the option to set (by default, option value is not changed)',
18
18
  'Recognized tokens: nil, true, false'
19
19
  ) { |v| cli[:value] = v }
20
+ opt.on(
21
+ '--about',
22
+ 'Print additional information about the values supported by this option'
23
+ ) { |v| cli[:about] = v }
24
+ opt.on(
25
+ '--tab',
26
+ 'Return a tab-delimited table'
27
+ ) { |v| cli[:tabular] = v }
20
28
  opt.on(
21
29
  '-o', '--output PATH',
22
30
  'Create output file instead of returning to STDOUT'
@@ -28,13 +36,24 @@ class MiGA::Cli::Action::Option < MiGA::Cli::Action
28
36
  unless cli[:value].nil?
29
37
  cli.ensure_par(
30
38
  { key: '-k' },
31
- '%<name>s is mandatory when --value is set: please provide %<flag>s'
39
+ '%<name>s is mandatory when --value is set: provide %<flag>s'
32
40
  )
33
41
  end
34
42
  obj = cli.load_project_or_dataset
35
43
  io = cli[:output].nil? ? $stdout : File.open(cli[:output], 'w')
36
44
  if cli[:key].nil?
37
- cli.table(%w[Key Value], obj.all_options.to_a, io)
45
+ opts = obj.all_options
46
+ .map { |k, v| [k, v, obj.assert_has_option(k)[:desc]] }
47
+ cli.table(%w[Key Value Definition], opts, io)
48
+ elsif cli[:about]
49
+ opt = obj.assert_has_option(cli[:key])
50
+ title = "#{cli[:key]}: #{opt[:desc]}"
51
+ io.puts title
52
+ io.puts '-' * title.length
53
+ opt.each do |k, v|
54
+ v = v[obj] if v.is_a? Proc
55
+ io.puts "#{k.to_s.capitalize}: #{v}" unless k == :desc
56
+ end
38
57
  else
39
58
  obj.set_option(cli[:key], cli[:value], true) unless cli[:value].nil?
40
59
  io.puts obj.option(cli[:key])
@@ -87,7 +87,7 @@ module MiGA::Cli::Action::Wf
87
87
  end
88
88
  opt.on(
89
89
  '--haai-p STRING',
90
- 'hAAI search engine. One of: blast+ (default), blat, diamond, no'
90
+ 'hAAI search engine. One of: blast+ (default), fastaai, blat, diamond, no'
91
91
  ) { |v| cli[:haai_p] = v }
92
92
  opt.on(
93
93
  '--aai-p STRING',
data/lib/miga/result.rb CHANGED
@@ -1,5 +1,4 @@
1
- # @package MiGA
2
- # @license Artistic-2.0
1
+ # frozen_string_literal: true
3
2
 
4
3
  require 'miga/result/dates'
5
4
  require 'miga/result/source'
@@ -29,13 +28,17 @@ class MiGA::Result < MiGA::MiGA
29
28
  MiGA::Result.new(path)
30
29
  end
31
30
 
32
- def create(path, force = false, &blk)
31
+ ##
32
+ # Check if +path+ describes a result and otherwise create
33
+ # it using the passed block. If +force+, ignore existing
34
+ # JSON in +path+ if any.
35
+ def create(path, force = false)
33
36
  FileUtils.rm(path) if force && File.exist?(path)
34
- r_pre = self.load(path)
37
+ r_pre = load(path)
35
38
  return r_pre unless r_pre.nil?
36
39
 
37
40
  yield
38
- self.load(path)
41
+ load(path)
39
42
  end
40
43
  end
41
44
 
@@ -49,7 +52,7 @@ class MiGA::Result < MiGA::MiGA
49
52
  # Load or create the MiGA::Result described by the JSON file +path+
50
53
  def initialize(path)
51
54
  @path = File.absolute_path(path)
52
- MiGA::Result.exist?(@path) ? self.load : create
55
+ MiGA::Result.exist?(@path) ? load : create
53
56
  end
54
57
 
55
58
  ##
@@ -162,7 +165,7 @@ class MiGA::Result < MiGA::MiGA
162
165
  File.unlink s
163
166
  end
164
167
  MiGA::Json.generate(data, path)
165
- self.load
168
+ load
166
169
  end
167
170
 
168
171
  ##
@@ -182,10 +185,9 @@ class MiGA::Result < MiGA::MiGA
182
185
  # Unlink result by removing the .done and .start timestamps and the
183
186
  # .json descriptor, but don't remove any other associated files
184
187
  def unlink
185
- %i(start done).each do |i|
186
- f = path(i) and File.exists?(f) and File.unlink(f)
188
+ %i[start done json].each do |i|
189
+ f = path(i) and File.exist?(f) and File.unlink(f)
187
190
  end
188
- File.unlink path
189
191
  end
190
192
 
191
193
  ##
@@ -201,13 +203,14 @@ class MiGA::Result < MiGA::MiGA
201
203
 
202
204
  @data[:files] ||= {}
203
205
  self[:files].each do |k, files|
204
- files = [files] unless files.kind_of? Array
206
+ files = [files] unless files.is_a? Array
205
207
  files.each do |file|
206
208
  case blk.arity
207
- when 1; blk.call(file)
208
- when 2; blk.call(k, file)
209
- when 3; blk.call(k, file, File.expand_path(file, dir))
210
- else; raise "Wrong number of arguments: #{blk.arity} for 1..3"
209
+ when 1 then blk.call(file)
210
+ when 2 then blk.call(k, file)
211
+ when 3 then blk.call(k, file, File.expand_path(file, dir))
212
+ else
213
+ raise "Wrong number of arguments: #{blk.arity} for 1..3"
211
214
  end
212
215
  end
213
216
  end
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.7, 25, 0].freeze
13
+ VERSION = [0.7, 26, 1].freeze
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(2021, 2, 22)
21
+ VERSION_DATE = Date.new(2021, 3, 1)
22
22
 
23
23
  ##
24
24
  # Reference of MiGA.
data/test/result_test.rb CHANGED
@@ -38,6 +38,28 @@ class ResultTest < Test::Unit::TestCase
38
38
  assert_instance_of(MiGA::Result, r)
39
39
  end
40
40
 
41
+ def test_unlink
42
+ r = project.add_result(:clade_finding)
43
+ path = r.path
44
+ done = r.path(:done)
45
+ data = r.file_path(:empty)
46
+ assert(File.exist?(path))
47
+ assert(File.exist?(done))
48
+ assert(File.exist?(data))
49
+ r.unlink
50
+ assert(!File.exist?(path))
51
+ assert(!File.exist?(done))
52
+ assert(File.exist?(data))
53
+ end
54
+
55
+ def test_remove
56
+ r = project.add_result(:clade_finding)
57
+ data = r.file_path(:empty)
58
+ assert(File.exist?(data))
59
+ r.remove!
60
+ assert(!File.exist?(data))
61
+ end
62
+
41
63
  def test_result_source
42
64
  r = dataset.add_result(:trimmed_reads)
43
65
  assert_equal(dataset.name, r.source.name)
@@ -15,7 +15,7 @@ module MiGA::DistanceRunner::Pipeline
15
15
  values = send(metric, sbj_datasets)
16
16
  max_idx = values.map(&:to_f).each_with_index.max[1]
17
17
  max_val = values[max_idx]
18
- val_med = sbj_dataset[max_idx].name
18
+ val_med = sbj_datasets[max_idx].name
19
19
  val_cls = max_idx + 1
20
20
  puts "[#{classif}] New max: #{val_med} (#{val_cls}): #{max_val}"
21
21
 
@@ -102,7 +102,8 @@ class MiGA::DistanceRunner
102
102
  cl_path = res.file_path :clades_ani95
103
103
  if !cl_path.nil? && File.size?(cl_path) && tsk[0] == :clade_finding
104
104
  clades = File.foreach(cl_path).map { |i| i.chomp.split(',') }
105
- sbj_datasets = clades.find { |i| i.include?(closest[:ds]) }
105
+ sbj_dataset_names = clades.find { |i| i.include?(closest[:ds]) }
106
+ sbj_datasets = sbj_dataset_names&.map { |i| ref_project.dataset(i) }
106
107
  ani_after_aai(sbj_datasets, 80.0) if sbj_datasets
107
108
  end
108
109
 
@@ -10,12 +10,12 @@ FastANI fastANI https://github.com/ParBLiSS/FastANI Required version: 1.1+
10
10
  HMMer 3.0+ hmmsearch http://hmmer.janelia.org/software
11
11
  Bedtools bedtools http://bedtools.readthedocs.org/en/latest/
12
12
  Prodigal prodigal http://prodigal.ornl.gov
13
- IDBA idba_ud http://i.cs.hku.hk/~alse/hkubrg/projects/idba
14
13
  MCL mcl http://micans.org/mcl/
15
14
  Barrnap barrnap http://www.vicbioinformatics.com/software.barrnap.shtml
16
- Scythe scythe https://github.com/vsbuffalo/scythe Required version: 0.991+
17
- FastQC fastqc http://www.bioinformatics.babraham.ac.uk/projects/fastqc
18
- SolexaQA++ SolexaQA++ http://solexaqa.sourceforge.net Required version: v3.1.3+
15
+ IDBA (reads) idba_ud http://i.cs.hku.hk/~alse/hkubrg/projects/idba
16
+ Scythe (reads) scythe https://github.com/vsbuffalo/scythe Required version: 0.991+
17
+ FastQC (reads) fastqc http://www.bioinformatics.babraham.ac.uk/projects/fastqc
18
+ SolexaQA++ (reads) SolexaQA++ http://solexaqa.sourceforge.net Required version: v3.1.3+
19
19
  OpenJDK (rdp) java https://adoptopenjdk.net/ Any Java VM would work
20
20
  MyTaxa (mytaxa) MyTaxa http://enve-omics.ce.gatech.edu/mytaxa
21
21
  Krona (mytaxa) ktImportText https://github.com/marbl/Krona/wiki
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.7.25.0
4
+ version: 0.7.26.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: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons