rbbt-util 5.43.0 → 5.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/association/util.rb +1 -1
  3. data/lib/rbbt/hpc/batch.rb +19 -17
  4. data/lib/rbbt/tsv/accessor.rb +6 -11
  5. data/lib/rbbt/tsv/dumper.rb +21 -10
  6. data/lib/rbbt/tsv/index.rb +2 -1
  7. data/lib/rbbt/util/misc/math.rb +0 -1
  8. data/lib/rbbt/util/open.rb +1 -1
  9. data/lib/rbbt/workflow/step/info.rb +1 -0
  10. data/lib/rbbt/workflow/step.rb +2 -1
  11. data/python/rbbt/__init__.py +2 -2
  12. data/share/rbbt_commands/workflow/task +1 -1
  13. metadata +4 -220
  14. data/test/rbbt/annotations/test_util.rb +0 -43
  15. data/test/rbbt/association/test_database.rb +0 -87
  16. data/test/rbbt/association/test_index.rb +0 -127
  17. data/test/rbbt/association/test_item.rb +0 -15
  18. data/test/rbbt/association/test_open.rb +0 -63
  19. data/test/rbbt/association/test_util.rb +0 -108
  20. data/test/rbbt/entity/test_identifiers.rb +0 -34
  21. data/test/rbbt/hpc/orchestrate/test_batches.rb +0 -70
  22. data/test/rbbt/hpc/orchestrate/test_chains.rb +0 -108
  23. data/test/rbbt/hpc/orchestrate/test_rules.rb +0 -59
  24. data/test/rbbt/hpc/test_batch.rb +0 -64
  25. data/test/rbbt/hpc/test_hpc_test_workflows.rb +0 -0
  26. data/test/rbbt/hpc/test_orchestrate.rb +0 -144
  27. data/test/rbbt/hpc/test_pbs.rb +0 -43
  28. data/test/rbbt/hpc/test_slurm.rb +0 -28
  29. data/test/rbbt/knowledge_base/test_enrichment.rb +0 -50
  30. data/test/rbbt/knowledge_base/test_entity.rb +0 -62
  31. data/test/rbbt/knowledge_base/test_query.rb +0 -46
  32. data/test/rbbt/knowledge_base/test_registry.rb +0 -74
  33. data/test/rbbt/knowledge_base/test_syndicate.rb +0 -48
  34. data/test/rbbt/knowledge_base/test_traverse.rb +0 -133
  35. data/test/rbbt/persist/test_tsv.rb +0 -88
  36. data/test/rbbt/persist/tsv/test_cdb.rb +0 -18
  37. data/test/rbbt/persist/tsv/test_kyotocabinet.rb +0 -27
  38. data/test/rbbt/persist/tsv/test_leveldb.rb +0 -18
  39. data/test/rbbt/persist/tsv/test_lmdb.rb +0 -20
  40. data/test/rbbt/persist/tsv/test_sharder.rb +0 -164
  41. data/test/rbbt/persist/tsv/test_tokyocabinet.rb +0 -262
  42. data/test/rbbt/resource/test_path.rb +0 -49
  43. data/test/rbbt/test_annotations.rb +0 -167
  44. data/test/rbbt/test_association.rb +0 -103
  45. data/test/rbbt/test_entity.rb +0 -252
  46. data/test/rbbt/test_fix_width_table.rb +0 -135
  47. data/test/rbbt/test_knowledge_base.rb +0 -226
  48. data/test/rbbt/test_monitor.rb +0 -11
  49. data/test/rbbt/test_packed_index.rb +0 -68
  50. data/test/rbbt/test_persist.rb +0 -85
  51. data/test/rbbt/test_resource.rb +0 -110
  52. data/test/rbbt/test_tsv.rb +0 -669
  53. data/test/rbbt/test_workflow.rb +0 -609
  54. data/test/rbbt/tsv/parallel/test_through.rb +0 -40
  55. data/test/rbbt/tsv/parallel/test_traverse.rb +0 -456
  56. data/test/rbbt/tsv/test_accessor.rb +0 -319
  57. data/test/rbbt/tsv/test_attach.rb +0 -715
  58. data/test/rbbt/tsv/test_change_id.rb +0 -61
  59. data/test/rbbt/tsv/test_csv.rb +0 -49
  60. data/test/rbbt/tsv/test_excel.rb +0 -171
  61. data/test/rbbt/tsv/test_field_index.rb +0 -19
  62. data/test/rbbt/tsv/test_filter.rb +0 -187
  63. data/test/rbbt/tsv/test_index.rb +0 -308
  64. data/test/rbbt/tsv/test_manipulate.rb +0 -334
  65. data/test/rbbt/tsv/test_marshal.rb +0 -24
  66. data/test/rbbt/tsv/test_matrix.rb +0 -20
  67. data/test/rbbt/tsv/test_parallel.rb +0 -7
  68. data/test/rbbt/tsv/test_parser.rb +0 -101
  69. data/test/rbbt/tsv/test_stream.rb +0 -253
  70. data/test/rbbt/tsv/test_util.rb +0 -52
  71. data/test/rbbt/util/R/test_eval.rb +0 -43
  72. data/test/rbbt/util/R/test_model.rb +0 -128
  73. data/test/rbbt/util/R/test_plot.rb +0 -38
  74. data/test/rbbt/util/concurrency/processes/test_socket.rb +0 -70
  75. data/test/rbbt/util/concurrency/test_processes.rb +0 -192
  76. data/test/rbbt/util/concurrency/test_threads.rb +0 -40
  77. data/test/rbbt/util/log/test_progress.rb +0 -111
  78. data/test/rbbt/util/misc/test_bgzf.rb +0 -48
  79. data/test/rbbt/util/misc/test_communication.rb +0 -13
  80. data/test/rbbt/util/misc/test_development.rb +0 -26
  81. data/test/rbbt/util/misc/test_format.rb +0 -10
  82. data/test/rbbt/util/misc/test_indiferent_hash.rb +0 -14
  83. data/test/rbbt/util/misc/test_lock.rb +0 -77
  84. data/test/rbbt/util/misc/test_multipart_payload.rb +0 -202
  85. data/test/rbbt/util/misc/test_omics.rb +0 -116
  86. data/test/rbbt/util/misc/test_pipes.rb +0 -343
  87. data/test/rbbt/util/misc/test_serialize.rb +0 -24
  88. data/test/rbbt/util/python/test_util.rb +0 -25
  89. data/test/rbbt/util/simpleopt/test_get.rb +0 -12
  90. data/test/rbbt/util/simpleopt/test_parse.rb +0 -10
  91. data/test/rbbt/util/simpleopt/test_setup.rb +0 -76
  92. data/test/rbbt/util/test_R.rb +0 -37
  93. data/test/rbbt/util/test_chain_methods.rb +0 -22
  94. data/test/rbbt/util/test_cmd.rb +0 -87
  95. data/test/rbbt/util/test_colorize.rb +0 -22
  96. data/test/rbbt/util/test_concurrency.rb +0 -6
  97. data/test/rbbt/util/test_config.rb +0 -69
  98. data/test/rbbt/util/test_excel2tsv.rb +0 -10
  99. data/test/rbbt/util/test_filecache.rb +0 -36
  100. data/test/rbbt/util/test_log.rb +0 -52
  101. data/test/rbbt/util/test_migrate.rb +0 -34
  102. data/test/rbbt/util/test_misc.rb +0 -728
  103. data/test/rbbt/util/test_open.rb +0 -200
  104. data/test/rbbt/util/test_procpath.rb +0 -23
  105. data/test/rbbt/util/test_python.rb +0 -144
  106. data/test/rbbt/util/test_semaphore.rb +0 -36
  107. data/test/rbbt/util/test_simpleDSL.rb +0 -55
  108. data/test/rbbt/util/test_simpleopt.rb +0 -11
  109. data/test/rbbt/util/test_ssh.rb +0 -10
  110. data/test/rbbt/util/test_tmpfile.rb +0 -32
  111. data/test/rbbt/workflow/step/test_dependencies.rb +0 -295
  112. data/test/rbbt/workflow/step/test_save_load_inputs.rb +0 -136
  113. data/test/rbbt/workflow/test_doc.rb +0 -30
  114. data/test/rbbt/workflow/test_remote_workflow.rb +0 -99
  115. data/test/rbbt/workflow/test_schedule.rb +0 -0
  116. data/test/rbbt/workflow/test_step.rb +0 -231
  117. data/test/rbbt/workflow/test_task.rb +0 -85
  118. data/test/rbbt/workflow/util/test_archive.rb +0 -27
  119. data/test/rbbt/workflow/util/test_data.rb +0 -67
  120. data/test/rbbt/workflow/util/test_orchestrator.rb +0 -263
  121. data/test/test_helper.rb +0 -114
@@ -1,127 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/misc'
3
- require 'rbbt/association'
4
- require 'rbbt/association/index'
5
-
6
- class TestAssociationIndex < Test::Unit::TestCase
7
-
8
- EFFECT =<<-END
9
- #: :sep=" "#:type=:double
10
- #SG TG Effect directed?
11
- MDM2 TP53 inhibition false
12
- TP53 NFKB1|GLI1 activation|activation true|true
13
- END
14
-
15
- EFFECT_OPTIONS = {
16
- :source => "SG=~Associated Gene Name",
17
- :target => "TG=~Associated Gene Name=>Ensembl Gene ID",
18
- :persist => false,
19
- :identifiers => datafile_test('identifiers'),
20
- :namespace => "Hsa"
21
- }
22
-
23
- EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
24
-
25
- def test_index_no_persist_string
26
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:source => "TG", :target => "SG=~Associated Gene Name"), :persist => false)
27
- tsv.unnamed = false
28
- assert_equal "inhibition", tsv["TP53~MDM2"]["Effect"]
29
- end
30
-
31
- def test_index_no_persist_string_undirected
32
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => true, :source => "TG", :target => "SG=~Associated Gene Name"), :persist => false)
33
- tsv.unnamed = false
34
- assert_equal "inhibition", tsv["TP53~MDM2"]["Effect"]
35
- end
36
-
37
- def test_index_persist_string
38
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:source => "SG", :target => "TG=~Associated Gene Name"), :persist => true, :update => true)
39
- tsv.unnamed = false
40
- assert_equal "inhibition", tsv["MDM2~TP53"]["Effect"]
41
- assert_equal %w(TP53~NFKB1 TP53~GLI1).sort, tsv.match("TP53").sort
42
- end
43
-
44
- def test_index_persist_reverse
45
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:source => "TG", :target => "SG=~Associated Gene Name"), :persist => true, :update => true).reverse
46
- tsv.unnamed = false
47
- assert_equal "inhibition", tsv["MDM2~TP53"]["Effect"]
48
- assert_equal %w(MDM2~TP53), tsv.match("MDM2")
49
- end
50
-
51
- def test_index_persist_undirected
52
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => true, :source => "TG=~Associated Gene Name", :target => "SG=~Associated Gene Name"), :persist => true)
53
- tsv.unnamed = false
54
- assert_equal "inhibition", tsv["MDM2~TP53"]["Effect"]
55
- assert_equal "inhibition", tsv["TP53~MDM2"]["Effect"]
56
- assert_equal %w(MDM2~TP53), tsv.match("MDM2")
57
- end
58
-
59
- def test_index_persist_directed_subset
60
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => true, :source => "TG=~Associated Gene Name", :target => "SG=~Associated Gene Name"), :persist => true)
61
- tsv.unnamed = false
62
- assert_equal %w(TP53~GLI1 TP53~MDM2).sort, tsv.subset(["TP53"], ["GLI1","MDM2"]).sort
63
- assert_equal %w(MDM2~TP53).sort, tsv.subset(["MDM2"], :all).sort
64
- assert_equal %w(GLI1~TP53).sort, tsv.subset(["GLI1"], :all).sort
65
- assert_equal %w(TP53~GLI1).sort, tsv.subset(:all, ["GLI1"]).sort
66
- end
67
-
68
- def test_index_persist_undirected_subset
69
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
70
- tsv.unnamed = false
71
- assert_equal %w(TP53~GLI1 TP53~NFKB1).sort, tsv.subset(["TP53"], ["GLI1","MDM2", "NFKB1"]).sort
72
- end
73
-
74
- def test_index_flat
75
- require 'rbbt/sources/tfacts'
76
- file = TFactS.regulators
77
- tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
78
- assert tsv.match("TP53").length > 10
79
- end
80
-
81
- def test_index_flat_to_matrix
82
- require 'rbbt/sources/tfacts'
83
- file = TFactS.regulators
84
- tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
85
- assert(tsv.to_matrix(false))
86
- end
87
-
88
- def test_filter_no_block
89
- require 'rbbt/sources/tfacts'
90
- file = TFactS.regulators
91
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
92
- tsv.unnamed = false
93
- matches = tsv.filter :directed?
94
- assert_equal 2, matches.length
95
- end
96
-
97
- def test_filter_no_block_value
98
- require 'rbbt/sources/tfacts'
99
- file = TFactS.regulators
100
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
101
- tsv.unnamed = false
102
- matches = tsv.filter :Effect, "inhibition"
103
- assert_equal ["MDM2~TP53"], matches
104
- end
105
-
106
- def test_filter_block_value_field
107
- require 'rbbt/sources/tfacts'
108
- file = TFactS.regulators
109
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
110
- tsv.unnamed = false
111
- matches = tsv.filter :Effect do |value|
112
- return value.include? "inhibition"
113
- end
114
- assert_equal ["MDM2~TP53"], matches
115
- end
116
-
117
- def test_filter_block_no_value_field
118
- require 'rbbt/sources/tfacts'
119
- file = TFactS.regulators
120
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
121
- tsv.unnamed = false
122
- matches = tsv.filter do |key,values|
123
- return values.flatten.include? "inhibition"
124
- end
125
- assert_equal ["MDM2~TP53"], matches
126
- end
127
- end
@@ -1,15 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'test/unit'
4
- require 'rbbt/tsv'
5
- require 'rbbt/association/item'
6
-
7
- class TestAssociationItem < Test::Unit::TestCase
8
- def test_incidence
9
- pairs = [[:A, :a], [:B, :b]].collect{|p| "#{p.first.to_s}~#{p.last.to_s}"}
10
- assert TSV === AssociationItem.incidence(pairs)
11
- assert_equal 2, AssociationItem.incidence(pairs).length
12
- assert_equal 2, AssociationItem.incidence(pairs).fields.length
13
- end
14
- end
15
-
@@ -1,63 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/misc'
3
- require 'rbbt/association'
4
- require 'rbbt/association/open'
5
-
6
- class TestAssociationOpen < Test::Unit::TestCase
7
-
8
- EFFECT =<<-END
9
- #: :sep=" "#:type=:double
10
- #SG TG Effect directed?
11
- MDM2 TP53 inhibition false
12
- TP53 NFKB1|GLI1 activation|activation true|true
13
- END
14
-
15
- EFFECT_OPTIONS = {
16
- :source => "SG=~Associated Gene Name",
17
- :target => "TG=~Associated Gene Name=>Ensembl Gene ID",
18
- :persist => false,
19
- :identifiers => datafile_test('identifiers'),
20
- :namespace => "Hsa"
21
- }
22
-
23
- EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
24
-
25
- def test_open_no_persist
26
- tsv = Association.open(EFFECT_TSV, EFFECT_OPTIONS, :persist => false)
27
- assert_equal "ENSG00000141510", tsv["MDM2"]["Ensembl Gene ID"].first
28
- assert_equal ["false"], tsv["MDM2"]["directed?"]
29
- end
30
-
31
-
32
- def test_open_persist
33
- tsv = Association.open(EFFECT, EFFECT_OPTIONS, :persist => true, :update => true)
34
- assert_equal "ENSG00000141510", tsv["MDM2"]["Ensembl Gene ID"].first
35
- assert_equal ["false"], tsv["MDM2"]["directed?"]
36
- end
37
-
38
- def test_open_no_persist_string
39
- tsv = Association.open(EFFECT, EFFECT_OPTIONS.merge(:source => "TG", :target => "SG=~Associated Gene Name"), :persist => false)
40
- tsv.include? "TP53"
41
- assert_equal ["MDM2"], tsv["TP53"]["Associated Gene Name"]
42
- end
43
-
44
- def test_index_no_persist_string
45
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:source => "TG", :target => "SG=~Associated Gene Name"), :persist => false)
46
- tsv.unnamed = false
47
- assert_equal "inhibition", tsv["TP53~MDM2"]["Effect"]
48
- end
49
-
50
- def test_index_persist_string
51
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:source => "SG", :target => "TG=~Associated Gene Name"), :persist => true)
52
- tsv.unnamed = false
53
- assert_equal "inhibition", tsv["MDM2~TP53"]["Effect"]
54
- assert_equal %w(TP53~GLI1 TP53~NFKB1), tsv.match("TP53").sort
55
- end
56
-
57
- def test_index_persist_reverse
58
- tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge( :source => "TG", :target => "SG=~Associated Gene Name"), :persist => true).reverse
59
- tsv.unnamed = false
60
- assert_equal "inhibition", tsv["MDM2~TP53"]["Effect"]
61
- assert_equal %w(MDM2~TP53), tsv.match("MDM2")
62
- end
63
- end
@@ -1,108 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/misc'
3
- require 'rbbt/association'
4
- require 'rbbt/association'
5
- require 'rbbt/association/util'
6
-
7
- class TestAssociationUtil < Test::Unit::TestCase
8
-
9
- def test_specs
10
- spec = Association.parse_field_specification "=~Associated Gene Name=>Ensembl Gene ID"
11
- assert_equal [nil, "Associated Gene Name", "Ensembl Gene ID"], spec
12
-
13
- spec = Association.parse_field_specification "TG=~Associated Gene Name=>Ensembl Gene ID"
14
- assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec
15
-
16
- spec = Association.parse_field_specification "TG=~Associated Gene Name"
17
- assert_equal ["TG", "Associated Gene Name", nil], spec
18
-
19
- spec = Association.parse_field_specification "Associated Gene Name=>Ensembl Gene ID"
20
- assert_equal ["Associated Gene Name", nil, "Ensembl Gene ID"], spec
21
- end
22
-
23
- def test_normalize_specs
24
- spec = Association.normalize_specs "TG=~Associated Gene Name=>Ensembl Gene ID", %w(SG TG Effect directed?)
25
- assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec
26
-
27
- spec = Association.normalize_specs "Ensembl Gene ID", %w(SG TG Effect directed?)
28
- assert_equal ["Ensembl Gene ID", nil, nil], spec
29
-
30
- spec = Association.normalize_specs "Ensembl Gene ID"
31
- assert_equal ["Ensembl Gene ID", nil, nil], spec
32
- end
33
-
34
- def test_process_specs
35
- spec = Association.extract_specs %w(SG TG Effect directed?), :target => "TG=~Associated Gene Name=>Ensembl Gene ID"
36
- assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec[:target]
37
- assert_equal ["SG", nil, nil], spec[:source]
38
-
39
- spec = Association.extract_specs %w(SG TG Effect directed?)
40
- assert_equal ["SG", nil, nil], spec[:source]
41
- assert_equal ["TG", nil,nil], spec[:target]
42
-
43
- spec = Association.extract_specs %w(SG TG Effect directed?), :source => "TG"
44
- assert_equal ["TG", nil, nil], spec[:source]
45
- assert_equal ["SG", nil,nil], spec[:target]
46
-
47
- spec = Association.extract_specs %w(SG TG Effect directed?), :source => "SG"
48
- assert_equal ["SG", nil, nil], spec[:source]
49
- assert_equal ["TG", nil,nil], spec[:target]
50
-
51
- spec = Association.extract_specs %w(SG TG Effect directed?), :target => "SG"
52
- assert_equal ["TG", nil, nil], spec[:source]
53
- assert_equal ["SG", nil,nil], spec[:target]
54
- end
55
-
56
- def test_headers
57
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect)
58
- assert_equal 0, spec[0]
59
- assert_equal 1, spec[1][0]
60
-
61
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :source => "SG"
62
- assert_equal 0, spec[0]
63
- assert_equal 1, spec[1][0]
64
-
65
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG"
66
- assert_equal 0, spec[0]
67
- assert_equal 1, spec[1][0]
68
-
69
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG", :source => "SG"
70
- assert_equal 0, spec[0]
71
- assert_equal 1, spec[1][0]
72
-
73
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :source => "TG"
74
- assert_equal 1, spec[0]
75
- assert_equal 0, spec[1][0]
76
-
77
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG"
78
- assert_equal 1, spec[0]
79
- assert_equal 0, spec[1][0]
80
-
81
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG", :source => "TG"
82
- assert_equal 1, spec[0]
83
- assert_equal 0, spec[1][0]
84
-
85
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
86
- assert_equal 1, spec[0]
87
- assert_equal 0, spec[1][0]
88
-
89
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG=~Associated Gene Name=>Ensembl Gene ID", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
90
- assert_equal 1, spec[0]
91
- assert_equal 0, spec[1][0]
92
-
93
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG=~Associated Gene Name", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
94
- assert_equal 1, spec[0]
95
- assert_equal 0, spec[1][0]
96
-
97
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG=~Associated Gene Name", :source => "SG=~Associated Gene Name", :target_format => "Ensembl Gene ID"
98
- assert_equal 0, spec[0]
99
- assert_equal "Ensembl Gene ID", spec[5]
100
- assert_equal nil, spec[4]
101
-
102
-
103
- spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG=~Associated Gene Name", :source => "SG=~Associated Gene Name", :source_format => "Ensembl Gene ID"
104
- assert_equal 0, spec[0]
105
- assert_equal "Ensembl Gene ID", spec[4]
106
- assert_equal nil, spec[5]
107
- end
108
- end
@@ -1,34 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt-util'
3
- require 'rbbt/entity'
4
- require 'rbbt/entity/identifiers'
5
-
6
- module Gene
7
- extend Entity
8
- end
9
-
10
- class TestEntityIdentifiers < Test::Unit::TestCase
11
-
12
- def test_name
13
- Gene.add_identifiers datafile_test('identifiers'), "Ensembl Gene ID", "Associated Gene Name"
14
- assert_equal "TP53", Gene.setup("ENSG00000141510").name
15
- end
16
-
17
- def test_name_organism
18
- keyword_test :organism do
19
- require 'rbbt/sources/organism'
20
- Gene.add_identifiers Organism.identifiers("NAMESPACE"), "Ensembl Gene ID", "Associated Gene Name"
21
- assert_equal "TP53", Gene.setup("ENSG00000141510", "Ensembl Gene ID", "Hsa/feb2014").name
22
- end
23
- end
24
-
25
- def test_identifier_files
26
- Gene.add_identifiers datafile_test('identifiers'), "Ensembl Gene ID", "Associated Gene Name"
27
- assert Gene.identifier_files.any?
28
- end
29
-
30
- def test_Entity_identifier_files
31
- Gene.add_identifiers datafile_test('identifiers'), "Ensembl Gene ID", "Associated Gene Name"
32
- assert Entity.identifier_files("Ensembl Gene ID").any?
33
- end
34
- end
@@ -1,70 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/workflow'
3
- require 'rbbt/hpc/orchestrate/batches'
4
-
5
- require_relative '../hpc_test_workflows'
6
-
7
- class TestOrchestrateBatches < Test::Unit::TestCase
8
-
9
- RULES = IndiferentHash.setup(YAML.load(<<-EOF))
10
- ---
11
- defaults:
12
- queue: first_queue
13
- time: 1h
14
- log: 2
15
- config_keys: key1 value1 token1
16
- chains:
17
- chain_a_b:
18
- tasks: TestWFB#b1, TestWFB#b2, TestWFA#a1, TestWFA#a2
19
- config_keys: key2 value2 token2, key3 value3 token3.1 token3.2
20
- chain_a:
21
- workflow: TestWFA
22
- tasks: a1, a2, a3
23
- config_keys: key2 value2 token2, key3 value3 token3.1 token3.2
24
- chain_b:
25
- workflow: TestWFB
26
- tasks: b1, b2
27
- chain_b2:
28
- tasks: TestWFB#b1, TestWFB#b2, TestWFA#a1
29
- chain_d:
30
- tasks: TestWFD#d1, TestWFC#c1, TestWFC#c2, TestWFC#c3
31
- TestWFA:
32
- defaults:
33
- log: 4
34
- config_keys: key4 value4 token4
35
- time: 10min
36
- a1:
37
- cpus: 10
38
- config_keys: key5 value5 token5
39
- TestWFC:
40
- defaults:
41
- skip: true
42
- log: 4
43
- time: 10s
44
- EOF
45
-
46
-
47
- def test_job_batches_d
48
- job = TestWFD.job(:d1, nil)
49
- job.recursive_clean
50
-
51
- batches = HPC::Orchestration.job_batches(RULES, job)
52
- assert_equal 3, batches.length
53
- end
54
-
55
- def test_job_batches_c3
56
- job = TestWFC.job(:c3, nil)
57
- job.recursive_clean
58
-
59
- batches = HPC::Orchestration.job_batches(RULES, job)
60
- end
61
-
62
- def test_job_batches_c4
63
- job = TestWFC.job(:c4, nil)
64
- job.recursive_clean
65
-
66
- batches = HPC::Orchestration.job_batches(RULES, job)
67
- assert_equal 3, batches.length
68
- end
69
-
70
- end
@@ -1,108 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/hpc/orchestrate/chains'
3
-
4
- require_relative '../hpc_test_workflows'
5
-
6
- class TestOrchestrateChains < Test::Unit::TestCase
7
-
8
- RULES = IndiferentHash.setup(YAML.load(<<-EOF))
9
- ---
10
- defaults:
11
- queue: first_queue
12
- time: 1h
13
- log: 2
14
- config_keys: key1 value1 token1
15
- chains:
16
- chain_a_b:
17
- tasks: TestWFB#b1, TestWFB#b2, TestWFA#a1, TestWFA#a2
18
- comment: Should not include TestWFA#a1
19
- chain_a:
20
- workflow: TestWFA
21
- tasks: a1, a2, a3
22
- config_keys: key2 value2 token2, key3 value3 token3.1 token3.2
23
- chain_b:
24
- workflow: TestWFB
25
- tasks: b1, b2
26
- chain_b2:
27
- tasks: TestWFB#b1, TestWFB#b2, TestWFA#a1
28
- chain_d:
29
- tasks: TestWFD#d1, TestWFC#c1, TestWFC#c2, TestWFC#c3
30
- TestWFA:
31
- defaults:
32
- log: 4
33
- config_keys: key4 value4 token4
34
- a1:
35
- cpus: 10
36
- config_keys: key5 value5 token5
37
- TestWFC:
38
- defaults:
39
- skip: true
40
- log: 4
41
- EOF
42
-
43
- def test_parse_chains
44
- chains = HPC::Orchestration.parse_chains RULES
45
- assert chains[:chain_a][:tasks]["TestWFA"].include?("a1")
46
- end
47
-
48
- def test_job_chain_a
49
- job = TestWFA.job(:a3, nil)
50
- job.recursive_clean
51
-
52
- job_chains = HPC::Orchestration.job_chains(RULES, job)
53
- job_chains = NamedArray.setup(job_chains, job_chains.collect{|n,i| n })
54
-
55
- assert_equal %w(chain_a_b chain_a), job_chains.fields
56
- assert_equal 3, job_chains["chain_a"].last[:jobs].length
57
- assert_equal job, job_chains["chain_a"].last[:top_level]
58
- end
59
-
60
- def test_job_chain_b
61
- job = TestWFB.job(:b2, nil)
62
- job.recursive_clean
63
-
64
- job_chains = HPC::Orchestration.job_chains(RULES, job)
65
- job_chains = NamedArray.setup(job_chains, job_chains.collect{|n,i| n })
66
-
67
- assert_equal %w(chain_a chain_b chain_b2 chain_a_b).sort, job_chains.fields.sort
68
-
69
- assert_equal 2, job_chains["chain_a"].last[:jobs].length
70
- assert_equal job.step("a2"), job_chains["chain_a"].last[:top_level]
71
-
72
- assert_equal 2, job_chains["chain_b"].last[:jobs].length
73
- assert_equal job, job_chains["chain_b"].last[:top_level]
74
-
75
- assert_equal 2, job_chains["chain_b2"].last[:jobs].length
76
- assert_equal job, job_chains["chain_b2"].last[:top_level]
77
-
78
- assert_equal 4, job_chains["chain_a_b"].last[:jobs].length
79
- assert_equal job, job_chains["chain_a_b"].last[:top_level]
80
- end
81
-
82
- def test_job_chains_double
83
- job = TestWFD.job(:d1, nil)
84
- job.recursive_clean
85
-
86
- job_chains = HPC::Orchestration.job_chains(RULES, job)
87
- job_chains = NamedArray.setup(job_chains, job_chains.collect{|n,i| n })
88
-
89
- assert_equal 2, job_chains.select{|n,i| n == 'chain_a' }.length
90
- assert_equal ["First c3", "Second c3"].sort, job_chains.
91
- select{|n,i| n == 'chain_a' }.
92
- collect{|n,i| i[:top_level].name }.sort
93
-
94
- assert_equal 1, job_chains.select{|n,i| n == 'chain_d' }.length
95
- end
96
-
97
- def __test_benchmark
98
-
99
- job = TestDeepWF.job(:suite, :size => 100)
100
- job.recursive_clean
101
-
102
- Misc.benchmark(10) do
103
- HPC::Orchestration.job_chains(RULES, job)
104
- end
105
-
106
- end
107
- end
108
-
@@ -1,59 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/workflow'
3
- require 'rbbt/hpc/orchestrate/rules'
4
-
5
- require_relative '../hpc_test_workflows'
6
-
7
- class TestOrchestrateRules < Test::Unit::TestCase
8
-
9
- RULES = IndiferentHash.setup(YAML.load(<<-EOF))
10
- ---
11
- defaults:
12
- queue: first_queue
13
- time: 1h
14
- log: 2
15
- config_keys: key1 value1 token1
16
- chains:
17
- chain_a:
18
- workflow: TestWFA
19
- tasks: a1, a2, a3
20
- config_keys: key2 value2 token2, key3 value3 token3.1 token3.2
21
- chain_b:
22
- workflow: TestWFB
23
- tasks: b1, b2
24
- chain_b2:
25
- comment: This chain is not valid, it is missing a2
26
- tasks: TestWFA#a1, TestWFA#a3, TestWFB#b1, TestWFB#b2
27
- TestWFA:
28
- defaults:
29
- log: 4
30
- config_keys: key4 value4 token4
31
- a1:
32
- cpus: 10
33
- config_keys: key5 value5 token5
34
- TestWFC:
35
- defaults:
36
- skip: true
37
- log: 4
38
- EOF
39
-
40
- def test_defaults
41
- rules = HPC::Orchestration.task_specific_rules RULES, "TestWFA", :a1
42
- assert_equal "first_queue" , rules[:queue]
43
- end
44
-
45
-
46
- def test_task_options
47
- rules = HPC::Orchestration.task_specific_rules RULES, "TestWFA", :a1
48
- assert_equal 10, rules[:cpus]
49
- assert_equal 4, rules[:log]
50
- end
51
-
52
- def test_skip
53
- rules = HPC::Orchestration.task_specific_rules RULES, "TestWFC", :c1
54
- assert rules[:skip]
55
- end
56
-
57
-
58
- end
59
-
@@ -1,64 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/hpc/batch'
3
- require 'rbbt/workflow'
4
-
5
- require_relative 'hpc_test_workflows'
6
-
7
- class TestBatch < Test::Unit::TestCase
8
-
9
- def test_batch_options
10
- job = TestWFB.job(:b1, "TEST")
11
-
12
- TmpFile.with_file do |batch_dir|
13
-
14
- options = HPC::BATCH.batch_options(job, :batch_dir => batch_dir, :batch_modules => 'java')
15
- assert_equal options[:step_path], job.path
16
- end
17
- end
18
-
19
- def test_template
20
- job = TestWFB.job(:b1, "TEST")
21
-
22
- TmpFile.with_file do |batch_dir|
23
-
24
- template = HPC::BATCH.job_template(job, :batch_dir => batch_dir, :lua_modules => 'java')
25
- assert_include template, 'module load java'
26
- end
27
- end
28
-
29
- def test_template_singularity
30
- job = TestWFB.job(:b1, "TEST")
31
-
32
- TmpFile.with_file do |batch_dir|
33
-
34
- template = HPC::BATCH.job_template(job, :batch_dir => batch_dir, :lua_modules => 'java', :singularity => true)
35
- assert_include template, "singularity exec"
36
- end
37
- end
38
-
39
- def test_template_contain
40
- job = TestWFB.job(:b1, "TEST")
41
-
42
- TmpFile.with_file do |batch_dir|
43
-
44
- template = HPC::BATCH.job_template(job, :batch_dir => batch_dir, :lua_modules => 'java', :contain_and_sync => true, :wipe_container => 'force')
45
- assert_include template, "batch_erase_contain_dir"
46
-
47
- end
48
- end
49
-
50
- def test_template_singularity_contain
51
- job = TestWFB.job(:b1, "TEST")
52
-
53
- TmpFile.with_file do |batch_dir|
54
-
55
- template = HPC::BATCH.job_template(job, :batch_dir => batch_dir, :lua_modules => 'java', :contain_and_sync => true, :wipe_container => 'force', :singularity => true)
56
- assert_include template, "--workdir_all"
57
- assert_include template, "batch_erase_contain_dir"
58
- assert_include template, "singularity exec"
59
-
60
- end
61
- end
62
-
63
- end
64
-
File without changes