miga-base 0.7.25.0 → 0.7.25.1

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: fefd5ed0ec84f2b49d25243ecaec7e567000c04598605ba8a78d0a866c35e5b1
4
- data.tar.gz: b0f473401ccf64d31fcfc0ed19b54a2b84d29c138e3f983a69083659fcfe547e
3
+ metadata.gz: 5190950602fd859e89ef657912d5749879cd99dfd561e7bd0d1d571683abedfa
4
+ data.tar.gz: b3e436fde3f35a5b85a52f62d33460eb8ab627fe5d2b63c9270f74432a78d339
5
5
  SHA512:
6
- metadata.gz: 2520f7169e91e38aed0027e679d0cbc126271a6948ce27916bef9a34299eb50df249568d06bbdb09c5ff13754ec7628d48d7154a18c5bf363628b69d241757c2
7
- data.tar.gz: 0e684e321ec13e022f95d0499c2c83fea6230bbcadbaacce226e20423cda9ea7466fac929b579e29b6a50745b243da53b9d1697a5e08876b2d423d577205e269
6
+ metadata.gz: 5d81f5d53204903b62a55b82ef817751c9c1950b13f4bd20a8120bc5c4abddbc8f2c7f4c3c0c8dabbc00342d8cc85e752a993fdd43d24b0fc66a1c74f8763594
7
+ data.tar.gz: 763e2bfe0b3c50b385637185b94f4703c9d5a72241b8dd9d9de51412d89eec943e3c62253dd7c47ccd3d09080ebacb46f534c6a05f600b65d6cd271eb4da833c
@@ -220,7 +220,7 @@ class MiGA::Cli::Action::Init < MiGA::Cli::Action
220
220
  run_cmd(cli, x)
221
221
  when :python
222
222
  x = "#{paths['python3'].shellescape} \
223
- -m pip install #{pkg.shellescape} 2>&1"
223
+ -m pip install --user #{pkg.shellescape} 2>&1"
224
224
  run_cmd(cli, x)
225
225
  else
226
226
  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, 25, 1].freeze
14
14
 
15
15
  ##
16
16
  # Nickname for the current major.minor version.
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)
metadata CHANGED
@@ -1,7 +1,7 @@
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.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R