miga-base 0.7.12.2 → 0.7.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/lib/miga/cli.rb +7 -26
- data/lib/miga/cli/action/browse.rb +33 -6
- data/lib/miga/cli/action/browse/summary.html +5 -0
- data/lib/miga/cli/action/classify_wf.rb +1 -3
- data/lib/miga/cli/action/daemon.rb +6 -1
- data/lib/miga/cli/action/derep_wf.rb +19 -10
- data/lib/miga/cli/action/quality_wf.rb +2 -5
- data/lib/miga/cli/action/wf.rb +4 -4
- data/lib/miga/common.rb +35 -2
- data/lib/miga/daemon.rb +15 -4
- data/lib/miga/daemon/base.rb +28 -1
- data/lib/miga/version.rb +2 -2
- data/scripts/aai_distances.bash +11 -11
- data/scripts/ani_distances.bash +10 -10
- data/scripts/haai_distances.bash +11 -11
- data/test/daemon_test.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ef43a6cf94c31d470263746a242d8b065899d11e694e4c281c0ec16fc4a335
|
4
|
+
data.tar.gz: 7b086c3b966827f7e49559409f89a4ec39af6bc2aec0164be8e06466bd765029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e99ff68112b6f5d882b43a40e5ee3797e031f55d55b681ab5a9d56a83d70fe650813b3cd9127e35ac60cb88a56399b4165dd116395fcbb709c6a4748e794ef
|
7
|
+
data.tar.gz: '0870d670b3a90be77a39d027b00fdc83c01c91b9ab2e0e27ece54b1e90b64f6deb97da206bc93a1c4b1e9c9878d263b62028f63a9dac72349ebe3213f3551cfc'
|
data/README.md
CHANGED
@@ -11,11 +11,12 @@
|
|
11
11
|
|
12
12
|
For additional information on MiGA, visit:
|
13
13
|
|
14
|
-
* [MiGA Online][miga-online]: The Microbial Genomes Atlas Online
|
14
|
+
* [MiGA Online][miga-online]: The Microbial Genomes Atlas Online
|
15
|
+
* [MiGA@XSEDE][miga-at-xsede]: The MiGA@XSEDE Gateway
|
15
16
|
* [MiGA users list][mailing-list]:
|
16
|
-
Forum to discuss with other users and developers
|
17
|
-
* [MiGA manual][manual]: The definitive guide to MiGA
|
18
|
-
* [MiGA API docs][rubydoc]: Inner-workings of the `miga-base` gem
|
17
|
+
Forum to discuss with other users and developers
|
18
|
+
* [MiGA manual][manual]: The definitive guide to MiGA
|
19
|
+
* [MiGA API docs][rubydoc]: Inner-workings of the `miga-base` gem
|
19
20
|
* [MiGA Web][miga-web]: MiGA on Rails!
|
20
21
|
|
21
22
|
# For the impatient
|
@@ -39,7 +40,8 @@ You have two options:
|
|
39
40
|
|
40
41
|
Developed and maintained by [Luis M. Rodriguez-R][lrr]. MiGA is the result of a
|
41
42
|
collaboration between [Kostas Lab][kostas] at the Georgia Institute of
|
42
|
-
Technology
|
43
|
+
Technology, [Rodriguez-R Lab][lrr] at the University of Innsbruck,
|
44
|
+
and [RDP][rdp] at Michigan State University.
|
43
45
|
|
44
46
|
See also the [complete list of contributors](manual/part1/contributors.md).
|
45
47
|
|
@@ -47,7 +49,7 @@ See also the [complete list of contributors](manual/part1/contributors.md).
|
|
47
49
|
|
48
50
|
See [LICENSE](LICENSE).
|
49
51
|
|
50
|
-
[lrr]:
|
52
|
+
[lrr]: https://rodriguez-r.com/
|
51
53
|
[mailing-list]: http://support.microbial-genomes.org/
|
52
54
|
[manual]: https://manual.microbial-genomes.org/
|
53
55
|
[rubydoc]: http://www.rubydoc.info/github/bio-miga/miga
|
@@ -55,5 +57,6 @@ See [LICENSE](LICENSE).
|
|
55
57
|
[miga-web]: https://github.com/bio-miga/miga-web
|
56
58
|
[miga-gui]: https://github.com/bio-miga/miga-gui
|
57
59
|
[miga-online]: http://microbial-genomes.org/
|
60
|
+
[miga-at-xsede]: https://xsede.microbial-genomes.org/
|
58
61
|
[kostas]: http://enve-omics.gatech.edu/
|
59
62
|
[rdp]: http://rdp.cme.msu.edu/
|
data/lib/miga/cli.rb
CHANGED
@@ -110,30 +110,9 @@ class MiGA::Cli < MiGA::MiGA
|
|
110
110
|
end
|
111
111
|
|
112
112
|
##
|
113
|
-
#
|
114
|
-
|
115
|
-
|
116
|
-
# The report goes to $stderr iff --verborse
|
117
|
-
def advance(step, n = 0, total = nil, bin = true)
|
118
|
-
return unless self[:verbose]
|
119
|
-
|
120
|
-
adv = total.nil? ? (n == 0 ? '' : num_suffix(n, bin)) :
|
121
|
-
('%.1f%% (%s/%s)' % [100.0 * n / total,
|
122
|
-
num_suffix(n, bin), num_suffix(total, bin)])
|
123
|
-
$stderr.print("[%s] %s %s \r" % [Time.now, step, adv])
|
124
|
-
end
|
125
|
-
|
126
|
-
def num_suffix(n, bin = false)
|
127
|
-
p = ''
|
128
|
-
{ T: 4, G: 3, M: 2, K: 1 }.each do |k, x|
|
129
|
-
v = (bin ? 1024 : 1e3)**x
|
130
|
-
if n > v
|
131
|
-
n = '%.1f' % (n / v)
|
132
|
-
p = k
|
133
|
-
break
|
134
|
-
end
|
135
|
-
end
|
136
|
-
"#{n}#{p}"
|
113
|
+
# Same as MiGA::MiGA#advance, but checks if the CLI is verbose
|
114
|
+
def advance(*par)
|
115
|
+
super(*par) if self[:verbose]
|
137
116
|
end
|
138
117
|
|
139
118
|
##
|
@@ -189,8 +168,9 @@ class MiGA::Cli < MiGA::MiGA
|
|
189
168
|
end
|
190
169
|
|
191
170
|
##
|
192
|
-
# Perform the task requested (see #task)
|
193
|
-
|
171
|
+
# Perform the task requested (see #task); if +abort_on_error+, abort on
|
172
|
+
# error
|
173
|
+
def launch(abort_on_error = false)
|
194
174
|
begin
|
195
175
|
raise "See `miga -h`" if action.nil?
|
196
176
|
|
@@ -199,6 +179,7 @@ class MiGA::Cli < MiGA::MiGA
|
|
199
179
|
$stderr.puts "Exception: #{err}"
|
200
180
|
$stderr.puts ''
|
201
181
|
err.backtrace.each { |l| $stderr.puts "DEBUG: #{l}" }
|
182
|
+
abort if abort_on_error
|
202
183
|
err
|
203
184
|
end
|
204
185
|
end
|
@@ -15,12 +15,12 @@ class MiGA::Cli::Action::Browse < MiGA::Cli::Action
|
|
15
15
|
p = cli.load_project
|
16
16
|
create_empty_page(p)
|
17
17
|
generate_project_page(p)
|
18
|
-
say 'Creating dataset pages'
|
18
|
+
cli.say 'Creating dataset pages'
|
19
19
|
cli.load_project.each_dataset do |d|
|
20
20
|
generate_dataset_page(p, d)
|
21
21
|
end
|
22
22
|
generate_datasets_index(p)
|
23
|
-
say "Open in your browser: #{File.join(p.path, 'index.html')}"
|
23
|
+
cli.say "Open in your browser: #{File.join(p.path, 'index.html')}"
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -28,7 +28,7 @@ class MiGA::Cli::Action::Browse < MiGA::Cli::Action
|
|
28
28
|
##
|
29
29
|
# Create an empty page with necessary assets for project +p+
|
30
30
|
def create_empty_page(p)
|
31
|
-
say 'Creating project page'
|
31
|
+
cli.say 'Creating project page'
|
32
32
|
FileUtils.mkdir_p(browse_file(p, '.'))
|
33
33
|
%w[favicon-32.png style.css].each do |i|
|
34
34
|
FileUtils.cp(template_file(i), browse_file(p, i))
|
@@ -46,8 +46,9 @@ class MiGA::Cli::Action::Browse < MiGA::Cli::Action
|
|
46
46
|
|
47
47
|
# Summaries
|
48
48
|
summaries = Dir["#{p.path}/*.tsv"].map do |i|
|
49
|
-
b = File.basename(i)
|
50
|
-
|
49
|
+
b = File.basename(i, '.tsv')
|
50
|
+
generate_summary_page(i, p)
|
51
|
+
"<li><a href='s-#{b}.html'>#{format_name(b)}</a></li>"
|
51
52
|
end.join('')
|
52
53
|
|
53
54
|
# Project index page
|
@@ -60,6 +61,32 @@ class MiGA::Cli::Action::Browse < MiGA::Cli::Action
|
|
60
61
|
write_file(p, 'index.html') { build_from_template('index.html', data) }
|
61
62
|
end
|
62
63
|
|
64
|
+
##
|
65
|
+
# Create page for the summary +path+ in project +p+
|
66
|
+
def generate_summary_page(path, p)
|
67
|
+
b = File.basename(path, '.tsv')
|
68
|
+
table = '<table class="table table-hover table-responsive">'
|
69
|
+
File.open(path, 'r') do |fh|
|
70
|
+
fh.each do |ln|
|
71
|
+
r = ln.chomp.split("\t")
|
72
|
+
if $. == 1
|
73
|
+
table += '<thead><tr>' +
|
74
|
+
r.map { |i| "<th scope=col>#{format_name(i)}</th>" }.join(' ') +
|
75
|
+
'</tr></thead><tbody>'
|
76
|
+
else
|
77
|
+
table += "<tr><th scope=row>#{r.shift}</th>" +
|
78
|
+
r.map { |i| "<td>#{i}</td>" }.join(' ') + "</tr>"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
table += '</tbody></table>'
|
83
|
+
write_file(p, "s-#{b}.html") do
|
84
|
+
build_from_template(
|
85
|
+
'summary.html', file: "#{b}.tsv", name: format_name(b), table: table
|
86
|
+
)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
63
90
|
##
|
64
91
|
# Create page for dataset +d+ within project +p+
|
65
92
|
def generate_dataset_page(p, d)
|
@@ -76,7 +103,7 @@ class MiGA::Cli::Action::Browse < MiGA::Cli::Action
|
|
76
103
|
##
|
77
104
|
# Create pages for reference and query dataset indexes
|
78
105
|
def generate_datasets_index(p)
|
79
|
-
say 'Creating index pages'
|
106
|
+
cli.say 'Creating index pages'
|
80
107
|
data = format_dataset_index(p)
|
81
108
|
data.each do |k, v|
|
82
109
|
write_file(p, "#{k}_datasets.html") do
|
@@ -42,9 +42,7 @@ class MiGA::Cli::Action::ClassifyWf < MiGA::Cli::Action
|
|
42
42
|
'--no-summaries',
|
43
43
|
'Do not generate intermediate step summaries'
|
44
44
|
) { |v| cli[:summaries] = v }
|
45
|
-
opts_for_wf(
|
46
|
-
opt, 'Input genome assemblies (nucleotides, FastA)', qual: false
|
47
|
-
)
|
45
|
+
opts_for_wf(opt, 'Input genome assemblies (nucleotides, FastA)')
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -6,7 +6,7 @@ require 'miga/daemon'
|
|
6
6
|
|
7
7
|
class MiGA::Cli::Action::Daemon < MiGA::Cli::Action
|
8
8
|
def parse_cli
|
9
|
-
cli.defaults = { daemon_opts: [] }
|
9
|
+
cli.defaults = { daemon_opts: [], show_log: false }
|
10
10
|
cli.expect_operation = true
|
11
11
|
cli.parse do |opt|
|
12
12
|
opt.separator 'Available operations:'
|
@@ -45,6 +45,10 @@ class MiGA::Cli::Action::Daemon < MiGA::Cli::Action
|
|
45
45
|
'--json PATH',
|
46
46
|
'Path to a custom daemon definition in json format'
|
47
47
|
) { |v| cli[:json] = v }
|
48
|
+
opt.on(
|
49
|
+
'--show-log',
|
50
|
+
'Display log on advance instead of the progress summary'
|
51
|
+
) { |v| cli[:show_log] = v }
|
48
52
|
cli.opt_common(opt)
|
49
53
|
|
50
54
|
opt.separator 'Daemon options:'
|
@@ -73,6 +77,7 @@ class MiGA::Cli::Action::Daemon < MiGA::Cli::Action
|
|
73
77
|
d = MiGA::Daemon.new(p, cli[:json])
|
74
78
|
dopts = %i[latency maxjobs nodelist ppn shutdown_when_done]
|
75
79
|
dopts.each { |k| d.runopts(k, cli[k]) }
|
80
|
+
d.show_log! if cli[:show_log]
|
76
81
|
d.daemon(cli.operation, cli[:daemon_opts])
|
77
82
|
end
|
78
83
|
end
|
@@ -27,10 +27,13 @@ class MiGA::Cli::Action::DerepWf < MiGA::Cli::Action
|
|
27
27
|
'--threshold FLOAT', Float,
|
28
28
|
"Metric threshold (%) to dereplicate. By default: #{cli[:threshold]}"
|
29
29
|
) { |v| cli[:threshold] = v }
|
30
|
+
opt.on(
|
31
|
+
'--quality',
|
32
|
+
'Use genome with highest quality as clade representatives (default)'
|
33
|
+
) { |v| cli[:criterion] = :quality }
|
30
34
|
opt.on(
|
31
35
|
'--medoids',
|
32
|
-
'Use medoids as clade representatives'
|
33
|
-
'By default: Use genome with the highest quality'
|
36
|
+
'Use medoids as clade representatives'
|
34
37
|
) { |v| cli[:criterion] = :medoids }
|
35
38
|
opt.on(
|
36
39
|
'--no-collection',
|
@@ -47,12 +50,18 @@ class MiGA::Cli::Action::DerepWf < MiGA::Cli::Action
|
|
47
50
|
|
48
51
|
def perform
|
49
52
|
# Input data
|
50
|
-
p = create_project(
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
p = create_project(
|
54
|
+
:assembly,
|
55
|
+
{
|
56
|
+
run_project_stats: false,
|
57
|
+
run_clades: false,
|
58
|
+
gsp_metric: cli[:metric],
|
59
|
+
:"gsp_#{cli[:metric]}" => cli[:threshold]
|
60
|
+
},
|
61
|
+
{ run_mytaxa_scan: false, run_ssu: false }
|
62
|
+
)
|
54
63
|
unless cli[:threshold] >= 0.0 && cli[:threshold] <= 100.0
|
55
|
-
raise
|
64
|
+
raise 'The threshold of identity must be in the range [0,100]'
|
56
65
|
end
|
57
66
|
|
58
67
|
# Run
|
@@ -65,8 +74,8 @@ class MiGA::Cli::Action::DerepWf < MiGA::Cli::Action
|
|
65
74
|
private
|
66
75
|
|
67
76
|
def dereplicate(p)
|
68
|
-
cli.say
|
69
|
-
r = p.result(:clade_finding) or raise
|
77
|
+
cli.say 'Extracting genomospecies clades'
|
78
|
+
r = p.result(:clade_finding) or raise 'Result unavailable: run failed'
|
70
79
|
c_f = r.file_path(:clades_gsp) or raise 'Result incomplete: run failed'
|
71
80
|
clades = File.readlines(c_f).map { |i| i.chomp.split("\t") }
|
72
81
|
rep = representatives(p)
|
@@ -87,7 +96,7 @@ class MiGA::Cli::Action::DerepWf < MiGA::Cli::Action
|
|
87
96
|
end
|
88
97
|
|
89
98
|
def representatives(p)
|
90
|
-
cli.say
|
99
|
+
cli.say 'Identifying representatives'
|
91
100
|
f = File.expand_path('representatives.txt', cli[:outdir])
|
92
101
|
if cli[:criterion] == :medoids
|
93
102
|
FileUtils.cp(p.result(:clade_finding).file_path(:medoids_gsp), f)
|
@@ -9,16 +9,13 @@ class MiGA::Cli::Action::QualityWf < MiGA::Cli::Action
|
|
9
9
|
|
10
10
|
def parse_cli
|
11
11
|
default_opts_for_wf
|
12
|
-
cli.defaults = { mytaxa: false }
|
12
|
+
cli.defaults = { mytaxa: false, min_qual: 'no' }
|
13
13
|
cli.parse do |opt|
|
14
14
|
opt.on(
|
15
15
|
'-m', '--mytaxa-scan',
|
16
16
|
'Perform MyTaxa scan analysis'
|
17
17
|
) { |v| cli[:mytaxa] = v }
|
18
|
-
opts_for_wf(
|
19
|
-
opt, 'Input genome assemblies (nucleotides, FastA)',
|
20
|
-
qual: false
|
21
|
-
)
|
18
|
+
opts_for_wf(opt, 'Input genome assemblies (nucleotides, FastA)')
|
22
19
|
end
|
23
20
|
end
|
24
21
|
|
data/lib/miga/cli/action/wf.rb
CHANGED
@@ -9,7 +9,7 @@ module MiGA::Cli::Action::Wf
|
|
9
9
|
cli.defaults = {
|
10
10
|
clean: false, regexp: MiGA::Cli.FILE_REGEXP,
|
11
11
|
project_type: :genomes, dataset_type: :popgenome,
|
12
|
-
ncbi_draft: true
|
12
|
+
ncbi_draft: true, min_qual: 25.0
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
@@ -42,10 +42,10 @@ module MiGA::Cli::Action::Wf
|
|
42
42
|
end
|
43
43
|
if params[:qual]
|
44
44
|
opt.on(
|
45
|
-
'--min-qual FLOAT',
|
45
|
+
'--min-qual FLOAT',
|
46
46
|
'Minimum genome quality to include in analysis',
|
47
|
-
|
48
|
-
) { |v| cli[:min_qual] = v }
|
47
|
+
"By default: #{cli[:min_qual]}"
|
48
|
+
) { |v| cli[:min_qual] = v == 'no' ? v : v.to_f }
|
49
49
|
end
|
50
50
|
if params[:cleanup]
|
51
51
|
opt.on(
|
data/lib/miga/common.rb
CHANGED
@@ -6,6 +6,7 @@ require 'miga/json'
|
|
6
6
|
require 'miga/common/base'
|
7
7
|
require 'miga/common/path'
|
8
8
|
require 'miga/common/format'
|
9
|
+
require 'stringio'
|
9
10
|
|
10
11
|
##
|
11
12
|
# Generic class used to handle system-wide information and methods, and parent
|
@@ -38,10 +39,42 @@ class MiGA::MiGA
|
|
38
39
|
##
|
39
40
|
# Print +par+ ensuring new line at the end.
|
40
41
|
# Date/time-stamp each line.
|
41
|
-
# If the first parameter is +IO
|
42
|
+
# If the first parameter is +IO+ or +StringIO+ the output is sent there,
|
42
43
|
# otherwise it's sent to +$stderr+
|
43
44
|
def say(*par)
|
44
|
-
io = par.first
|
45
|
+
io = like_io?(par.first) ? par.shift : $stderr
|
45
46
|
io.puts(*par.map { |i| "[#{Time.now}] #{i}" })
|
46
47
|
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Reports the advance of a task at +step+ (String), the +n+ out of +total+.
|
51
|
+
# The advance is reported in powers of 1,024 if +bin+ is true, or powers of
|
52
|
+
# 1,000 otherwise.
|
53
|
+
# The report goes to $stderr iff --verborse
|
54
|
+
def advance(step, n = 0, total = nil, bin = true)
|
55
|
+
adv = total.nil? ? (n == 0 ? '' : num_suffix(n, bin)) :
|
56
|
+
('%.1f%% (%s/%s)' % [100.0 * n / total,
|
57
|
+
num_suffix(n, bin), num_suffix(total, bin)])
|
58
|
+
$stderr.print("[%s] %s %s \r" % [Time.now, step, adv])
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Return formatted number +n+ with the appropriate units as
|
63
|
+
# powers of 1,000 (if +bin+ if false) or 1,024 (otherwise)
|
64
|
+
def num_suffix(n, bin = false)
|
65
|
+
p = ''
|
66
|
+
{ T: 4, G: 3, M: 2, K: 1 }.each do |k, x|
|
67
|
+
v = (bin ? 1024 : 1e3)**x
|
68
|
+
if n > v
|
69
|
+
n = '%.1f' % (n / v)
|
70
|
+
p = k
|
71
|
+
break
|
72
|
+
end
|
73
|
+
end
|
74
|
+
"#{n}#{p}"
|
75
|
+
end
|
76
|
+
|
77
|
+
def like_io?(obj)
|
78
|
+
obj.is_a?(IO) || obj.is_a?(StringIO)
|
79
|
+
end
|
47
80
|
end
|
data/lib/miga/daemon.rb
CHANGED
@@ -72,6 +72,7 @@ class MiGA::Daemon < MiGA::MiGA
|
|
72
72
|
say '-----------------------------------'
|
73
73
|
say 'MiGA:%s launched' % project.name
|
74
74
|
say '-----------------------------------'
|
75
|
+
miga_say "Saving log to: #{output_file}" unless show_log?
|
75
76
|
recalculate_status!
|
76
77
|
load_status
|
77
78
|
say 'Configuration options:'
|
@@ -91,7 +92,8 @@ class MiGA::Daemon < MiGA::MiGA
|
|
91
92
|
flush!
|
92
93
|
if (loop_i % 12).zero?
|
93
94
|
purge!
|
94
|
-
|
95
|
+
# TEMPORARILY DISABLED:
|
96
|
+
# recalculate_status!
|
95
97
|
end
|
96
98
|
save_status
|
97
99
|
sleep(latency)
|
@@ -110,10 +112,12 @@ class MiGA::Daemon < MiGA::MiGA
|
|
110
112
|
say(*msg) if verbosity >= level
|
111
113
|
end
|
112
114
|
|
115
|
+
alias miga_say say
|
116
|
+
|
113
117
|
##
|
114
118
|
# Same as +l_say+ with +level = 1+
|
115
119
|
def say(*msg)
|
116
|
-
super(*msg) if verbosity >= 1
|
120
|
+
super(logfh, *msg) if verbosity >= 1
|
117
121
|
end
|
118
122
|
|
119
123
|
##
|
@@ -172,6 +176,12 @@ class MiGA::Daemon < MiGA::MiGA
|
|
172
176
|
o = true if ds.ref?
|
173
177
|
queue_job(:d, ds)
|
174
178
|
end
|
179
|
+
unless show_log?
|
180
|
+
n = project.dataset_names.count
|
181
|
+
k = jobs_to_run.size + jobs_running.size
|
182
|
+
advance('Datasets:', n - k, n, false)
|
183
|
+
miga_say if k == 0
|
184
|
+
end
|
175
185
|
o
|
176
186
|
end
|
177
187
|
|
@@ -331,8 +341,9 @@ class MiGA::Daemon < MiGA::MiGA
|
|
331
341
|
kill: %w[pid]
|
332
342
|
}.each do |k, v|
|
333
343
|
if !runopts(k).nil? && runopts(k) =~ /%(\d+\$)?[ds]/
|
334
|
-
runopts(
|
335
|
-
|
344
|
+
runopts(
|
345
|
+
k, runopts(k).gsub(/%(\d+\$)?d/, '%\\1s') % v.map { |i| "{{#{i}}}" }
|
346
|
+
)
|
336
347
|
end
|
337
348
|
end
|
338
349
|
runopts(:format_version, 1)
|
data/lib/miga/daemon/base.rb
CHANGED
@@ -17,7 +17,7 @@ module MiGA::Daemon::Base
|
|
17
17
|
if !force && v == 0 && k != :verbosity
|
18
18
|
raise "Daemon's #{k} cannot be set to zero"
|
19
19
|
end
|
20
|
-
when :shutdown_when_done
|
20
|
+
when :shutdown_when_done, :show_log
|
21
21
|
v = !!v
|
22
22
|
when :nodelist
|
23
23
|
if v =~ /^\$/
|
@@ -73,4 +73,31 @@ module MiGA::Daemon::Base
|
|
73
73
|
def verbosity
|
74
74
|
runopts(:verbosity) || 1
|
75
75
|
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Writing file handler (IO) to the log file
|
79
|
+
def logfh
|
80
|
+
return $stderr if show_log?
|
81
|
+
return @logfh if @logfh && @logfh.closed?
|
82
|
+
|
83
|
+
@logfh = File.open(output_file, 'w')
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Display log instead of the progress summary
|
88
|
+
def show_log!
|
89
|
+
@show_log = true
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Display progress summary instead of the log
|
94
|
+
def show_summary!
|
95
|
+
@runopts[:show_log] = false
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Display log instead of the progress summary?
|
100
|
+
def show_log?
|
101
|
+
@runopts[:show_log] ||= false
|
102
|
+
end
|
76
103
|
end
|
data/lib/miga/version.rb
CHANGED
@@ -8,7 +8,7 @@ module MiGA
|
|
8
8
|
# - Float representing the major.minor version.
|
9
9
|
# - Integer representing gem releases of the current version.
|
10
10
|
# - Integer representing minor changes that require new version number.
|
11
|
-
VERSION = [0.7,
|
11
|
+
VERSION = [0.7, 15, 1]
|
12
12
|
|
13
13
|
##
|
14
14
|
# Nickname for the current major.minor version.
|
@@ -16,7 +16,7 @@ module MiGA
|
|
16
16
|
|
17
17
|
##
|
18
18
|
# Date of the current gem release.
|
19
|
-
VERSION_DATE = Date.new(2020,
|
19
|
+
VERSION_DATE = Date.new(2020, 8, 12)
|
20
20
|
|
21
21
|
##
|
22
22
|
# Reference of MiGA.
|
data/scripts/aai_distances.bash
CHANGED
@@ -13,17 +13,20 @@ echo -n "" > miga-project.log
|
|
13
13
|
DS=$(miga ls -P "$PROJECT" --ref --no-multi --active)
|
14
14
|
|
15
15
|
# Extract values
|
16
|
-
|
17
|
-
|
18
|
-
echo "
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
rm -f miga-project.txt
|
17
|
+
(
|
18
|
+
echo "metric a b value sd n omega" | tr " " "\\t"
|
19
|
+
for i in $DS ; do
|
20
|
+
echo "SELECT CASE WHEN omega!=0 THEN 'AAI' ELSE 'hAAI_AAI' END," \
|
21
|
+
" seq1, seq2, aai, sd, n, omega from aai;" \
|
22
|
+
| sqlite3 "$i.db" | tr "\\|" "\\t"
|
23
|
+
echo "$i" >> miga-project.log
|
24
|
+
done
|
25
|
+
) | gzip -9c > miga-project.txt.gz
|
23
26
|
|
24
27
|
# R-ify
|
25
28
|
echo "
|
26
|
-
aai <- read.table('miga-project.txt', sep='\\t', h=T, as.is=TRUE);
|
29
|
+
aai <- read.table(gzfile('miga-project.txt.gz'), sep='\\t', h=T, as.is=TRUE);
|
27
30
|
save(aai, file='miga-project.Rdata');
|
28
31
|
if(sum(aai[,'a'] != aai[,'b']) > 0){
|
29
32
|
h <- hist(aai[aai[,'a'] != aai[,'b'], 'value'], breaks=100, plot=FALSE);
|
@@ -35,9 +38,6 @@ if(sum(aai[,'a'] != aai[,'b']) > 0){
|
|
35
38
|
}
|
36
39
|
" | R --vanilla
|
37
40
|
|
38
|
-
# Gzip
|
39
|
-
gzip -9 -f miga-project.txt
|
40
|
-
|
41
41
|
# Finalize
|
42
42
|
miga date > "miga-project.done"
|
43
43
|
miga add_result -P "$PROJECT" -r "$SCRIPT" -f
|
data/scripts/ani_distances.bash
CHANGED
@@ -13,16 +13,19 @@ echo -n "" > miga-project.log
|
|
13
13
|
DS=$(miga ls -P "$PROJECT" --ref --no-multi --active)
|
14
14
|
|
15
15
|
# Extract values
|
16
|
-
|
17
|
-
|
18
|
-
echo "
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
rm -f miga-project.txt
|
17
|
+
(
|
18
|
+
echo "metric a b value sd n omega" | tr " " "\\t"
|
19
|
+
for i in $DS ; do
|
20
|
+
echo "SELECT 'ANI', seq1, seq2, ani, sd, n, omega from ani ;" \
|
21
|
+
| sqlite3 "$i.db" | tr "\\|" "\\t"
|
22
|
+
echo "$i" >> miga-project.log
|
23
|
+
done
|
24
|
+
) | gzip -9c > miga-project.txt.gz
|
22
25
|
|
23
26
|
# R-ify
|
24
27
|
echo "
|
25
|
-
ani <- read.table('miga-project.txt', sep='\\t', h=T, as.is=TRUE);
|
28
|
+
ani <- read.table(gzfile('miga-project.txt.gz'), sep='\\t', h=T, as.is=TRUE);
|
26
29
|
save(ani, file='miga-project.Rdata');
|
27
30
|
if(sum(ani[,'a'] != ani[,'b']) > 0){
|
28
31
|
h <- hist(ani[ani[,'a'] != ani[,'b'], 'value'], breaks=100, plot=FALSE);
|
@@ -34,9 +37,6 @@ if(sum(ani[,'a'] != ani[,'b']) > 0){
|
|
34
37
|
}
|
35
38
|
" | R --vanilla
|
36
39
|
|
37
|
-
# Gzip
|
38
|
-
gzip -9 -f miga-project.txt
|
39
|
-
|
40
40
|
# Finalize
|
41
41
|
miga date > "miga-project.done"
|
42
42
|
miga add_result -P "$PROJECT" -r "$SCRIPT" -f
|
data/scripts/haai_distances.bash
CHANGED
@@ -17,30 +17,30 @@ echo -n "" > miga-project.log
|
|
17
17
|
DS=$(miga ls -P "$PROJECT" --ref --no-multi --active)
|
18
18
|
|
19
19
|
# Extract values
|
20
|
-
|
21
|
-
|
22
|
-
echo "
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
rm -f miga-project.txt
|
21
|
+
(
|
22
|
+
echo "metric a b value sd n omega" | tr " " "\\t"
|
23
|
+
for i in $DS ; do
|
24
|
+
echo "SELECT 'hAAI', seq1, seq2, aai, sd, n, omega from aai ;" \
|
25
|
+
| sqlite3 "$i.db" | tr "\\|" "\\t"
|
26
|
+
echo "$i" >> miga-project.log
|
27
|
+
done
|
28
|
+
) | gzip -9c > miga-project.txt.gz
|
26
29
|
|
27
30
|
# R-ify
|
28
31
|
echo "
|
29
|
-
haai <- read.table('miga-project.txt', sep='\\t', h=T, as.is=TRUE);
|
32
|
+
haai <- read.table(gzfile('miga-project.txt.gz'), sep='\\t', h=T, as.is=TRUE);
|
30
33
|
save(haai, file='miga-project.Rdata');
|
31
34
|
if(sum(haai[,'a'] != haai[,'b']) > 0){
|
32
35
|
h <- hist(haai[haai[,'a'] != haai[,'b'], 'value'], breaks=100, plot=FALSE);
|
33
36
|
write.table(
|
34
37
|
cbind(h[['breaks']][-length(h[['breaks']])],
|
35
|
-
h[['breaks']][-1],h[['counts']]),
|
38
|
+
h[['breaks']][-1], h[['counts']]),
|
36
39
|
file='miga-project.hist', quote=FALSE, sep='\\t',
|
37
40
|
col.names=FALSE, row.names=FALSE);
|
38
41
|
}
|
39
42
|
" | R --vanilla
|
40
43
|
|
41
|
-
# Gzip
|
42
|
-
gzip -9 -f miga-project.txt
|
43
|
-
|
44
44
|
# Finalize
|
45
45
|
miga date > "miga-project.done"
|
46
46
|
miga add_result -P "$PROJECT" -r "$SCRIPT" -f
|
data/test/daemon_test.rb
CHANGED
@@ -9,7 +9,7 @@ class DaemonTest < Test::Unit::TestCase
|
|
9
9
|
def setup
|
10
10
|
initialize_miga_home(
|
11
11
|
<<~DAEMON
|
12
|
-
{ "maxjobs": 1, "ppn": 1, "latency": 2, "varsep": " ",
|
12
|
+
{ "maxjobs": 1, "ppn": 1, "latency": 2, "varsep": " ", "show_log": true,
|
13
13
|
"var": "{{key}}={{value}}", "cmd": "echo {{task_name}} >/dev/null",
|
14
14
|
"alive": "echo 1 # {{pid}}", "type": "bash", "format_version": 1 }
|
15
15
|
DAEMON
|
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.
|
4
|
+
version: 0.7.15.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: 2020-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/miga/cli/action/browse/layout.html
|
129
129
|
- lib/miga/cli/action/browse/redirect.html
|
130
130
|
- lib/miga/cli/action/browse/style.css
|
131
|
+
- lib/miga/cli/action/browse/summary.html
|
131
132
|
- lib/miga/cli/action/classify_wf.rb
|
132
133
|
- lib/miga/cli/action/console.rb
|
133
134
|
- lib/miga/cli/action/daemon.rb
|