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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/lib/miga/cli.rb +10 -8
  3. data/lib/miga/cli/action.rb +2 -3
  4. data/lib/miga/cli/action/about.rb +5 -6
  5. data/lib/miga/cli/action/add.rb +18 -12
  6. data/lib/miga/cli/action/add_result.rb +2 -3
  7. data/lib/miga/cli/action/archive.rb +1 -2
  8. data/lib/miga/cli/action/classify_wf.rb +8 -6
  9. data/lib/miga/cli/action/console.rb +0 -1
  10. data/lib/miga/cli/action/daemon.rb +7 -7
  11. data/lib/miga/cli/action/date.rb +0 -1
  12. data/lib/miga/cli/action/derep_wf.rb +5 -4
  13. data/lib/miga/cli/action/doctor.rb +28 -20
  14. data/lib/miga/cli/action/doctor/base.rb +29 -6
  15. data/lib/miga/cli/action/edit.rb +1 -2
  16. data/lib/miga/cli/action/files.rb +8 -8
  17. data/lib/miga/cli/action/find.rb +5 -6
  18. data/lib/miga/cli/action/generic.rb +7 -7
  19. data/lib/miga/cli/action/get.rb +20 -17
  20. data/lib/miga/cli/action/get_db.rb +8 -2
  21. data/lib/miga/cli/action/index_wf.rb +1 -1
  22. data/lib/miga/cli/action/init.rb +34 -29
  23. data/lib/miga/cli/action/init/daemon_helper.rb +65 -43
  24. data/lib/miga/cli/action/lair.rb +7 -7
  25. data/lib/miga/cli/action/ln.rb +6 -6
  26. data/lib/miga/cli/action/ls.rb +1 -2
  27. data/lib/miga/cli/action/ncbi_get.rb +11 -3
  28. data/lib/miga/cli/action/new.rb +4 -4
  29. data/lib/miga/cli/action/next_step.rb +0 -1
  30. data/lib/miga/cli/action/preproc_wf.rb +3 -3
  31. data/lib/miga/cli/action/quality_wf.rb +1 -1
  32. data/lib/miga/cli/action/rm.rb +2 -3
  33. data/lib/miga/cli/action/run.rb +8 -8
  34. data/lib/miga/cli/action/stats.rb +3 -3
  35. data/lib/miga/cli/action/summary.rb +7 -6
  36. data/lib/miga/cli/action/tax_dist.rb +8 -4
  37. data/lib/miga/cli/action/tax_index.rb +3 -4
  38. data/lib/miga/cli/action/tax_set.rb +7 -6
  39. data/lib/miga/cli/action/tax_test.rb +6 -5
  40. data/lib/miga/cli/action/wf.rb +21 -19
  41. data/lib/miga/cli/base.rb +34 -32
  42. data/lib/miga/cli/objects_helper.rb +24 -17
  43. data/lib/miga/cli/opt_helper.rb +3 -2
  44. data/lib/miga/common.rb +2 -5
  45. data/lib/miga/common/base.rb +15 -16
  46. data/lib/miga/common/format.rb +8 -5
  47. data/lib/miga/common/hooks.rb +1 -4
  48. data/lib/miga/common/path.rb +4 -9
  49. data/lib/miga/common/with_daemon.rb +5 -2
  50. data/lib/miga/common/with_daemon_class.rb +1 -1
  51. data/lib/miga/common/with_result.rb +2 -1
  52. data/lib/miga/daemon.rb +51 -35
  53. data/lib/miga/daemon/base.rb +0 -2
  54. data/lib/miga/dataset.rb +47 -37
  55. data/lib/miga/dataset/base.rb +52 -37
  56. data/lib/miga/dataset/hooks.rb +3 -4
  57. data/lib/miga/dataset/result.rb +17 -1
  58. data/lib/miga/json.rb +5 -7
  59. data/lib/miga/lair.rb +4 -0
  60. data/lib/miga/metadata.rb +4 -3
  61. data/lib/miga/project.rb +29 -20
  62. data/lib/miga/project/base.rb +52 -37
  63. data/lib/miga/project/dataset.rb +27 -13
  64. data/lib/miga/project/hooks.rb +0 -3
  65. data/lib/miga/project/result.rb +14 -5
  66. data/lib/miga/remote_dataset.rb +85 -72
  67. data/lib/miga/remote_dataset/base.rb +11 -13
  68. data/lib/miga/remote_dataset/download.rb +33 -12
  69. data/lib/miga/result.rb +34 -25
  70. data/lib/miga/result/base.rb +0 -2
  71. data/lib/miga/result/dates.rb +1 -3
  72. data/lib/miga/result/source.rb +15 -16
  73. data/lib/miga/result/stats.rb +36 -25
  74. data/lib/miga/tax_dist.rb +6 -3
  75. data/lib/miga/tax_index.rb +17 -17
  76. data/lib/miga/taxonomy.rb +6 -1
  77. data/lib/miga/taxonomy/base.rb +19 -15
  78. data/lib/miga/version.rb +19 -16
  79. data/test/common_test.rb +3 -11
  80. data/test/daemon_helper.rb +38 -0
  81. data/test/daemon_test.rb +73 -101
  82. data/test/dataset_test.rb +58 -59
  83. data/test/format_test.rb +3 -11
  84. data/test/hook_test.rb +50 -55
  85. data/test/json_test.rb +7 -8
  86. data/test/lair_test.rb +22 -28
  87. data/test/metadata_test.rb +6 -14
  88. data/test/project_test.rb +33 -39
  89. data/test/remote_dataset_test.rb +20 -28
  90. data/test/result_stats_test.rb +17 -27
  91. data/test/result_test.rb +41 -34
  92. data/test/tax_dist_test.rb +0 -2
  93. data/test/tax_index_test.rb +4 -10
  94. data/test/taxonomy_test.rb +7 -9
  95. data/test/test_helper.rb +42 -1
  96. data/test/with_daemon_test.rb +14 -22
  97. data/utils/cleanup-databases.rb +6 -5
  98. data/utils/distance/base.rb +0 -1
  99. data/utils/distance/commands.rb +19 -12
  100. data/utils/distance/database.rb +24 -21
  101. data/utils/distance/pipeline.rb +12 -9
  102. data/utils/distance/runner.rb +14 -13
  103. data/utils/distance/temporal.rb +1 -3
  104. data/utils/distances.rb +1 -1
  105. data/utils/domain-ess-genes.rb +7 -7
  106. data/utils/index_metadata.rb +4 -2
  107. data/utils/mytaxa_scan.rb +18 -16
  108. data/utils/representatives.rb +5 -4
  109. data/utils/requirements.txt +1 -1
  110. data/utils/subclade/base.rb +0 -1
  111. data/utils/subclade/pipeline.rb +7 -6
  112. data/utils/subclade/runner.rb +9 -9
  113. data/utils/subclade/temporal.rb +0 -2
  114. data/utils/subclades-compile.rb +39 -37
  115. data/utils/subclades.rb +1 -1
  116. metadata +3 -2
@@ -1,8 +1,6 @@
1
-
2
1
  require 'tmpdir'
3
2
 
4
3
  module MiGA::SubcladeRunner::Temporal
5
-
6
4
  # Create the empty temporal structure
7
5
  def create_temporals
8
6
  end
@@ -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
- classif_file = File.expand_path("miga-project.classif", dir)
9
- return classif unless File.exist? classif_file
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
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
- 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
- o.size==0 ? nil :
40
- o.size==1 ? o[0] :
41
- "(#{o.join(",")})"
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 + ["0"]*(max_depth-v.count)).join("\t") }
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[ ARGV.map{ |i| i.split("=",2).tap{ |j| j[0] = j[0].to_sym } } ]
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.0
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-04-28 00:00:00.000000000 Z
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