miga-base 0.7.4.0 → 0.7.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/miga/cli.rb +10 -8
- data/lib/miga/cli/action.rb +2 -3
- data/lib/miga/cli/action/about.rb +5 -6
- data/lib/miga/cli/action/add.rb +18 -12
- data/lib/miga/cli/action/add_result.rb +2 -3
- data/lib/miga/cli/action/archive.rb +1 -2
- data/lib/miga/cli/action/classify_wf.rb +8 -6
- data/lib/miga/cli/action/console.rb +0 -1
- data/lib/miga/cli/action/daemon.rb +7 -7
- data/lib/miga/cli/action/date.rb +0 -1
- data/lib/miga/cli/action/derep_wf.rb +5 -4
- data/lib/miga/cli/action/doctor.rb +28 -20
- data/lib/miga/cli/action/doctor/base.rb +29 -6
- data/lib/miga/cli/action/edit.rb +1 -2
- data/lib/miga/cli/action/files.rb +8 -8
- data/lib/miga/cli/action/find.rb +5 -6
- data/lib/miga/cli/action/generic.rb +7 -7
- data/lib/miga/cli/action/get.rb +20 -17
- data/lib/miga/cli/action/get_db.rb +8 -2
- data/lib/miga/cli/action/index_wf.rb +1 -1
- data/lib/miga/cli/action/init.rb +34 -29
- data/lib/miga/cli/action/init/daemon_helper.rb +65 -43
- data/lib/miga/cli/action/lair.rb +7 -7
- data/lib/miga/cli/action/ln.rb +6 -6
- data/lib/miga/cli/action/ls.rb +1 -2
- data/lib/miga/cli/action/ncbi_get.rb +11 -3
- data/lib/miga/cli/action/new.rb +4 -4
- data/lib/miga/cli/action/next_step.rb +0 -1
- data/lib/miga/cli/action/preproc_wf.rb +3 -3
- data/lib/miga/cli/action/quality_wf.rb +1 -1
- data/lib/miga/cli/action/rm.rb +2 -3
- data/lib/miga/cli/action/run.rb +8 -8
- data/lib/miga/cli/action/stats.rb +3 -3
- data/lib/miga/cli/action/summary.rb +7 -6
- data/lib/miga/cli/action/tax_dist.rb +8 -4
- data/lib/miga/cli/action/tax_index.rb +3 -4
- data/lib/miga/cli/action/tax_set.rb +7 -6
- data/lib/miga/cli/action/tax_test.rb +6 -5
- data/lib/miga/cli/action/wf.rb +21 -19
- data/lib/miga/cli/base.rb +34 -32
- data/lib/miga/cli/objects_helper.rb +24 -17
- data/lib/miga/cli/opt_helper.rb +3 -2
- data/lib/miga/common.rb +2 -5
- data/lib/miga/common/base.rb +15 -16
- data/lib/miga/common/format.rb +8 -5
- data/lib/miga/common/hooks.rb +1 -4
- data/lib/miga/common/path.rb +4 -9
- data/lib/miga/common/with_daemon.rb +5 -2
- data/lib/miga/common/with_daemon_class.rb +1 -1
- data/lib/miga/common/with_result.rb +2 -1
- data/lib/miga/daemon.rb +51 -35
- data/lib/miga/daemon/base.rb +0 -2
- data/lib/miga/dataset.rb +47 -37
- data/lib/miga/dataset/base.rb +52 -37
- data/lib/miga/dataset/hooks.rb +3 -4
- data/lib/miga/dataset/result.rb +17 -1
- data/lib/miga/json.rb +5 -7
- data/lib/miga/lair.rb +4 -0
- data/lib/miga/metadata.rb +4 -3
- data/lib/miga/project.rb +29 -20
- data/lib/miga/project/base.rb +52 -37
- data/lib/miga/project/dataset.rb +27 -13
- data/lib/miga/project/hooks.rb +0 -3
- data/lib/miga/project/result.rb +14 -5
- data/lib/miga/remote_dataset.rb +85 -72
- data/lib/miga/remote_dataset/base.rb +11 -13
- data/lib/miga/remote_dataset/download.rb +33 -12
- data/lib/miga/result.rb +34 -25
- data/lib/miga/result/base.rb +0 -2
- data/lib/miga/result/dates.rb +1 -3
- data/lib/miga/result/source.rb +15 -16
- data/lib/miga/result/stats.rb +36 -25
- data/lib/miga/tax_dist.rb +6 -3
- data/lib/miga/tax_index.rb +17 -17
- data/lib/miga/taxonomy.rb +6 -1
- data/lib/miga/taxonomy/base.rb +19 -15
- data/lib/miga/version.rb +19 -16
- data/test/common_test.rb +3 -11
- data/test/daemon_helper.rb +38 -0
- data/test/daemon_test.rb +73 -101
- data/test/dataset_test.rb +58 -59
- data/test/format_test.rb +3 -11
- data/test/hook_test.rb +50 -55
- data/test/json_test.rb +7 -8
- data/test/lair_test.rb +22 -28
- data/test/metadata_test.rb +6 -14
- data/test/project_test.rb +33 -39
- data/test/remote_dataset_test.rb +20 -28
- data/test/result_stats_test.rb +17 -27
- data/test/result_test.rb +41 -34
- data/test/tax_dist_test.rb +0 -2
- data/test/tax_index_test.rb +4 -10
- data/test/taxonomy_test.rb +7 -9
- data/test/test_helper.rb +42 -1
- data/test/with_daemon_test.rb +14 -22
- data/utils/cleanup-databases.rb +6 -5
- data/utils/distance/base.rb +0 -1
- data/utils/distance/commands.rb +19 -12
- data/utils/distance/database.rb +24 -21
- data/utils/distance/pipeline.rb +12 -9
- data/utils/distance/runner.rb +14 -13
- data/utils/distance/temporal.rb +1 -3
- data/utils/distances.rb +1 -1
- data/utils/domain-ess-genes.rb +7 -7
- data/utils/index_metadata.rb +4 -2
- data/utils/mytaxa_scan.rb +18 -16
- data/utils/representatives.rb +5 -4
- data/utils/requirements.txt +1 -1
- data/utils/subclade/base.rb +0 -1
- data/utils/subclade/pipeline.rb +7 -6
- data/utils/subclade/runner.rb +9 -9
- data/utils/subclade/temporal.rb +0 -2
- data/utils/subclades-compile.rb +39 -37
- data/utils/subclades.rb +1 -1
- metadata +3 -2
data/utils/subclade/temporal.rb
CHANGED
data/utils/subclades-compile.rb
CHANGED
@@ -1,49 +1,51 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$:.push File.expand_path(File.dirname(__FILE__) + "/lib")
|
4
3
|
dir = ARGV.shift
|
5
4
|
out = ARGV.shift or abort "Usage: #{$0} <classif.dir> <out.base>"
|
6
5
|
|
7
|
-
def read_classif(dir, classif={})
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
6
|
+
def read_classif(dir, classif = {})
|
7
|
+
classif_file = File.expand_path('miga-project.classif', dir)
|
8
|
+
return classif unless File.exist? classif_file
|
9
|
+
|
10
|
+
ready = File.expand_path('miga-project.ready', dir)
|
11
|
+
File.size?(ready) or raise "Incomplete recursion found at #{dir}"
|
12
|
+
File.unlink ready
|
13
|
+
fh = File.open(classif_file, 'r')
|
14
|
+
klass = []
|
15
|
+
while ln = fh.gets
|
16
|
+
r = ln.chomp.split("\t")
|
17
|
+
classif[r[0]] ||= []
|
18
|
+
classif[r[0]] << r[1]
|
19
|
+
klass[r[1].to_i] = r[1]
|
20
|
+
end
|
21
|
+
fh.close
|
22
|
+
klass.each do |i|
|
23
|
+
d = File.expand_path("miga-project.sc-#{i}", dir)
|
24
|
+
classif = read_classif(d, classif) if Dir.exist? d
|
25
|
+
end
|
26
|
+
classif
|
27
27
|
end
|
28
28
|
|
29
|
-
def print_tree(classif, col=0)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
29
|
+
def print_tree(classif, col = 0)
|
30
|
+
klass = classif.values.map { |i| i[col] }.compact.uniq
|
31
|
+
if klass.size <= 1
|
32
|
+
o = classif.keys
|
33
|
+
else
|
34
|
+
o = klass.map do |c|
|
35
|
+
oo = print_tree(classif.select { |k, v| v[col] == c }, col + 1)
|
36
|
+
"#{oo}[#{c}]" unless oo.nil?
|
37
|
+
end.compact
|
38
|
+
end
|
39
|
+
case o.size
|
40
|
+
when 0; nil
|
41
|
+
when 1; o[0]
|
42
|
+
else; "(#{o.join(',')})"
|
43
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
c = read_classif(dir)
|
45
|
-
max_depth = c.values.map{|i| i.count}.max
|
47
|
+
max_depth = c.values.map { |i| i.count }.max
|
46
48
|
File.open("#{out}.tsv", 'w') do |fh|
|
47
|
-
c.each { |k,v| fh.puts ([k] + v + [
|
49
|
+
c.each { |k, v| fh.puts ([k] + v + ['0'] * (max_depth - v.count)).join("\t") }
|
48
50
|
end
|
49
|
-
File.open("#{out}.nwk", 'w') { |fh| fh.puts print_tree(c).to_s +
|
51
|
+
File.open("#{out}.nwk", 'w') { |fh| fh.puts print_tree(c).to_s + ';' }
|
data/utils/subclades.rb
CHANGED
@@ -4,6 +4,6 @@ require_relative 'subclade/runner.rb'
|
|
4
4
|
|
5
5
|
project = ARGV.shift
|
6
6
|
step = ARGV.shift
|
7
|
-
opts = Hash[
|
7
|
+
opts = Hash[ARGV.map { |i| i.split("=", 2).tap { |j| j[0] = j[0].to_sym } }]
|
8
8
|
runner = MiGA::SubcladeRunner.new(project, step, opts)
|
9
9
|
runner.go!
|
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.5.0
|
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-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daemons
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- scripts/trimmed_fasta.bash
|
215
215
|
- scripts/trimmed_reads.bash
|
216
216
|
- test/common_test.rb
|
217
|
+
- test/daemon_helper.rb
|
217
218
|
- test/daemon_test.rb
|
218
219
|
- test/dataset_test.rb
|
219
220
|
- test/format_test.rb
|