miga-base 0.7.25.0 → 0.7.25.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 +4 -4
- data/lib/miga/cli/action/init.rb +1 -1
- data/lib/miga/cli/action/option.rb +21 -2
- data/lib/miga/cli/action/wf.rb +1 -1
- data/lib/miga/result.rb +18 -15
- data/lib/miga/version.rb +1 -1
- data/test/result_test.rb +22 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5190950602fd859e89ef657912d5749879cd99dfd561e7bd0d1d571683abedfa
|
4
|
+
data.tar.gz: b3e436fde3f35a5b85a52f62d33460eb8ab627fe5d2b63c9270f74432a78d339
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d81f5d53204903b62a55b82ef817751c9c1950b13f4bd20a8120bc5c4abddbc8f2c7f4c3c0c8dabbc00342d8cc85e752a993fdd43d24b0fc66a1c74f8763594
|
7
|
+
data.tar.gz: 763e2bfe0b3c50b385637185b94f4703c9d5a72241b8dd9d9de51412d89eec943e3c62253dd7c47ccd3d09080ebacb46f534c6a05f600b65d6cd271eb4da833c
|
data/lib/miga/cli/action/init.rb
CHANGED
@@ -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:
|
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
|
-
|
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])
|
data/lib/miga/cli/action/wf.rb
CHANGED
@@ -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
|
-
#
|
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
|
-
|
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 =
|
37
|
+
r_pre = load(path)
|
35
38
|
return r_pre unless r_pre.nil?
|
36
39
|
|
37
40
|
yield
|
38
|
-
|
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) ?
|
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
|
-
|
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
|
186
|
-
f = path(i) and File.
|
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.
|
206
|
+
files = [files] unless files.is_a? Array
|
205
207
|
files.each do |file|
|
206
208
|
case blk.arity
|
207
|
-
when 1
|
208
|
-
when 2
|
209
|
-
when 3
|
210
|
-
else
|
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,
|
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)
|