miga-base 0.3.9.0 → 0.3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/actions/add.rb +33 -33
- data/actions/edit.rb +33 -0
- data/actions/new.rb +17 -18
- data/actions/next_step.rb +33 -0
- data/actions/run.rb +15 -12
- data/bin/miga +43 -37
- data/lib/miga/daemon.rb +2 -2
- data/lib/miga/project/result.rb +16 -1
- data/lib/miga/version.rb +2 -2
- data/scripts/aai_distances.bash +1 -3
- data/scripts/ani_distances.bash +1 -3
- data/scripts/assembly.bash +1 -3
- data/scripts/cds.bash +1 -3
- data/scripts/clade_finding.bash +1 -3
- data/scripts/d.bash +13 -0
- data/scripts/distances.bash +1 -3
- data/scripts/essential_genes.bash +1 -3
- data/scripts/haai_distances.bash +1 -3
- data/scripts/miga.bash +12 -9
- data/scripts/mytaxa.bash +1 -3
- data/scripts/mytaxa_scan.bash +1 -3
- data/scripts/ogs.bash +36 -33
- data/scripts/p.bash +23 -0
- data/scripts/project_stats.bash +1 -3
- data/scripts/read_quality.bash +1 -3
- data/scripts/ssu.bash +1 -3
- data/scripts/stats.bash +1 -3
- data/scripts/subclades.bash +1 -3
- data/scripts/taxonomy.bash +1 -3
- data/scripts/trimmed_fasta.bash +1 -3
- data/scripts/trimmed_reads.bash +1 -3
- data/test/daemon_test.rb +3 -3
- data/utils/distance/runner.rb +1 -1
- data/utils/enveomics/Docs/recplot2.md +13 -2
- data/utils/enveomics/Examples/aai-matrix.bash +3 -3
- data/utils/enveomics/Examples/ani-matrix.bash +3 -3
- data/utils/enveomics/Makefile +2 -2
- data/utils/enveomics/Manifest/Tasks/blasttab.json +12 -4
- data/utils/enveomics/Manifest/Tasks/fasta.json +135 -0
- data/utils/enveomics/Manifest/Tasks/other.json +49 -0
- data/utils/enveomics/Manifest/categories.json +4 -0
- data/utils/enveomics/Manifest/examples.json +1 -1
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.N50.pl +1 -1
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.filterN.pl +1 -1
- data/utils/enveomics/Pipelines/assembly.pbs/FastA.length.pl +1 -1
- data/utils/enveomics/Pipelines/blast.pbs/FastA.split.pl +1 -1
- data/utils/enveomics/Scripts/BlastTab.catsbj.pl +63 -65
- data/utils/enveomics/Scripts/BlastTab.recplot2.R +4 -2
- data/utils/enveomics/Scripts/FastA.extract.rb +152 -0
- data/utils/enveomics/Scripts/FastA.mask.rb +89 -0
- data/utils/enveomics/Scripts/FastA.sample.rb +83 -0
- data/utils/enveomics/Scripts/GFF.catsbj.pl +127 -0
- data/utils/enveomics/Scripts/aai.rb +4 -3
- data/utils/enveomics/Scripts/lib/enveomics.R +1 -1
- data/utils/enveomics/enveomics.R/DESCRIPTION +1 -2
- data/utils/enveomics/enveomics.R/NAMESPACE +3 -3
- data/utils/enveomics/enveomics.R/R/recplot.R +2 -3
- data/utils/enveomics/enveomics.R/R/recplot2.R +221 -160
- data/utils/enveomics/enveomics.R/R/utils.R +19 -1
- data/utils/enveomics/enveomics.R/README.md +11 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot.Rd +2 -2
- data/utils/enveomics/enveomics.R/man/enve.recplot2-class.Rd +1 -0
- data/utils/enveomics/enveomics.R/man/enve.recplot2.Rd +13 -5
- data/utils/enveomics/enveomics.R/man/enve.recplot2.extractWindows.Rd +10 -8
- data/utils/enveomics/enveomics.R/man/enve.recplot2.findPeaks.mower.Rd +1 -1
- data/utils/enveomics/enveomics.R/man/enve.recplot2.windowDepthThreshold.Rd +26 -0
- data/utils/enveomics/enveomics.R/man/enve.truncate.Rd +22 -0
- data/utils/enveomics/enveomics.R/man/plot.enve.recplot2.Rd +13 -7
- data/utils/enveomics/enveomics.R/man/z$-methods.Rd +3 -4
- data/utils/subclade/runner.rb +4 -0
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89d27413bd8dc321a75fc3dc434a191c1eba336bfab3beaaa1e815852048e30a
|
4
|
+
data.tar.gz: 59eeab21ff1ef81bf76147c1b98c3a49e31535831fe19e8ec2757b59a666dd4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4d975743a230c951578605e93a1b4f3061e8e3d1c91cf147db5c297bfa2427de344a72f118c50d0a3b3e9b2e67137baed9cc14157e86aa3d98738bb09d334f
|
7
|
+
data.tar.gz: d9761542220413d20b162bceeada84cf414d9d17b10764d049b3a76c2f9a3d757389b24c0ac290e02801246c114496e4729c45da5e5b863c22fde009c2eeca66
|
data/actions/add.rb
CHANGED
@@ -3,39 +3,39 @@
|
|
3
3
|
# @package MiGA
|
4
4
|
# @license Artistic-2.0
|
5
5
|
|
6
|
-
o = {q:true, ref:true, update:false}
|
6
|
+
o = {q: true, ref: true, update: false}
|
7
7
|
OptionParser.new do |opt|
|
8
8
|
opt_banner(opt)
|
9
9
|
opt_object(opt, o, [:project, :dataset, :dataset_type_req])
|
10
|
-
opt.on(
|
11
|
-
|
12
|
-
){ |v| o[:ref]
|
13
|
-
opt.on(
|
14
|
-
|
15
|
-
opt.on(
|
16
|
-
|
17
|
-
opt.on(
|
18
|
-
|
19
|
-
|
20
|
-
){ |v| o[:metadata]=v }
|
21
|
-
opt.on(
|
22
|
-
|
10
|
+
opt.on('-q', '--query',
|
11
|
+
'If set, the dataset is registered as a query, not a reference dataset.'
|
12
|
+
){ |v| o[:ref] = !v }
|
13
|
+
opt.on('-d', '--description STRING',
|
14
|
+
'Description of the dataset.'){ |v| o[:description] = v }
|
15
|
+
opt.on('-c', '--comments STRING',
|
16
|
+
'Comments on the dataset.'){ |v| o[:comments] = v }
|
17
|
+
opt.on('-m', '--metadata STRING',
|
18
|
+
'Metadata as key-value pairs separated by = and delimited by comma.',
|
19
|
+
'Values are saved as strings except for booleans (true / false) or nil.'
|
20
|
+
){ |v| o[:metadata] = v }
|
21
|
+
opt.on('--update', 'Updates the dataset if it already exists.',
|
22
|
+
'Same as "miga edit".'){ o[:update] = true }
|
23
23
|
opt_common(opt, o)
|
24
|
-
opt.separator
|
25
|
-
opt.separator
|
26
|
-
opt.on(
|
27
|
-
|
28
|
-
|
24
|
+
opt.separator ''
|
25
|
+
opt.separator 'External input data'
|
26
|
+
opt.on('--raw-reads FILE1,FILE2', Array,
|
27
|
+
'Comma-delimited paths to the raw reads in FastQ format.',
|
28
|
+
'One file is assumed to be single reads, two are assumed to be paired.'
|
29
29
|
){ |v| o[:raw_reads] = v }
|
30
|
-
opt.on(
|
31
|
-
|
30
|
+
opt.on('--trimmed-fasta-single FILE', Array,
|
31
|
+
'Path to the single trimmed reads in FastA format.'
|
32
32
|
){ |v| o[:trimmed_fasta_s] = v }
|
33
|
-
opt.on(
|
34
|
-
|
35
|
-
|
33
|
+
opt.on('--trimmed-fasta-coupled FILE1,FILE2', Array,
|
34
|
+
'Comma-delimited paths to the coupled trimmed reads in FastA format.',
|
35
|
+
'One file is assumed to be interposed, two are assumed to contain sisters.'
|
36
36
|
){ |v| o[:trimmed_fasta_c] = v }
|
37
|
-
opt.on(
|
38
|
-
|
37
|
+
opt.on('--assembly FILE', Array,
|
38
|
+
'Path to the contigs (or scaffolds) of the assembly in FastA format.'
|
39
39
|
){ |v| o[:assembly] = v }
|
40
40
|
end.parse!
|
41
41
|
|
@@ -43,16 +43,16 @@ end.parse!
|
|
43
43
|
opt_require(o)
|
44
44
|
opt_require_type(o, MiGA::Dataset) unless o[:update]
|
45
45
|
|
46
|
-
$stderr.puts
|
46
|
+
$stderr.puts 'Loading project.' unless o[:q]
|
47
47
|
p = MiGA::Project.load(o[:project])
|
48
48
|
raise "Impossible to load project: #{o[:project]}" if p.nil?
|
49
49
|
|
50
|
-
raise
|
50
|
+
raise 'Dataset already exists, aborting.' unless
|
51
51
|
o[:update] or not MiGA::Dataset.exist?(p, o[:dataset])
|
52
|
-
$stderr.puts
|
52
|
+
$stderr.puts 'Loading dataset.' unless o[:q]
|
53
53
|
d = o[:update] ? p.dataset(o[:dataset]) :
|
54
54
|
MiGA::Dataset.new(p, o[:dataset], o[:ref])
|
55
|
-
raise
|
55
|
+
raise 'Dataset does not exist.' if d.nil?
|
56
56
|
|
57
57
|
in_files = [:raw_reads, :trimmed_fasta_s, :trimmed_fasta_c, :assembly]
|
58
58
|
def cp_result(o, d, p, sym, res_sym, ext)
|
@@ -64,10 +64,10 @@ def cp_result(o, d, p, sym, res_sym, ext)
|
|
64
64
|
gz = o[sym][i] =~ /\.gz/ ? '.gz' : ''
|
65
65
|
FileUtils.cp(o[sym][i], "#{r_path}#{ext[i]}#{gz}")
|
66
66
|
end
|
67
|
-
File.open("#{r_path}.done",
|
67
|
+
File.open("#{r_path}.done", 'w') { |f| f.print Time.now.to_s }
|
68
68
|
end
|
69
69
|
if in_files.any? { |i| not o[i].nil? }
|
70
|
-
$stderr.puts
|
70
|
+
$stderr.puts 'Copying files.' unless o[:q]
|
71
71
|
# :raw_reads
|
72
72
|
cp_result(o, d, p, :raw_reads, :raw_reads, %w[.1.fastq .2.fastq])
|
73
73
|
# :trimmed_fasta
|
@@ -87,4 +87,4 @@ p.add_dataset(o[:dataset]) unless o[:update]
|
|
87
87
|
res = d.first_preprocessing(true)
|
88
88
|
$stderr.puts "- #{res}" unless o[:q]
|
89
89
|
|
90
|
-
$stderr.puts
|
90
|
+
$stderr.puts 'Done.' unless o[:q]
|
data/actions/edit.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# @package MiGA
|
4
|
+
# @license Artistic-2.0
|
5
|
+
|
6
|
+
o = {q: true}
|
7
|
+
OptionParser.new do |opt|
|
8
|
+
opt_banner(opt)
|
9
|
+
opt_object(opt, o, [:project, :dataset_opt])
|
10
|
+
opt.on('-m', '--metadata STRING',
|
11
|
+
'Metadata as key-value pairs separated by = and delimited by comma.',
|
12
|
+
'Values are saved as strings except for booleans (true / false) or nil.'
|
13
|
+
){ |v| o[:metadata] = v }
|
14
|
+
opt_common(opt, o)
|
15
|
+
end.parse!
|
16
|
+
|
17
|
+
##=> Main <=
|
18
|
+
opt_require(o, project: '-P')
|
19
|
+
|
20
|
+
$stderr.puts 'Loading project.' unless o[:q]
|
21
|
+
p = MiGA::Project.load(o[:project])
|
22
|
+
raise "Impossible to load project: #{o[:project]}" if p.nil?
|
23
|
+
|
24
|
+
obj = p
|
25
|
+
if o[:dataset]
|
26
|
+
$stderr.puts 'Loading dataset.' unless o[:q]
|
27
|
+
obj = p.dataset(o[:dataset])
|
28
|
+
raise 'Dataset does not exist.' if obj.nil?
|
29
|
+
end
|
30
|
+
obj = add_metadata(o, obj)
|
31
|
+
obj.save
|
32
|
+
|
33
|
+
$stderr.puts 'Done.' unless o[:q]
|
data/actions/new.rb
CHANGED
@@ -3,37 +3,36 @@
|
|
3
3
|
# @package MiGA
|
4
4
|
# @license Artistic-2.0
|
5
5
|
|
6
|
-
o = {q:true, update:false}
|
6
|
+
o = {q: true, update: false}
|
7
7
|
OptionParser.new do |opt|
|
8
8
|
opt_banner(opt)
|
9
9
|
opt_object(opt, o, [:project, :project_type_req])
|
10
|
-
opt.on(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"Updates the project if it already exists."){ o[:update]=true }
|
10
|
+
opt.on('-n', '--name STRING', 'Name of the project.'){ |v| o[:name] = v }
|
11
|
+
opt.on('-d', '--description STRING',
|
12
|
+
'Description of the project.'){ |v| o[:description] = v }
|
13
|
+
opt.on('-c', '--comments STRING',
|
14
|
+
'Comments on the project.'){ |v| o[:comments] = v }
|
15
|
+
opt.on('-m', '--metadata STRING',
|
16
|
+
'Metadata as key-value pairs separated by = and delimited by comma.',
|
17
|
+
'Values are saved as strings except for booleans (true / false) or nil.'
|
18
|
+
){ |v| o[:metadata] = v }
|
19
|
+
opt.on('--update', 'Updates the project if it already exists.',
|
20
|
+
'Same as "miga edit".'){ o[:update] = true }
|
22
21
|
opt_common(opt, o)
|
23
22
|
end.parse!
|
24
23
|
|
25
24
|
##=> Main <=
|
26
|
-
opt_require(o, project:
|
25
|
+
opt_require(o, project: '-P')
|
27
26
|
opt_require_type(o, MiGA::Project) unless o[:update]
|
28
27
|
|
29
28
|
unless File.exist? "#{ENV["HOME"]}/.miga_rc" and
|
30
29
|
File.exist? "#{ENV["HOME"]}/.miga_daemon.json"
|
31
30
|
raise "You must initialize MiGA before creating the first project.\n" +
|
32
|
-
|
31
|
+
'Please use "miga init".'
|
33
32
|
end
|
34
33
|
|
35
|
-
$stderr.puts
|
36
|
-
raise
|
34
|
+
$stderr.puts 'Creating project.' unless o[:q]
|
35
|
+
raise 'Project already exists, aborting.' unless
|
37
36
|
o[:update] or not MiGA::Project.exist? o[:project]
|
38
37
|
p = MiGA::Project.new(o[:project], o[:update])
|
39
38
|
# The following check is redundant with MiGA::Project#create,
|
@@ -42,4 +41,4 @@ o[:name] = File.basename(p.path) if o[:update] and o[:name].nil?
|
|
42
41
|
p = add_metadata(o, p)
|
43
42
|
p.save
|
44
43
|
|
45
|
-
$stderr.puts
|
44
|
+
$stderr.puts 'Done.' unless o[:q]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# @package MiGA
|
4
|
+
# @license Artistic-2.0
|
5
|
+
|
6
|
+
o = {q: true}
|
7
|
+
opts = OptionParser.new do |opt|
|
8
|
+
opt_banner(opt)
|
9
|
+
opt_object(opt, o, [:project, :dataset_opt])
|
10
|
+
opt_common(opt, o)
|
11
|
+
end.parse!
|
12
|
+
|
13
|
+
##=> Main <=
|
14
|
+
opts.parse!
|
15
|
+
opt_require(o, project: '-P')
|
16
|
+
|
17
|
+
$stderr.puts 'Loading project.' unless o[:q]
|
18
|
+
p = MiGA::Project.load(o[:project])
|
19
|
+
raise "Impossible to load project: #{o[:project]}" if p.nil?
|
20
|
+
|
21
|
+
n = nil
|
22
|
+
if not o[:dataset].nil?
|
23
|
+
$stderr.puts 'Loading dataset.' unless o[:q]
|
24
|
+
d = p.dataset o[:dataset]
|
25
|
+
raise "Impossible to load dataset: #{o[:dataset]}" if d.nil?
|
26
|
+
n = d.next_preprocessing if d.is_active?
|
27
|
+
else
|
28
|
+
n = p.next_distances(false)
|
29
|
+
n ||= p.next_inclade(false)
|
30
|
+
end
|
31
|
+
n ||= '?'
|
32
|
+
puts n
|
33
|
+
|
data/actions/run.rb
CHANGED
@@ -3,40 +3,43 @@
|
|
3
3
|
# @package MiGA
|
4
4
|
# @license Artistic-2.0
|
5
5
|
|
6
|
-
require
|
6
|
+
require 'shellwords'
|
7
7
|
|
8
|
-
o = {q:true, try_load:false, thr:1}
|
8
|
+
o = {q: true, try_load: false, thr: 1}
|
9
9
|
OptionParser.new do |opt|
|
10
10
|
opt_banner(opt)
|
11
11
|
opt_object(opt, o, [:project, :dataset_opt, :result])
|
12
|
-
opt.on(
|
12
|
+
opt.on('-t', '--threads INT',
|
13
13
|
"Threads to use in the local run (by default: #{o[:thr]})."
|
14
14
|
){ |v| o[:thr] = v.to_i }
|
15
15
|
opt_common(opt, o)
|
16
16
|
end.parse!
|
17
17
|
|
18
18
|
##=> Main <=
|
19
|
-
opt_require(o, project:
|
19
|
+
opt_require(o, project: '-P', name: '-r')
|
20
20
|
|
21
|
-
$stderr.puts
|
21
|
+
$stderr.puts 'Loading project.' unless o[:q]
|
22
22
|
p = MiGA::Project.load(o[:project])
|
23
23
|
raise "Impossible to load project: #{o[:project]}" if p.nil?
|
24
24
|
|
25
|
+
virtual_task = false
|
25
26
|
miga = MiGA::MiGA.root_path
|
26
|
-
cmd = ["PROJECT=#{p.path.shellescape}",
|
27
|
+
cmd = ["PROJECT=#{p.path.shellescape}", 'RUNTYPE=bash',
|
27
28
|
"MIGA=#{miga.shellescape}", "CORES=#{o[:thr]}"]
|
28
29
|
if o[:dataset].nil?
|
29
30
|
type = MiGA::Project
|
31
|
+
virtual_task = true if o[:name] == :p
|
30
32
|
else
|
31
33
|
d = p.dataset(o[:dataset])
|
32
|
-
raise
|
34
|
+
raise 'Cannot load dataset.' if d.nil?
|
33
35
|
cmd << "DATASET=#{d.name.shellescape}"
|
34
36
|
type = MiGA::Dataset
|
37
|
+
virtual_task = true if o[:name] == :d
|
35
38
|
end
|
36
|
-
raise "Unsupported #{type.to_s.gsub(/.*::/,
|
37
|
-
type.RESULT_DIRS[o[:name].to_sym].nil?
|
38
|
-
cmd << MiGA::MiGA.script_path(o[:name], miga:miga, project:p).shellescape
|
39
|
-
pid = spawn cmd.join(
|
39
|
+
raise "Unsupported #{type.to_s.gsub(/.*::/, '')} result: #{o[:name]}." if
|
40
|
+
type.RESULT_DIRS[o[:name].to_sym].nil? and not virtual_task
|
41
|
+
cmd << MiGA::MiGA.script_path(o[:name], miga: miga, project: p).shellescape
|
42
|
+
pid = spawn cmd.join(' ')
|
40
43
|
Process.wait pid
|
41
44
|
|
42
|
-
$stderr.puts
|
45
|
+
$stderr.puts 'Done.' unless o[:q]
|
data/bin/miga
CHANGED
@@ -17,7 +17,7 @@ $task_desc = {
|
|
17
17
|
plugins: 'Lists or (un)installs plugins in a MiGA project',
|
18
18
|
doctor: 'Performs consistency checks on a MiGA project',
|
19
19
|
# Datasets
|
20
|
-
add: 'Creates
|
20
|
+
add: 'Creates a dataset in a MiGA project',
|
21
21
|
get: 'Downloads a dataset from public databases into a MiGA project',
|
22
22
|
ncbi_get: 'Downloads all genomes in a taxon from NCBI into a MiGA project',
|
23
23
|
rm: 'Removes a dataset from an MiGA project',
|
@@ -30,6 +30,9 @@ $task_desc = {
|
|
30
30
|
files: 'Lists registered files from the results of a dataset or project',
|
31
31
|
run: 'Executes locally one step analysis producing the given result',
|
32
32
|
summary: 'Generates a summary table for the statistics of all datasets',
|
33
|
+
next_step: 'Returns the next task to run in a dataset or project',
|
34
|
+
# Objects (Datasets or Projects)
|
35
|
+
edit: 'Edits the metadata of a dataset or project',
|
33
36
|
# System
|
34
37
|
init: 'Initialize MiGA to process new projects',
|
35
38
|
daemon: 'Controls the daemon of a MiGA project',
|
@@ -58,6 +61,9 @@ $task_alias = {
|
|
58
61
|
list_files: :files,
|
59
62
|
run_local: :run,
|
60
63
|
sum_stats: :summary,
|
64
|
+
next_task: :next_step,
|
65
|
+
# Objects
|
66
|
+
update_metadata: :edit,
|
61
67
|
# System
|
62
68
|
c: :console,
|
63
69
|
# Taxonomy
|
@@ -88,80 +94,80 @@ BAN
|
|
88
94
|
end
|
89
95
|
|
90
96
|
# OptParse flags that determine the object to load
|
91
|
-
def opt_object(opt, o, what=[:project, :dataset])
|
92
|
-
opt.on(
|
97
|
+
def opt_object(opt, o, what = [:project, :dataset])
|
98
|
+
opt.on('-P', '--project PATH', '(Mandatory) Path to the project.'
|
93
99
|
){ |v| o[:project]=v } if what.include? :project
|
94
|
-
opt.on(
|
95
|
-
(what.include?(:dataset) ?
|
96
|
-
|
100
|
+
opt.on('-D', '--dataset STRING',
|
101
|
+
(what.include?(:dataset) ? '(Mandatory) ' : '') +
|
102
|
+
'Name of the dataset.'){ |v| o[:dataset]=v } if what.include? :dataset or
|
97
103
|
what.include? :dataset_opt
|
98
|
-
opt.on(
|
104
|
+
opt.on('-D', '--dataset STRING', 'Name of the dataset.'
|
99
105
|
){ |v| o[:dataset]=v } if what.include? :dataset_opt
|
100
|
-
opt.on(
|
101
|
-
(what.include?(:dataset_type_req) ?
|
102
|
-
|
106
|
+
opt.on('-t', '--type STRING',
|
107
|
+
(what.include?(:dataset_type_req) ? '(Mandatory) ' : '')+
|
108
|
+
'Type of dataset. Recognized types include:',
|
103
109
|
*MiGA::Dataset.KNOWN_TYPES.map{ |k,v| "~ #{k}: #{v[:description]}" }
|
104
110
|
){ |v| o[:type]=v.to_sym } if what.include? :dataset_type or
|
105
111
|
what.include? :dataset_type_req
|
106
|
-
opt.on(
|
107
|
-
(what.include?(:project_type_req) ?
|
108
|
-
|
112
|
+
opt.on('-t', '--type STRING',
|
113
|
+
(what.include?(:project_type_req) ? '(Mandatory) ' : '') +
|
114
|
+
'Type of project. Recognized types include:',
|
109
115
|
*MiGA::Project.KNOWN_TYPES.map{ |k,v| "~ #{k}: #{v[:description]}"}
|
110
116
|
){ |v| o[:type]=v.to_sym } if what.include? :project_type or
|
111
117
|
what.include? :project_type_req
|
112
|
-
opt.on(
|
113
|
-
|
114
|
-
|
118
|
+
opt.on('-r', '--result STRING',
|
119
|
+
'(Mandatory) Name of the result.',
|
120
|
+
'Recognized names for dataset-specific results include:',
|
115
121
|
*MiGA::Dataset.RESULT_DIRS.keys.map{|n| " ~ #{n}"},
|
116
|
-
|
122
|
+
'Recognized names for project-wide results include:',
|
117
123
|
*MiGA::Project.RESULT_DIRS.keys.map{|n| " ~ #{n}"}
|
118
124
|
){ |v| o[:name]=v.downcase.to_sym } if what.include? :result
|
119
|
-
opt.on(
|
120
|
-
|
125
|
+
opt.on('-r', '--result STRING',
|
126
|
+
'(Mandatory) Name of the result. One of:',
|
121
127
|
*MiGA::Dataset.RESULT_DIRS.keys.map{|n| " ~ #{n}"}
|
122
128
|
){ |v| o[:name]=v.downcase.to_sym } if what.include? :result_dataset
|
123
129
|
end
|
124
130
|
|
125
131
|
# OptParse flags common to all actions.
|
126
132
|
def opt_common(opt, o)
|
127
|
-
opt.on(
|
128
|
-
|
129
|
-
opt.on(
|
130
|
-
|
133
|
+
opt.on('-v', '--verbose',
|
134
|
+
'Print additional information to STDERR.'){ o[:q]=false }
|
135
|
+
opt.on('-d', '--debug INT',
|
136
|
+
'Print debugging information to STDERR (1: debug, 2: trace).') do |v|
|
131
137
|
v.to_i>1 ? MiGA::MiGA.DEBUG_TRACE_ON : MiGA::MiGA.DEBUG_ON
|
132
138
|
end
|
133
|
-
opt.on(
|
139
|
+
opt.on('-h', '--help', 'Display this screen.') do
|
134
140
|
puts opt
|
135
141
|
exit
|
136
142
|
end
|
137
|
-
opt.separator
|
143
|
+
opt.separator ''
|
138
144
|
end
|
139
145
|
|
140
146
|
# OptParse flags to filter lists of datasets.
|
141
|
-
def opt_filter_datasets(opt, o, what=[:ref, :multi, :active, :taxonomy])
|
142
|
-
opt.on(
|
143
|
-
|
147
|
+
def opt_filter_datasets(opt, o, what = [:ref, :multi, :active, :taxonomy])
|
148
|
+
opt.on('--[no-]ref',
|
149
|
+
'If set, uses only reference (or only non-reference) datasets.'
|
144
150
|
){ |v| o[:ref]=v } if what.include? :ref
|
145
|
-
opt.on(
|
146
|
-
|
151
|
+
opt.on('--[no-]multi',
|
152
|
+
'If set, uses only multi-species (or only single-species) datasets.'
|
147
153
|
){ |v| o[:multi]=v } if what.include? :multi
|
148
|
-
opt.on(
|
149
|
-
|
154
|
+
opt.on('--[no-]active',
|
155
|
+
'If set, uses only active (or inactive) datasets.'
|
150
156
|
){ |v| o[:active]=v } if what.include? :active
|
151
|
-
opt.on(
|
157
|
+
opt.on('-t', '--taxonomy RANK:TAXON', 'Filter by taxonomy.'
|
152
158
|
){ |v| o[:taxonomy]=MiGA::Taxonomy.new v } if what.include? :taxonomy
|
153
|
-
opt.on(
|
154
|
-
|
159
|
+
opt.on('-k', '--key INTEGER',
|
160
|
+
'Returns only the k-th dataset in the list.'){ |v| o[:key]=v.to_i }
|
155
161
|
end
|
156
162
|
|
157
|
-
def opt_require(o, req={project:
|
163
|
+
def opt_require(o, req = {project: '-P', dataset: '-D'})
|
158
164
|
req.each do |k,v|
|
159
165
|
raise "#{v} is mandatory: please provide #{k}." if o[k].nil?
|
160
166
|
end
|
161
167
|
end
|
162
168
|
|
163
169
|
def opt_require_type(o, klass)
|
164
|
-
opt_require(o, type:
|
170
|
+
opt_require(o, type: '-t')
|
165
171
|
raise "Unrecognized type: #{o[:type]}." if klass.KNOWN_TYPES[o[:type]].nil?
|
166
172
|
end
|
167
173
|
|
data/lib/miga/daemon.rb
CHANGED
@@ -124,7 +124,7 @@ class MiGA::Daemon < MiGA::MiGA
|
|
124
124
|
project.load
|
125
125
|
else
|
126
126
|
to_run = ds.next_preprocessing(true)
|
127
|
-
queue_job(
|
127
|
+
queue_job(:d, ds) unless to_run.nil?
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
@@ -137,7 +137,7 @@ class MiGA::Daemon < MiGA::MiGA
|
|
137
137
|
return unless project.done_preprocessing?(false)
|
138
138
|
to_run = project.next_distances(true)
|
139
139
|
to_run = project.next_inclade(true) if to_run.nil?
|
140
|
-
queue_job(
|
140
|
+
queue_job(:p) unless to_run.nil?
|
141
141
|
end
|
142
142
|
|
143
143
|
##
|
data/lib/miga/project/result.rb
CHANGED
@@ -87,9 +87,14 @@ module MiGA::Project::Result
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def add_result_clade_finding(base)
|
90
|
+
if result_files_exist?(base, %w[.empty])
|
91
|
+
r = MiGA::Result.new("#{base}.json")
|
92
|
+
r.add_file(:empty, 'miga-project.empty')
|
93
|
+
return r
|
94
|
+
end
|
90
95
|
return nil unless result_files_exist?(base, %w[.proposed-clades])
|
91
96
|
return nil unless is_clade? or result_files_exist?(base,
|
92
|
-
|
97
|
+
%w[.pdf .classif .medoids .class.tsv .class.nwk])
|
93
98
|
r = add_result_iter_clades(base)
|
94
99
|
r.add_file(:aai_tree, 'miga-project.aai.nwk')
|
95
100
|
r.add_file(:proposal, 'miga-project.proposed-clades')
|
@@ -100,6 +105,11 @@ module MiGA::Project::Result
|
|
100
105
|
end
|
101
106
|
|
102
107
|
def add_result_subclades(base)
|
108
|
+
if result_files_exist?(base, %w[.empty])
|
109
|
+
r = MiGA::Result.new("#{base}.json")
|
110
|
+
r.add_file(:empty, 'miga-project.empty')
|
111
|
+
return r
|
112
|
+
end
|
103
113
|
return nil unless result_files_exist?(base,
|
104
114
|
%w[.pdf .classif .medoids .class.tsv .class.nwk])
|
105
115
|
r = add_result_iter_clades(base)
|
@@ -118,6 +128,11 @@ module MiGA::Project::Result
|
|
118
128
|
end
|
119
129
|
|
120
130
|
def add_result_ogs(base)
|
131
|
+
if result_files_exist?(base, %w[.empty])
|
132
|
+
r = MiGA::Result.new("#{base}.json")
|
133
|
+
r.add_file(:empty, 'miga-project.empty')
|
134
|
+
return r
|
135
|
+
end
|
121
136
|
return nil unless result_files_exist?(base, %w[.ogs .stats])
|
122
137
|
r = MiGA::Result.new("#{base}.json")
|
123
138
|
r.add_file(:ogs, 'miga-project.ogs')
|
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.3, 9,
|
13
|
+
VERSION = [0.3, 9, 1]
|
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(2019, 03,
|
21
|
+
VERSION_DATE = Date.new(2019, 03, 8)
|
22
22
|
|
23
23
|
##
|
24
24
|
# Reference of MiGA.
|
data/scripts/aai_distances.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES
|
3
3
|
set -e
|
4
4
|
SCRIPT="aai_distances"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/09.distances/02.aai"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/ani_distances.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES
|
3
3
|
set -e
|
4
4
|
SCRIPT="ani_distances"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/09.distances/03.ani"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/assembly.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
|
3
3
|
set -e
|
4
4
|
SCRIPT="assembly"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/05.assembly"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/cds.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
|
3
3
|
set -e
|
4
4
|
SCRIPT="cds"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/06.cds"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/clade_finding.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES
|
3
3
|
set -e
|
4
4
|
SCRIPT="clade_finding"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/10.clades/01.find"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/d.bash
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
|
3
|
+
set -e
|
4
|
+
SCRIPT="d"
|
5
|
+
# shellcheck source=scripts/miga.bash
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
7
|
+
|
8
|
+
while true ; do
|
9
|
+
res="$(miga next_step -P "$PROJECT" -D "$DATASET")"
|
10
|
+
[[ "$res" == '?' ]] && break
|
11
|
+
miga run -P "$PROJECT" -D "$DATASET" -r "$res" -t "$CORES"
|
12
|
+
done
|
13
|
+
|
data/scripts/distances.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
|
3
3
|
set -e
|
4
4
|
SCRIPT="distances"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/09.distances"
|
10
8
|
|
11
9
|
# Initialize
|
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
|
3
3
|
set -e
|
4
4
|
SCRIPT="essential_genes"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/07.annotation/01.function/01.essential"
|
10
8
|
|
11
9
|
# Initialize
|
data/scripts/haai_distances.bash
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES
|
3
3
|
set -e
|
4
4
|
SCRIPT="haai_distances"
|
5
|
-
echo "MiGA: $MIGA"
|
6
|
-
echo "Project: $PROJECT"
|
7
5
|
# shellcheck source=scripts/miga.bash
|
8
|
-
|
6
|
+
. "$MIGA/scripts/miga.bash" || exit 1
|
9
7
|
cd "$PROJECT/data/09.distances/01.haai"
|
10
8
|
|
11
9
|
# Initialize
|