rbbt-util 5.28.8 → 5.28.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/entity.rb +1 -1
- data/lib/rbbt/fix_width_table.rb +5 -4
- data/lib/rbbt/hpc.rb +6 -4
- data/lib/rbbt/persist.rb +9 -4
- data/lib/rbbt/persist/tsv/adapter.rb +0 -1
- data/lib/rbbt/persist/tsv/fix_width_table.rb +5 -3
- data/lib/rbbt/resource.rb +12 -6
- data/lib/rbbt/resource/path.rb +1 -1
- data/lib/rbbt/tsv/attach.rb +7 -4
- data/lib/rbbt/tsv/dumper.rb +6 -2
- data/lib/rbbt/tsv/parallel.rb +0 -3
- data/lib/rbbt/util/R.rb +2 -2
- data/lib/rbbt/util/cmd.rb +10 -0
- data/lib/rbbt/util/misc/bgzf.rb +1 -1
- data/lib/rbbt/util/misc/indiferent_hash.rb +8 -0
- data/lib/rbbt/util/misc/inspect.rb +11 -7
- data/lib/rbbt/util/named_array.rb +1 -1
- data/lib/rbbt/util/open.rb +17 -16
- data/lib/rbbt/workflow/accessor.rb +1 -1
- data/lib/rbbt/workflow/definition.rb +3 -1
- data/lib/rbbt/workflow/integration/ansible.rb +53 -0
- data/lib/rbbt/workflow/integration/ansible/workflow.rb +60 -0
- data/lib/rbbt/workflow/step.rb +8 -0
- data/lib/rbbt/workflow/step/accessor.rb +23 -13
- data/lib/rbbt/workflow/step/dependencies.rb +8 -2
- data/lib/rbbt/workflow/step/run.rb +22 -19
- data/lib/rbbt/workflow/util/archive.rb +2 -0
- data/lib/rbbt/workflow/util/orchestrator.rb +49 -11
- data/lib/rbbt/workflow/util/provenance.rb +7 -3
- data/share/rbbt_commands/ansible +55 -0
- data/share/rbbt_commands/purge_job +0 -1
- data/share/rbbt_commands/system/status +22 -22
- data/share/rbbt_commands/workflow/forget_deps +9 -0
- data/share/rbbt_commands/workflow/info +12 -9
- data/share/rbbt_commands/workflow/prov +2 -1
- data/test/rbbt/association/test_index.rb +6 -6
- data/test/rbbt/knowledge_base/test_query.rb +3 -3
- data/test/rbbt/knowledge_base/test_registry.rb +1 -1
- data/test/rbbt/persist/tsv/test_cdb.rb +0 -7
- data/test/rbbt/persist/tsv/test_kyotocabinet.rb +2 -8
- data/test/rbbt/persist/tsv/test_leveldb.rb +0 -6
- data/test/rbbt/persist/tsv/test_lmdb.rb +0 -6
- data/test/rbbt/persist/tsv/test_tokyocabinet.rb +15 -14
- data/test/rbbt/test_entity.rb +0 -1
- data/test/rbbt/test_knowledge_base.rb +3 -4
- data/test/rbbt/test_persist.rb +10 -6
- data/test/rbbt/test_workflow.rb +49 -16
- data/test/rbbt/tsv/test_accessor.rb +11 -0
- data/test/rbbt/tsv/test_attach.rb +86 -8
- data/test/rbbt/tsv/test_index.rb +6 -7
- data/test/rbbt/tsv/test_manipulate.rb +2 -3
- data/test/rbbt/util/R/test_model.rb +2 -1
- data/test/rbbt/util/R/test_plot.rb +0 -2
- data/test/rbbt/util/concurrency/test_processes.rb +1 -1
- data/test/rbbt/util/misc/test_bgzf.rb +11 -7
- data/test/rbbt/util/misc/test_lock.rb +0 -1
- data/test/rbbt/util/misc/test_multipart_payload.rb +1 -1
- data/test/rbbt/util/misc/test_pipes.rb +0 -5
- data/test/rbbt/util/test_R.rb +1 -0
- data/test/rbbt/util/test_log.rb +4 -6
- data/test/rbbt/util/test_misc.rb +0 -2
- data/test/rbbt/util/test_open.rb +0 -1
- data/test/rbbt/util/test_python.rb +17 -1
- data/test/rbbt/workflow/test_remote_workflow.rb +1 -1
- data/test/rbbt/workflow/test_step.rb +8 -3
- data/test/rbbt/workflow/util/test_orchestrator.rb +155 -18
- metadata +5 -4
- data/test/rbbt/workflow/remote/test_client.rb +0 -56
@@ -66,7 +66,7 @@ class Step
|
|
66
66
|
str << "\n"
|
67
67
|
end
|
68
68
|
|
69
|
-
def self.prov_report(step, offset = 0, task = nil, seen = [])
|
69
|
+
def self.prov_report(step, offset = 0, task = nil, seen = [], expand_repeats = false)
|
70
70
|
info = step.info || {}
|
71
71
|
info[:task_name] = task
|
72
72
|
path = step.path
|
@@ -82,9 +82,13 @@ class Step
|
|
82
82
|
new = ! seen.include?(path)
|
83
83
|
if new
|
84
84
|
seen << path
|
85
|
-
str << prov_report(dep, offset + 1, task, seen)
|
85
|
+
str << prov_report(dep, offset + 1, task, seen, expand_repeats)
|
86
86
|
else
|
87
|
-
|
87
|
+
if expand_repeats
|
88
|
+
str << Log.color(:green, Log.uncolor(prov_report(dep, offset+1, task)))
|
89
|
+
else
|
90
|
+
str << Log.color(:green, " " * (offset + 1) + Log.uncolor(prov_report_msg(status, name, path, info)))
|
91
|
+
end
|
88
92
|
end
|
89
93
|
end if step.dependencies
|
90
94
|
str
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
5
|
+
|
6
|
+
$0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands
|
7
|
+
|
8
|
+
options = SOPT.setup <<EOF
|
9
|
+
|
10
|
+
Run ansible
|
11
|
+
|
12
|
+
$ #{$0} [options] <rules.yml|->
|
13
|
+
|
14
|
+
Use - to read from STDIN
|
15
|
+
|
16
|
+
-h--help Print this help
|
17
|
+
-dr--dry_run Only print the playbook
|
18
|
+
-H--hosts* hosts to run it on
|
19
|
+
EOF
|
20
|
+
if options[:help]
|
21
|
+
if defined? rbbt_usage
|
22
|
+
rbbt_usage
|
23
|
+
else
|
24
|
+
puts SOPT.doc
|
25
|
+
end
|
26
|
+
exit 0
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'rbbt/workflow/integration/ansible'
|
30
|
+
|
31
|
+
playbook, task = ARGV
|
32
|
+
playbook_file = Rbbt.share.ansible["test.yaml"].find if playbook.nil?
|
33
|
+
|
34
|
+
dry_run = options.delete :dry_run
|
35
|
+
|
36
|
+
if ! Misc.filename?(playbook_file)
|
37
|
+
playbook_file = Rbbt.share.ansible.glob(playbook + ".*").first
|
38
|
+
end
|
39
|
+
|
40
|
+
if ! Misc.filename?(playbook_file)
|
41
|
+
recipe = Rbbt.share.recipes.glob(playbook + ".*").first
|
42
|
+
playbook_file = Ansible.playbook recipe, task, options
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
if dry_run
|
47
|
+
if Hash === playbook_file
|
48
|
+
ppp playbook_file.to_yaml
|
49
|
+
else
|
50
|
+
ppp Log.color :magenta, playbook_file
|
51
|
+
ppp Open.read(playbook_file)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
Ansible.play playbook_file
|
55
|
+
end
|
@@ -49,27 +49,27 @@ def pid_msg(pid)
|
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
|
-
def status_msg(status)
|
53
|
-
color = case status.to_sym
|
54
|
-
when :error, :aborted, :missing, :dead, :broken
|
55
|
-
:red
|
56
|
-
when :streaming, :started
|
57
|
-
:cyan
|
58
|
-
when :done
|
59
|
-
:green
|
60
|
-
when :noinfo
|
61
|
-
:blue
|
62
|
-
when :dependencies, :waiting, :setup
|
63
|
-
:yellow
|
64
|
-
else
|
65
|
-
if status.to_s.index ">"
|
66
|
-
:cyan
|
67
|
-
else
|
68
|
-
:cyan
|
69
|
-
end
|
70
|
-
end
|
71
|
-
Log.color(color, status.to_s)
|
72
|
-
end
|
52
|
+
#def status_msg(status)
|
53
|
+
# color = case status.to_sym
|
54
|
+
# when :error, :aborted, :missing, :dead, :broken
|
55
|
+
# :red
|
56
|
+
# when :streaming, :started
|
57
|
+
# :cyan
|
58
|
+
# when :done
|
59
|
+
# :green
|
60
|
+
# when :noinfo, :notfound
|
61
|
+
# :blue
|
62
|
+
# when :dependencies, :waiting, :setup
|
63
|
+
# :yellow
|
64
|
+
# else
|
65
|
+
# if status.to_s.index ">"
|
66
|
+
# :cyan
|
67
|
+
# else
|
68
|
+
# :cyan
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
# Log.color(color, status.to_s)
|
72
|
+
#end
|
73
73
|
|
74
74
|
def input_msg(file, inputs)
|
75
75
|
|
@@ -218,7 +218,7 @@ workflows.sort.each do |workflow,tasks|
|
|
218
218
|
status << Log.color(:red, " (dead)")
|
219
219
|
end
|
220
220
|
end
|
221
|
-
str << " #{
|
221
|
+
str << " #{ Step.prov_status_msg status }"
|
222
222
|
str << " (dirty)" if status == 'done' && Workflow.load_step(file).dirty?
|
223
223
|
|
224
224
|
if inputs and inputs.any?
|
@@ -13,6 +13,8 @@ Make a job forget all its dependencies and archive their meta-data
|
|
13
13
|
$ #{$0} [options] <job_path>
|
14
14
|
|
15
15
|
-h--help Print this help
|
16
|
+
-p--purge Purge dependencies
|
17
|
+
-r--recursive_purge Purge dependencies recursively
|
16
18
|
|
17
19
|
EOF
|
18
20
|
if options[:help]
|
@@ -31,4 +33,11 @@ step = Workflow.load_step path
|
|
31
33
|
|
32
34
|
step.archive_deps
|
33
35
|
step.copy_files_dir
|
36
|
+
dependencies = step.dependencies
|
34
37
|
step.set_info :dependencies, []
|
38
|
+
|
39
|
+
if options[:purge]
|
40
|
+
dependencies.each do |dependency|
|
41
|
+
Step.purge(dependency.path, options[:recursive_purge])
|
42
|
+
end
|
43
|
+
end
|
@@ -17,6 +17,7 @@ $ rbbt workflow info <job-result>
|
|
17
17
|
-a--all Print all info entries
|
18
18
|
-r--recursive Print recursive input values
|
19
19
|
-o--original Print original object
|
20
|
+
-w--width* Screen width
|
20
21
|
EOF
|
21
22
|
|
22
23
|
SOPT.usage if options[:help]
|
@@ -24,6 +25,7 @@ SOPT.usage if options[:help]
|
|
24
25
|
file = ARGV.shift
|
25
26
|
all = options.delete :all
|
26
27
|
recursive = options.delete :recursive
|
28
|
+
width = (options.delete(:width) || 80).to_i
|
27
29
|
|
28
30
|
def get_step(file)
|
29
31
|
file = file.sub(/\.(info|files)/,'')
|
@@ -86,6 +88,7 @@ pid = info[:pid]
|
|
86
88
|
exception = info[:exception]
|
87
89
|
rest = info.keys - [:inputs, :dependencies, :status, :time_elapsed, :messages, :backtrace, :exception, :pid, :archived_info]
|
88
90
|
|
91
|
+
|
89
92
|
puts Log.color(:magenta, "File") << ": " << step.path
|
90
93
|
puts Log.color(:magenta, "Status") << ": " << status_msg(status) << ((step.aborted? || step.error?) && step.recoverable_error? ? " (recoverable)" : "" ) << (step.dirty? ? " (dirty)" : "")
|
91
94
|
puts Log.color(:magenta, "Pid") << ": " << pid_msg(pid, status.to_s == "done")
|
@@ -96,14 +99,14 @@ if inputs and inputs.any?
|
|
96
99
|
inputs.each do |input,value|
|
97
100
|
case value
|
98
101
|
when nil
|
99
|
-
puts Misc.format_definition_list_item(" " + input.to_s, 'nil',
|
102
|
+
puts Misc.format_definition_list_item(" " + input.to_s, 'nil', width, 20, :blue)
|
100
103
|
when Array
|
101
|
-
puts Misc.format_definition_list_item(" " + input.to_s, (value.length > 6 ? value[0..5]*"\n" << "\n" << "..." : value * "\n" ),
|
104
|
+
puts Misc.format_definition_list_item(" " + input.to_s, (value.length > 6 ? value[0..5]*"\n" << "\n" << "..." : value * "\n" ), width, 20, :blue)
|
102
105
|
when TrueClass, FalseClass
|
103
|
-
puts Misc.format_definition_list_item(" " + input.to_s, value.to_s,
|
106
|
+
puts Misc.format_definition_list_item(" " + input.to_s, value.to_s, width, 20, :blue)
|
104
107
|
else
|
105
108
|
text = value.to_s.split("\n")[0..5].compact * "\n\n"
|
106
|
-
puts Misc.format_definition_list_item(" " + input.to_s, text,
|
109
|
+
puts Misc.format_definition_list_item(" " + input.to_s, text, width, 20, :blue)
|
107
110
|
end
|
108
111
|
end
|
109
112
|
end
|
@@ -162,16 +165,16 @@ if recursive
|
|
162
165
|
inputs.each do |input,value|
|
163
166
|
case value
|
164
167
|
when nil
|
165
|
-
puts Misc.format_definition_list_item(" " << input.to_s, 'nil',
|
168
|
+
puts Misc.format_definition_list_item(" " << input.to_s, 'nil', width, 20, :blue)
|
166
169
|
when Array
|
167
|
-
puts Misc.format_definition_list_item(" " << input.to_s, (value.length > 6 ? (value[0..5])*"\n\n" << "\n\n" << "..." : value * "\n\n" ),
|
170
|
+
puts Misc.format_definition_list_item(" " << input.to_s, (value.length > 6 ? (value[0..5])*"\n\n" << "\n\n" << "..." : value * "\n\n" ), width, 20, :blue).gsub("\n\n","\n")
|
168
171
|
when TrueClass, FalseClass
|
169
|
-
puts Misc.format_definition_list_item(" " << input.to_s, value.to_s,
|
172
|
+
puts Misc.format_definition_list_item(" " << input.to_s, value.to_s, width, 20, :blue)
|
170
173
|
else
|
171
|
-
lines = value.to_s.split("\n").collect{|l| l.length >=
|
174
|
+
lines = value.to_s.split("\n").collect{|l| l.length >= width - 5 ? l[0..width - 5] + " ..." : l }
|
172
175
|
text = lines[0..5].compact * "\n\n"
|
173
176
|
text << "\n\n...\n\n" if lines.length > 6
|
174
|
-
puts Misc.format_definition_list_item(" " << input.to_s, text,
|
177
|
+
puts Misc.format_definition_list_item(" " << input.to_s, text, width, 20, :blue).gsub("\n\n","\n")
|
175
178
|
end
|
176
179
|
end
|
177
180
|
end
|
@@ -24,6 +24,7 @@ $ rbbt workflow prov <job-result>
|
|
24
24
|
-i--inputs* List of inputs to print
|
25
25
|
-if--info_fields* List of info fields to print
|
26
26
|
-t--touch Update modification times to be consistent
|
27
|
+
-e--expand_repeats Show all the dependency tree even if reapeated dependencies have already been seen before
|
27
28
|
EOF
|
28
29
|
|
29
30
|
SOPT.usage if options[:help]
|
@@ -130,6 +131,6 @@ if options[:plot]
|
|
130
131
|
end
|
131
132
|
|
132
133
|
else
|
133
|
-
puts Step.prov_report(step).strip
|
134
|
+
puts Step.prov_report(step, 0, nil, [], options[:expand_repeats]).strip
|
134
135
|
end
|
135
136
|
|
@@ -73,21 +73,21 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
73
73
|
|
74
74
|
def test_index_flat
|
75
75
|
require 'rbbt/sources/tfacts'
|
76
|
-
file =
|
76
|
+
file = TFactS.regulators
|
77
77
|
tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
|
78
78
|
assert tsv.match("TP53").length > 10
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_index_flat_to_matrix
|
82
82
|
require 'rbbt/sources/tfacts'
|
83
|
-
file =
|
83
|
+
file = TFactS.regulators
|
84
84
|
tsv = Association.index(file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true)
|
85
85
|
assert(tsv.to_matrix(false))
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_filter_no_block
|
89
89
|
require 'rbbt/sources/tfacts'
|
90
|
-
file =
|
90
|
+
file = TFactS.regulators
|
91
91
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
92
92
|
tsv.unnamed = false
|
93
93
|
matches = tsv.filter :directed?
|
@@ -96,7 +96,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
96
96
|
|
97
97
|
def test_filter_no_block_value
|
98
98
|
require 'rbbt/sources/tfacts'
|
99
|
-
file =
|
99
|
+
file = TFactS.regulators
|
100
100
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
101
101
|
tsv.unnamed = false
|
102
102
|
matches = tsv.filter :Effect, "inhibition"
|
@@ -105,7 +105,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
105
105
|
|
106
106
|
def test_filter_block_value_field
|
107
107
|
require 'rbbt/sources/tfacts'
|
108
|
-
file =
|
108
|
+
file = TFactS.regulators
|
109
109
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
110
110
|
tsv.unnamed = false
|
111
111
|
matches = tsv.filter :Effect do |value|
|
@@ -116,7 +116,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
116
116
|
|
117
117
|
def test_filter_block_no_value_field
|
118
118
|
require 'rbbt/sources/tfacts'
|
119
|
-
file =
|
119
|
+
file = TFactS.regulators
|
120
120
|
tsv = Association.index(EFFECT, EFFECT_OPTIONS.merge(:undirected => false, :source => "SG=~Associated Gene Name", :target => "TG=~Associated Gene Name"), :persist => true)
|
121
121
|
tsv.unnamed = false
|
122
122
|
matches = tsv.filter do |key,values|
|
@@ -22,7 +22,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
22
22
|
:namespace => "Hsa"
|
23
23
|
}
|
24
24
|
|
25
|
-
EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
|
25
|
+
EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
|
26
26
|
|
27
27
|
KNOWLEDGE_BASE = KnowledgeBase.new Rbbt.tmp.test.kb_foo2, "Hsa"
|
28
28
|
KNOWLEDGE_BASE.format = {"Gene" => "Ensembl Gene ID"}
|
@@ -34,11 +34,11 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
34
34
|
assert_equal 6, KNOWLEDGE_BASE.subset(:effects, :all).length
|
35
35
|
|
36
36
|
assert_equal 4, KNOWLEDGE_BASE.subset(:effects, :all).target_entity.uniq.length
|
37
|
-
assert_equal %w(Effect), KNOWLEDGE_BASE.subset(:effects, :all).info.first.keys
|
37
|
+
assert_equal %w(Effect), KNOWLEDGE_BASE.subset(:effects, :all).info.first.keys
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def _test_subset_all_persist_format
|
42
42
|
assert KNOWLEDGE_BASE.subset(:effects, :all).target_entity.reject{|e| e =~ /^ENS/}.empty?
|
43
43
|
end
|
44
44
|
|
@@ -45,7 +45,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
45
45
|
|
46
46
|
def test_index_flat
|
47
47
|
require 'rbbt/sources/tfacts'
|
48
|
-
file =
|
48
|
+
file = TFactS.regulators
|
49
49
|
KNOWLEDGE_BASE.register :tfacts, file, :type => :flat, :source => "Transcription Factor Associated Gene Name=~Associated Gene Name", :merge => true
|
50
50
|
assert KNOWLEDGE_BASE.subset(:tfacts, :source => ["TP53"], :target => :all).length > 10
|
51
51
|
end
|
@@ -4,19 +4,12 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
module TestAnnotation
|
8
|
-
extend Annotation
|
9
|
-
|
10
|
-
self.annotation :test_annotation
|
11
|
-
end
|
12
|
-
|
13
7
|
class TestPersistTSVCDB < Test::Unit::TestCase
|
14
8
|
|
15
9
|
if Persist.respond_to? :open_cbd
|
16
10
|
def test_organism
|
17
11
|
require 'rbbt/sources/organism'
|
18
12
|
TmpFile.with_file nil do |tmp_file|
|
19
|
-
file = CMD.cmd("head -n 1000000", :in => Organism.identifiers("Hsa").open, :pipe => true)
|
20
13
|
tsv = Organism.identifiers("Hsa").tsv(:key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "CDB", :persist_dir => tmp_file)
|
21
14
|
assert_equal "ENSG00000141510", tsv["TP53"]
|
22
15
|
end
|
@@ -5,15 +5,9 @@ require 'rbbt/annotations'
|
|
5
5
|
require 'rbbt/util/tmpfile'
|
6
6
|
require 'test/unit'
|
7
7
|
|
8
|
-
module TestAnnotation
|
9
|
-
extend Annotation
|
10
|
-
|
11
|
-
self.annotation :test_annotation
|
12
|
-
end
|
13
|
-
|
14
8
|
class TestPersistTSVKC < Test::Unit::TestCase
|
15
9
|
if Persist.respond_to? :open_kyotocabinet
|
16
|
-
def
|
10
|
+
def test_organism_kch
|
17
11
|
require 'rbbt/sources/organism'
|
18
12
|
TmpFile.with_file do |tmp_file|
|
19
13
|
tsv = Organism.identifiers("Hsa").tsv :key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "kch", :persist_dir => tmp_file
|
@@ -22,7 +16,7 @@ class TestPersistTSVKC < Test::Unit::TestCase
|
|
22
16
|
end
|
23
17
|
|
24
18
|
|
25
|
-
def
|
19
|
+
def test_organism_kct
|
26
20
|
require 'rbbt/sources/organism'
|
27
21
|
TmpFile.with_file do |tmp_file|
|
28
22
|
tsv = Organism.identifiers("Hsa").tsv :key_field => "Associated Gene Name", :fields => ["Ensembl Gene ID"], :type => :single, :persist => true, :persist_engine => "kct", :persist_dir => tmp_file
|
@@ -4,12 +4,6 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
module TestAnnotation
|
8
|
-
extend Annotation
|
9
|
-
|
10
|
-
self.annotation :test_annotation
|
11
|
-
end
|
12
|
-
|
13
7
|
class TestPersistTSVLevelDB < Test::Unit::TestCase
|
14
8
|
|
15
9
|
if Persist.respond_to? :open_leveldb
|
@@ -4,7 +4,8 @@ require 'rbbt/annotations'
|
|
4
4
|
require 'rbbt/util/tmpfile'
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
module TestAnnotationModule
|
8
9
|
extend Annotation
|
9
10
|
|
10
11
|
self.annotation :test_annotation
|
@@ -25,8 +26,8 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
25
26
|
entity1 = "Entity 1"
|
26
27
|
entity2 = "Entity 2"
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
30
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
30
31
|
|
31
32
|
annotations = [entity1, entity2]
|
32
33
|
|
@@ -56,9 +57,9 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
56
57
|
entity2 = "Entity 2"
|
57
58
|
entity2bis = "Entity 2"
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
61
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
62
|
+
TestAnnotationModule.setup(entity2bis, :test_annotation => "2")
|
62
63
|
|
63
64
|
annotations = [entity1, entity2, entity2bis]
|
64
65
|
|
@@ -105,8 +106,8 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
105
106
|
entity1 = "Entity 1"
|
106
107
|
entity2 = "Entity 2"
|
107
108
|
|
108
|
-
|
109
|
-
|
109
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
110
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
110
111
|
|
111
112
|
annotations = [entity1, entity2]
|
112
113
|
|
@@ -138,7 +139,7 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
138
139
|
entity2 = "Entity 2"
|
139
140
|
|
140
141
|
annotations = [entity1, entity2]
|
141
|
-
|
142
|
+
TestAnnotationModule.setup(annotations, :test_annotation => "1")
|
142
143
|
annotations.extend AnnotatedArray
|
143
144
|
|
144
145
|
persisted_annotations = Persist.persist("Test", :annotations, :annotation_repo => repo) do
|
@@ -171,11 +172,11 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
171
172
|
entity2 = "Entity 2"
|
172
173
|
|
173
174
|
annotations = [entity1, entity2]
|
174
|
-
|
175
|
+
TestAnnotationModule.setup(annotations, :test_annotation => "1")
|
175
176
|
annotations.extend AnnotatedArray
|
176
177
|
|
177
178
|
annotations_ary = [annotations]
|
178
|
-
|
179
|
+
TestAnnotationModule.setup(annotations_ary, :test_annotation => "1")
|
179
180
|
annotations_ary.extend AnnotatedArray
|
180
181
|
|
181
182
|
persisted_annotations = Persist.persist("Test", :annotations, :annotation_repo => repo) do
|
@@ -210,9 +211,9 @@ class TestPersistTSVTC < Test::Unit::TestCase
|
|
210
211
|
entity2 = "Entity 2"
|
211
212
|
entity2bis = "Entity 2"
|
212
213
|
|
213
|
-
|
214
|
-
|
215
|
-
|
214
|
+
TestAnnotationModule.setup(entity1, :test_annotation => "1")
|
215
|
+
TestAnnotationModule.setup(entity2, :test_annotation => "2")
|
216
|
+
TestAnnotationModule.setup(entity2bis, :test_annotation => "2")
|
216
217
|
|
217
218
|
annotations = [entity1, entity2, entity2bis]
|
218
219
|
|