miga-base 0.7.4.0 → 0.7.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) 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 +53 -41
  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 +9 -5
  35. data/lib/miga/cli/action/summary.rb +13 -7
  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 +25 -19
  41. data/lib/miga/cli/base.rb +34 -32
  42. data/lib/miga/cli/objects_helper.rb +27 -18
  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 +11 -6
  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 +34 -12
  69. data/lib/miga/result.rb +48 -53
  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 +37 -27
  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/scripts/project_stats.bash +3 -0
  80. data/scripts/stats.bash +1 -1
  81. data/test/common_test.rb +3 -11
  82. data/test/daemon_helper.rb +38 -0
  83. data/test/daemon_test.rb +73 -101
  84. data/test/dataset_test.rb +63 -59
  85. data/test/format_test.rb +3 -11
  86. data/test/hook_test.rb +50 -55
  87. data/test/json_test.rb +7 -8
  88. data/test/lair_test.rb +22 -28
  89. data/test/metadata_test.rb +6 -14
  90. data/test/project_test.rb +33 -39
  91. data/test/remote_dataset_test.rb +26 -32
  92. data/test/result_stats_test.rb +17 -27
  93. data/test/result_test.rb +41 -34
  94. data/test/tax_dist_test.rb +0 -2
  95. data/test/tax_index_test.rb +4 -10
  96. data/test/taxonomy_test.rb +7 -9
  97. data/test/test_helper.rb +42 -1
  98. data/test/with_daemon_test.rb +14 -22
  99. data/utils/adapters.fa +13 -0
  100. data/utils/cleanup-databases.rb +6 -5
  101. data/utils/distance/base.rb +0 -1
  102. data/utils/distance/commands.rb +19 -12
  103. data/utils/distance/database.rb +24 -21
  104. data/utils/distance/pipeline.rb +23 -10
  105. data/utils/distance/runner.rb +20 -16
  106. data/utils/distance/temporal.rb +1 -3
  107. data/utils/distances.rb +1 -1
  108. data/utils/domain-ess-genes.rb +7 -7
  109. data/utils/index_metadata.rb +4 -2
  110. data/utils/mytaxa_scan.rb +18 -16
  111. data/utils/representatives.rb +5 -4
  112. data/utils/requirements.txt +1 -1
  113. data/utils/subclade/base.rb +0 -1
  114. data/utils/subclade/pipeline.rb +7 -6
  115. data/utils/subclade/runner.rb +9 -9
  116. data/utils/subclade/temporal.rb +0 -2
  117. data/utils/subclades-compile.rb +39 -37
  118. data/utils/subclades.rb +1 -1
  119. metadata +5 -4
@@ -2,62 +2,69 @@ require 'test_helper'
2
2
  require 'miga/project'
3
3
 
4
4
  class ResultTest < Test::Unit::TestCase
5
+ include TestHelper
5
6
 
6
7
  def setup
7
- $tmp = Dir.mktmpdir
8
- ENV['MIGA_HOME'] = $tmp
9
- FileUtils.touch(File.expand_path('.miga_rc', ENV['MIGA_HOME']))
10
- FileUtils.touch(File.expand_path('.miga_daemon.json', ENV['MIGA_HOME']))
11
- $p1 = MiGA::Project.new(File.expand_path('project1', $tmp))
12
- $d1 = $p1.add_dataset('dataset1')
8
+ initialize_miga_home
13
9
  FileUtils.touch(
14
- File.join($p1.path, "data/02.trimmed_reads/#{$d1.name}.1.clipped.fastq"))
10
+ File.join(
11
+ project.path, 'data', '02.trimmed_reads',
12
+ "#{dataset.name}.1.clipped.fastq"
13
+ )
14
+ )
15
15
  FileUtils.touch(
16
- File.join($p1.path, "data/02.trimmed_reads/#{$d1.name}.done"))
16
+ File.join(
17
+ project.path, 'data', '02.trimmed_reads', "#{dataset.name}.done"
18
+ )
19
+ )
17
20
  FileUtils.touch(
18
- File.join($p1.path, 'data/10.clades/01.find/miga-project.empty'))
21
+ File.join(
22
+ project.path, 'data', '10.clades', '01.find', 'miga-project.empty'
23
+ )
24
+ )
19
25
  FileUtils.touch(
20
- File.join($p1.path, 'data/10.clades/01.find/miga-project.done'))
21
- end
22
-
23
- def teardown
24
- FileUtils.rm_rf $tmp
25
- ENV['MIGA_HOME'] = nil
26
+ File.join(
27
+ project.path, 'data', '10.clades', '01.find', 'miga-project.done'
28
+ )
29
+ )
26
30
  end
27
31
 
28
32
  def test_add_result
29
- r = $d1.add_result(:trimmed_reads)
30
- assert_equal(MiGA::Result, r.class)
31
- r = $d1.add_result(:asssembly)
33
+ r = dataset.add_result(:trimmed_reads)
34
+ assert_instance_of(MiGA::Result, r)
35
+ r = dataset.add_result(:asssembly)
32
36
  assert_nil(r)
33
- r = $p1.add_result(:clade_finding)
34
- assert_equal(MiGA::Result, r.class)
37
+ r = project.add_result(:clade_finding)
38
+ assert_instance_of(MiGA::Result, r)
35
39
  end
36
40
 
37
41
  def test_result_source
38
- r = $d1.add_result(:trimmed_reads)
39
- assert_equal($d1.name, r.source.name)
42
+ r = dataset.add_result(:trimmed_reads)
43
+ assert_equal(dataset.name, r.source.name)
40
44
  assert_equal(:trimmed_reads, r.key)
41
45
  assert_equal('data/02.trimmed_reads', r.relative_dir)
42
- assert_equal('data/02.trimmed_reads/dataset1.json', r.relative_path)
43
- assert_equal($p1.path, r.project.path)
44
- assert_equal($p1.path, r.project_path)
45
- r = $p1.add_result(:clade_finding)
46
- assert_equal($p1.path, r.source.path)
46
+ assert_equal('data/02.trimmed_reads/dataset0.json', r.relative_path)
47
+ assert_equal(project.path, r.project.path)
48
+ assert_equal(project.path, r.project_path)
49
+ r = project.add_result(:clade_finding)
50
+ assert_equal(project.path, r.source.path)
47
51
  end
48
52
 
49
53
  def test_dates
50
- r = $d1.add_result(:trimmed_reads)
54
+ r = dataset.add_result(:trimmed_reads)
51
55
  assert_nil(r.done_at)
52
56
  assert_nil(r.started_at)
53
- tf = File.join($p1.path, "data/02.trimmed_reads/#{$d1.name}.done")
54
- File.open(tf, 'w') { |fh| fh.puts Time.new(1,2,3,4,5) }
57
+ tf = File.join(
58
+ project.path, 'data', '02.trimmed_reads', "#{dataset.name}.done"
59
+ )
60
+ File.open(tf, 'w') { |fh| fh.puts Time.new(1, 2, 3, 4, 5) }
55
61
  assert_equal(Time, r.done_at.class)
56
62
  assert_nil(r.running_time)
57
- tf = File.join($p1.path, "data/02.trimmed_reads/#{$d1.name}.start")
58
- File.open(tf, 'w') { |fh| fh.puts Time.new(1,2,3,4,0) }
59
- r = $d1.add_result(:trimmed_reads)
63
+ tf = File.join(
64
+ project.path, 'data', '02.trimmed_reads', "#{dataset.name}.start"
65
+ )
66
+ File.open(tf, 'w') { |fh| fh.puts Time.new(1, 2, 3, 4, 0) }
67
+ r = dataset.add_result(:trimmed_reads)
60
68
  assert_equal(5.0, r.running_time)
61
69
  end
62
-
63
70
  end
@@ -2,7 +2,6 @@ require 'test_helper'
2
2
  require 'miga/tax_dist'
3
3
 
4
4
  class TaxDistTest < Test::Unit::TestCase
5
-
6
5
  def test_aai_path
7
6
  assert_path_exist(MiGA::TaxDist.aai_path(:intax))
8
7
  assert_path_exist(MiGA::TaxDist.aai_path(:novel))
@@ -54,5 +53,4 @@ class TaxDistTest < Test::Unit::TestCase
54
53
  close_intax = MiGA::TaxDist.aai_taxtest(99.0, :intax, engine: :blast)
55
54
  assert_equal(:s, close_intax[:probably][0])
56
55
  end
57
-
58
56
  end
@@ -1,7 +1,9 @@
1
1
  require 'test_helper'
2
+ require 'miga'
2
3
  require 'miga/tax_index'
3
4
 
4
5
  class TaxIndexTest < Test::Unit::TestCase
6
+ include TestHelper
5
7
 
6
8
  def test_initialization
7
9
  ti = MiGA::TaxIndex.new
@@ -9,12 +11,8 @@ class TaxIndexTest < Test::Unit::TestCase
9
11
  end
10
12
 
11
13
  def test_dataset
12
- $tmp = Dir.mktmpdir
13
- ENV['MIGA_HOME'] = $tmp
14
- FileUtils.touch(File.expand_path('.miga_rc', ENV["MIGA_HOME"]))
15
- FileUtils.touch(File.expand_path('.miga_daemon.json', ENV["MIGA_HOME"]))
16
- p = MiGA::Project.new(File.expand_path('project1', $tmp))
17
- d = p.add_dataset('dataset1')
14
+ initialize_miga_home
15
+ d = dataset
18
16
 
19
17
  ti = MiGA::TaxIndex.new
20
18
  assert_empty(ti.datasets)
@@ -24,9 +22,6 @@ class TaxIndexTest < Test::Unit::TestCase
24
22
  ti << d
25
23
  assert_equal(1, ti.datasets.size, 'index should have one dataset')
26
24
  assert_equal(1, ti.root.datasets_count)
27
- ensure
28
- FileUtils.rm_rf $tmp
29
- ENV["MIGA_HOME"] = nil
30
25
  end
31
26
 
32
27
  def test_to_json
@@ -40,5 +35,4 @@ class TaxIndexTest < Test::Unit::TestCase
40
35
  ti = MiGA::TaxIndex.new
41
36
  assert_equal("root:biota: 0\n", ti.to_tab)
42
37
  end
43
-
44
38
  end
@@ -2,7 +2,6 @@ require 'test_helper'
2
2
  require 'miga/taxonomy'
3
3
 
4
4
  class TaxonomyTest < Test::Unit::TestCase
5
-
6
5
  def test_ranks
7
6
  assert_respond_to(MiGA::Taxonomy, :KNOWN_RANKS)
8
7
  assert_include(MiGA::Taxonomy.KNOWN_RANKS, :s)
@@ -14,7 +13,7 @@ class TaxonomyTest < Test::Unit::TestCase
14
13
  def test_json
15
14
  txt = 'k:Fantasia f:Dragonaceae s:Dragonia_azura'
16
15
  js = '{"json_class":"MiGA::Taxonomy","str":"' + txt + '"}'
17
- tx = JSON.parse(js, {symbolize_names: false, create_additions: true})
16
+ tx = JSON.parse(js, { symbolize_names: false, create_additions: true })
18
17
  assert_equal(MiGA::Taxonomy, tx.class)
19
18
  assert_equal('Dragonaceae', tx[:f])
20
19
  assert_equal(js, tx.to_json)
@@ -25,7 +24,7 @@ class TaxonomyTest < Test::Unit::TestCase
25
24
  tx = MiGA::Taxonomy.new(txt)
26
25
  assert_equal(txt, tx.to_s)
27
26
  assert_equal(
28
- [[:k, 'Fantasia'],[:f, 'Dragonaceae'],[:s, 'Dragonia azura']],
27
+ [[:k, 'Fantasia'], [:f, 'Dragonaceae'], [:s, 'Dragonia azura']],
29
28
  tx.sorted_ranks
30
29
  )
31
30
  assert_equal('Irrealis', tx.namespace)
@@ -46,7 +45,7 @@ class TaxonomyTest < Test::Unit::TestCase
46
45
  end
47
46
 
48
47
  def test_init_methods
49
- tx = MiGA::Taxonomy.new({k: 'Mascot', c: 'Cereal', s: 'Melvin'})
48
+ tx = MiGA::Taxonomy.new({ k: 'Mascot', c: 'Cereal', s: 'Melvin' })
50
49
  assert_equal('k:Mascot c:Cereal s:Melvin', tx.to_s)
51
50
  tx = MiGA::Taxonomy.new('Mascot College Buzz', 'k c s')
52
51
  assert_equal('k:Mascot c:College s:Buzz', tx.to_s)
@@ -56,7 +55,7 @@ class TaxonomyTest < Test::Unit::TestCase
56
55
  end
57
56
 
58
57
  def test_rank_order
59
- tx = MiGA::Taxonomy.new({k: 'Mascot', s: 'Melvin', c: 'Cereal'})
58
+ tx = MiGA::Taxonomy.new({ k: 'Mascot', s: 'Melvin', c: 'Cereal' })
60
59
  assert_equal([:d, nil], tx.highest(true))
61
60
  assert_equal([:k, 'Mascot'], tx.highest)
62
61
  assert_equal([:ds, nil], tx.lowest(true))
@@ -65,7 +64,7 @@ class TaxonomyTest < Test::Unit::TestCase
65
64
 
66
65
  def test_alternative
67
66
  tx = MiGA::Taxonomy.new('ns:a s:Arnie', nil,
68
- ['ns:b s:Bernie','ns:c s:Cornie','s:Darnie'])
67
+ ['ns:b s:Bernie', 'ns:c s:Cornie', 's:Darnie'])
69
68
  # Fields
70
69
  assert_equal('ns:a s:Arnie', tx.to_s)
71
70
  assert_equal([[:s, 'Arnie']], tx.sorted_ranks)
@@ -77,7 +76,7 @@ class TaxonomyTest < Test::Unit::TestCase
77
76
  assert_equal(3, tx.alternative.size)
78
77
  # JSON
79
78
  js = tx.to_json
80
- tx_js = JSON.parse(js, {symbolize_names: false, create_additions: true})
79
+ tx_js = JSON.parse(js, { symbolize_names: false, create_additions: true })
81
80
  assert_equal(tx.to_s, tx_js.to_s)
82
81
  assert_equal(tx.alternative(2).to_s, tx_js.alternative(2).to_s)
83
82
  assert_equal(tx.alternative.size, tx_js.alternative.size)
@@ -94,7 +93,7 @@ class TaxonomyTest < Test::Unit::TestCase
94
93
 
95
94
  def test_reset
96
95
  tx = MiGA::Taxonomy.new('ns:Letters d:Latin s:A', nil,
97
- ['ns:Words d:English s:A', 'ns:Music d:Tone s:A'])
96
+ ['ns:Words d:English s:A', 'ns:Music d:Tone s:A'])
98
97
  # Reset
99
98
  assert_equal(2, tx.alternative.size)
100
99
  assert_equal('Letters', tx.namespace)
@@ -112,5 +111,4 @@ class TaxonomyTest < Test::Unit::TestCase
112
111
  tx.add_alternative(MiGA::Taxonomy.new('ns:Letters d:Unicode s:A'))
113
112
  assert_equal('ns:Letters d:Unicode s:A', tx.to_s)
114
113
  end
115
-
116
114
  end
@@ -11,7 +11,6 @@ require 'stringio'
11
11
  # Kernel extensions tp capture +$stdout+ and +$stderr+ based on
12
12
  # http://thinkingdigitally.com/archive/capturing-output-from-puts-in-ruby/
13
13
  module Kernel
14
-
15
14
  def capture_stdout
16
15
  out = StringIO.new
17
16
  $stdout = out
@@ -29,5 +28,47 @@ module Kernel
29
28
  ensure
30
29
  $stderr = STDERR
31
30
  end
31
+ end
32
32
 
33
+ module TestHelper
34
+ def teardown
35
+ @tmpdir ||= nil
36
+ FileUtils.rm_rf tmpdir unless @tmpdir.nil?
37
+ ENV['MIGA_HOME'] = nil
38
+ end
39
+
40
+ def declare_remote_access
41
+ omit_if(ENV['REMOTE_TESTS'].nil?, 'Remote access is error-prone')
42
+ end
43
+
44
+ def declare_forks
45
+ omit_if(!ENV['JRUBY_TESTS'].nil?, 'JRuby doesn\'t implement fork')
46
+ end
47
+
48
+ def tmpdir
49
+ @tmpdir ||= Dir.mktmpdir
50
+ end
51
+
52
+ def tmpfile(name)
53
+ File.join(tmpdir, name)
54
+ end
55
+
56
+ def initialize_miga_home(daemon = '{}')
57
+ ENV['MIGA_HOME'] = tmpdir
58
+ FileUtils.touch(File.join(ENV['MIGA_HOME'], '.miga_rc'))
59
+ File.open(File.join(ENV['MIGA_HOME'], '.miga_daemon.json'), 'w') do |fh|
60
+ fh.puts daemon
61
+ end
62
+ end
63
+
64
+ def project(i = 0)
65
+ @project ||= {}
66
+ i = "project#{i}" unless i.is_a? String
67
+ @project[i] ||= MiGA::Project.new(tmpfile(i))
68
+ end
69
+
70
+ def dataset(project_i = 0, n = 0)
71
+ n = "dataset#{n}" unless n.is_a? String
72
+ project(project_i).dataset(n) || project(project_i).add_dataset(n)
73
+ end
33
74
  end
@@ -2,15 +2,7 @@ require 'test_helper'
2
2
  require 'miga/common/with_daemon'
3
3
 
4
4
  class WithDaemonTest < Test::Unit::TestCase
5
-
6
- def setup
7
- $jruby_tests = !ENV['JRUBY_TESTS'].nil?
8
- $tmp = Dir.mktmpdir
9
- end
10
-
11
- def teardown
12
- FileUtils.rm_rf $tmp
13
- end
5
+ include TestHelper
14
6
 
15
7
  class TestWithDaemon < MiGA::MiGA
16
8
  include MiGA::Common::WithDaemon
@@ -40,7 +32,7 @@ class WithDaemonTest < Test::Unit::TestCase
40
32
  puts(*o)
41
33
  end
42
34
  end
43
-
35
+
44
36
  class TestWithDaemon2 < TestWithDaemon
45
37
  def daemon_loop
46
38
  puts 'I am 2.0!'
@@ -54,20 +46,20 @@ class WithDaemonTest < Test::Unit::TestCase
54
46
  end
55
47
 
56
48
  def test_with_daemon
57
- d = TestWithDaemon.new($tmp)
49
+ d = TestWithDaemon.new(tmpdir)
58
50
  assert_respond_to(d, :pid_file)
59
51
  assert_respond_to(d.class, :daemon_home)
60
52
  assert_nil(d.loop_i)
61
53
  end
62
54
 
63
55
  def test_daemon_run
64
- d = TestWithDaemon2.new($tmp)
56
+ d = TestWithDaemon2.new(tmpdir)
65
57
  capture_stdout { d.run }
66
58
  assert_path_not_exist(d.pid_file)
67
59
  end
68
60
 
69
61
  def test_daemmon_status
70
- d = TestWithDaemon.new($tmp)
62
+ d = TestWithDaemon.new(tmpdir)
71
63
  out = capture_stdout { d.status }.string
72
64
  assert_match(/Not running/, out)
73
65
 
@@ -84,11 +76,11 @@ class WithDaemonTest < Test::Unit::TestCase
84
76
  end
85
77
 
86
78
  def test_daemon_operations
87
- d = TestWithDaemon.new($tmp)
79
+ d = TestWithDaemon.new(tmpdir)
88
80
  FileUtils.touch(d.output_file)
89
81
  assert_not_predicate(d, :active?)
90
82
 
91
- omit_if($jruby_tests, 'JRuby doesn\'t implement fork.')
83
+ declare_forks
92
84
  capture_stdout do
93
85
  pid = d.start
94
86
  assert_gt(pid, 0)
@@ -112,7 +104,7 @@ class WithDaemonTest < Test::Unit::TestCase
112
104
  end
113
105
 
114
106
  def test_termination_file
115
- d = TestWithDaemon2.new($tmp)
107
+ d = TestWithDaemon2.new(tmpdir)
116
108
  assert { !d.termination_file?(nil) }
117
109
  FileUtils.touch(d.terminate_file)
118
110
  err = capture_stdout do
@@ -124,19 +116,19 @@ class WithDaemonTest < Test::Unit::TestCase
124
116
  end
125
117
 
126
118
  def test_process_alive
127
- d = TestWithDaemon2.new($tmp)
119
+ d = TestWithDaemon2.new(tmpdir)
128
120
  assert { d.process_alive?(Process.pid) }
129
121
  assert { !d.process_alive?(1e9) }
130
122
  end
131
123
 
132
124
  def test_declare_alive_loop
133
- d = TestWithDaemon.new(File.join($tmp, 'nope'))
125
+ d = TestWithDaemon.new(tmpfile('nope'))
134
126
  assert_equal(:no_home, d.declare_alive_loop)
135
127
 
136
- d = TestWithDaemon.new($tmp)
128
+ d = TestWithDaemon.new(tmpdir)
137
129
  assert_equal(:no_process_alive, d.declare_alive_loop(1e9))
138
130
 
139
- omit_if($jruby_tests, 'JRuby doesn\'t implement fork.')
131
+ declare_forks
140
132
  FileUtils.touch(d.terminate_file)
141
133
  child = fork { sleep(3) }
142
134
  capture_stdout do
@@ -145,12 +137,12 @@ class WithDaemonTest < Test::Unit::TestCase
145
137
  end
146
138
 
147
139
  def test_write_alive_file
148
- d = TestWithDaemon.new(File.join($tmp, 'nope'))
140
+ d = TestWithDaemon.new(tmpfile('nope'))
149
141
  assert_not_predicate(d, :active?)
150
142
  assert_raise { d.write_alive_file }
151
143
  assert_not_predicate(d, :active?)
152
144
 
153
- d = TestWithDaemon.new($tmp)
145
+ d = TestWithDaemon.new(tmpdir)
154
146
  assert_not_predicate(d, :active?)
155
147
  d.write_alive_file
156
148
  assert_predicate(d, :active?)
@@ -300,3 +300,16 @@ AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAG
300
300
  AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC
301
301
  >TruSeq3_UniversalAdapter
302
302
  AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTA
303
+
304
+ >Nextera_PE_PrefixNX/1
305
+ AGATGTGTATAAGAGACAG
306
+ >Nextera_PE_PrefixNX/2
307
+ AGATGTGTATAAGAGACAG
308
+ >Nextera_PE_Trans1
309
+ TCGTCGGCAGCGTCAGATGTGTATAAGAGACAG
310
+ >Nextera_PE_Trans1_rc
311
+ CTGTCTCTTATACACATCTGACGCTGCCGACGA
312
+ >Nextera_PE_Trans2
313
+ GTCTCGTGGGCTCGGAGATGTGTATAAGAGACAG
314
+ >Nextera_PE_Trans2_rc
315
+ CTGTCTCTTATACACATCTCCGAGCCCACGAGAC
@@ -10,23 +10,24 @@ p = MiGA::Project.load(ARGV[0])
10
10
  ds_names = p.dataset_names
11
11
  thr = ARGV[1].to_i
12
12
 
13
- pc = [0] + (1 .. 100).map{ |i| ds_names.size * i / 100 }
14
- $stderr.puts (('.'*9 + '|')*10) + ' 100%'
13
+ pc = [0] + (1..100).map { |i| ds_names.size * i / 100 }
14
+ $stderr.puts (('.' * 9 + '|') * 10) + ' 100%'
15
15
 
16
- (0 .. thr-1).each do |t|
16
+ (0..thr - 1).each do |t|
17
17
  fork do
18
18
  ds_names.each_with_index do |i, idx|
19
- while t == 0 and idx+1 > pc.first
19
+ while t == 0 and idx + 1 > pc.first
20
20
  $stderr.print '#'
21
21
  pc.shift
22
22
  end
23
23
  next unless (idx % thr) == t
24
+
24
25
  d = p.dataset(i)
25
26
  next unless d.is_ref? and d.is_active?
27
+
26
28
  d.cleanup_distances!
27
29
  end
28
30
  end
29
31
  end
30
32
  Process.waitall
31
33
  $stderr.puts ' Done'
32
-
@@ -1,4 +1,3 @@
1
-
2
1
  require 'miga'
3
2
  require 'miga/tax_dist'
4
3