rbbt-util 5.27.1 → 5.27.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/annotations/util.rb +1 -2
- data/lib/rbbt/entity.rb +8 -5
- data/lib/rbbt/fix_width_table.rb +6 -5
- data/lib/rbbt/knowledge_base/entity.rb +3 -2
- data/lib/rbbt/knowledge_base/query.rb +9 -0
- data/lib/rbbt/persist.rb +2 -3
- data/lib/rbbt/persist/tsv.rb +5 -5
- data/lib/rbbt/persist/tsv/adapter.rb +136 -43
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +5 -3
- data/lib/rbbt/resource.rb +8 -5
- data/lib/rbbt/resource/path.rb +3 -3
- data/lib/rbbt/tsv/accessor.rb +6 -6
- data/lib/rbbt/tsv/change_id.rb +3 -1
- data/lib/rbbt/tsv/parallel/traverse.rb +1 -1
- data/lib/rbbt/tsv/util.rb +1 -0
- data/lib/rbbt/util/misc/exceptions.rb +8 -0
- data/lib/rbbt/workflow.rb +1 -1
- data/lib/rbbt/workflow/accessor.rb +3 -1
- data/lib/rbbt/workflow/definition.rb +6 -0
- data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +9 -3
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +9 -3
- data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +7 -1
- data/lib/rbbt/workflow/step/accessor.rb +4 -0
- data/lib/rbbt/workflow/step/dependencies.rb +10 -6
- data/lib/rbbt/workflow/step/run.rb +2 -2
- data/lib/rbbt/workflow/task.rb +1 -1
- data/lib/rbbt/workflow/usage.rb +25 -8
- data/lib/rbbt/workflow/util/archive.rb +30 -4
- data/share/install/software/lib/install_helpers +9 -3
- data/share/rbbt_commands/migrate_job +3 -1
- data/share/rbbt_commands/system/status +3 -2
- data/share/rbbt_commands/tsv/get +33 -7
- data/share/rbbt_commands/workflow/monitor +3 -3
- data/share/rbbt_commands/workflow/task +1 -1
- data/test/rbbt/knowledge_base/test_query.rb +1 -1
- data/test/rbbt/test_entity.rb +14 -5
- data/test/rbbt/test_knowledge_base.rb +3 -3
- data/test/rbbt/workflow/step/test_dependencies.rb +40 -8
- data/test/rbbt/workflow/test_remote_workflow.rb +13 -1
- metadata +2 -2
@@ -71,7 +71,7 @@ get_pkg(){
|
|
71
71
|
local url="$2"
|
72
72
|
|
73
73
|
if [ ! -f "$OPT_SRC_DIR/$name.pkg" ]; then
|
74
|
-
|
74
|
+
wget "$url" -O "$OPT_SRC_DIR/$name.pkg" || wget "$url" -O "$OPT_SRC_DIR/$name.pkg" --no-check-certificate || (rm -f "$OPT_SRC_DIR/$name.pkg"; echo "Error downloading"; exit -1)
|
75
75
|
fi
|
76
76
|
}
|
77
77
|
|
@@ -85,7 +85,7 @@ uncompress_pkg(){
|
|
85
85
|
mkdir -p "$OPT_BUILD_DIR"
|
86
86
|
cd "$OPT_BUILD_DIR"
|
87
87
|
|
88
|
-
(tar xvfz $pkg || tar xvfJ $pkg || tar xvfj $pkg || unzip $pkg || echo "Error decompressing") 2> /dev/null
|
88
|
+
(tar xvfz $pkg || tar xvfJ $pkg || tar xvfj $pkg || unzip $pkg || (echo "Error decompressing" & cd & rmdir "$OPT_BUILD_DIR" & exit -1 ) ) 2> /dev/null
|
89
89
|
|
90
90
|
cd "$old_pwd"
|
91
91
|
}
|
@@ -203,8 +203,12 @@ prepare_make(){
|
|
203
203
|
local old_pwd="`expand_path $(pwd)`"
|
204
204
|
cd "`build_dir`"
|
205
205
|
|
206
|
+
[ -f bootstrap ] && (./bootstrap || exit -1)
|
207
|
+
|
206
208
|
[ -d src -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd src
|
207
209
|
|
210
|
+
[ -f bootstrap ] && (./bootstrap || exit -1)
|
211
|
+
|
208
212
|
if [ -f config/m4 ]; then
|
209
213
|
libtoolize --force
|
210
214
|
aclocal
|
@@ -273,6 +277,8 @@ build_make(){
|
|
273
277
|
setup "$name"
|
274
278
|
clean_build
|
275
279
|
fi
|
280
|
+
|
281
|
+
cd "$old_pwd"
|
276
282
|
}
|
277
283
|
|
278
284
|
buid_cmake(){
|
@@ -487,7 +493,7 @@ install_jar(){
|
|
487
493
|
local url="$2"
|
488
494
|
|
489
495
|
[ -d "$OPT_DIR/$name/" ] || mkdir -p "$OPT_DIR/$name/"
|
490
|
-
wget "$url" -O "$OPT_DIR/$name/$name.jar" --no-check-certificate
|
496
|
+
wget "$url" -O "$OPT_DIR/jars/$name.jar" || wget "$url" -O "$OPT_DIR/jars/$name.jar" --no-check-certificate || (rm "$OPT_DIR/jars/$name.jar"; exit -1)
|
491
497
|
link "$OPT_DIR/$name/$name.jar" "$OPT_JAR_DIR/$name.jar"
|
492
498
|
}
|
493
499
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'rbbt-util'
|
4
4
|
require 'rbbt/util/simpleopt'
|
5
5
|
require 'rbbt/workflow'
|
6
|
-
require 'rbbt/workflow/
|
6
|
+
require 'rbbt/workflow/remote_workflow'
|
7
7
|
|
8
8
|
$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
|
9
9
|
|
@@ -34,4 +34,6 @@ end
|
|
34
34
|
|
35
35
|
path, search_path, _sep, *other = ARGV
|
36
36
|
|
37
|
+
search_path = 'user' if search_path.nil?
|
38
|
+
|
37
39
|
Step.migrate(path, search_path, options)
|
@@ -187,7 +187,7 @@ workflows.sort.each do |workflow,tasks|
|
|
187
187
|
if info_fields and info_fields.any?
|
188
188
|
info = begin
|
189
189
|
Open.open(i[:info_file]) do |f|
|
190
|
-
Step::
|
190
|
+
Step::INFO_SERIALIZER.load(f)
|
191
191
|
end
|
192
192
|
rescue
|
193
193
|
{:status => :noinfo}
|
@@ -198,9 +198,10 @@ workflows.sort.each do |workflow,tasks|
|
|
198
198
|
else
|
199
199
|
info = begin
|
200
200
|
Open.open(i[:info_file]) do |f|
|
201
|
-
Step::
|
201
|
+
Step::INFO_SERIALIZER.load(f)
|
202
202
|
end
|
203
203
|
rescue
|
204
|
+
Log.exception $!
|
204
205
|
{:status => :noinfo}
|
205
206
|
end
|
206
207
|
IndiferentHash.setup(info)
|
data/share/rbbt_commands/tsv/get
CHANGED
@@ -47,6 +47,28 @@ fields = options[:fields]
|
|
47
47
|
key_field = options[:key_field]
|
48
48
|
fields = fields.split(/[,|]/, -1) unless fields.nil?
|
49
49
|
|
50
|
+
if TSV === tsv
|
51
|
+
v = tsv[key]
|
52
|
+
fields ||= tsv.fields
|
53
|
+
puts Log.color(:blue, "Key: #{ key }")
|
54
|
+
if fields
|
55
|
+
if fields.length == 1
|
56
|
+
if options[:lines]
|
57
|
+
puts (Array === v ? v.flatten*"\n" : v.to_s )
|
58
|
+
else
|
59
|
+
puts (Array === v ? v.flatten*"\t" : v.to_s )
|
60
|
+
end
|
61
|
+
else
|
62
|
+
fields.zip(v).each do |field,v|
|
63
|
+
puts "#{Log.color :magenta, field+":"} #{v}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
else
|
67
|
+
puts "#{Log.color :magenta, "value:"} #{v}"
|
68
|
+
end
|
69
|
+
exit
|
70
|
+
end
|
71
|
+
|
50
72
|
parser = TSV::Parser.new tsv, :key_field => key_field, :fields => fields, :type => options[:type], :header_hash => options[:header_hash], :sep => options[:sep]
|
51
73
|
fields ||= parser.fields
|
52
74
|
|
@@ -54,15 +76,19 @@ TSV.traverse(parser) do |k,v|
|
|
54
76
|
next unless k.include? key
|
55
77
|
k = k.first if Array === k
|
56
78
|
puts Log.color(:blue, "Key: #{ k }")
|
57
|
-
if fields
|
58
|
-
if
|
59
|
-
|
79
|
+
if fields
|
80
|
+
if fields.length == 1
|
81
|
+
if options[:lines]
|
82
|
+
puts (Array === v ? v.flatten*"\n" : v.to_s )
|
83
|
+
else
|
84
|
+
puts (Array === v ? v.flatten*"\t" : v.to_s )
|
85
|
+
end
|
60
86
|
else
|
61
|
-
|
87
|
+
fields.zip(v).each do |field,v|
|
88
|
+
puts "#{Log.color :magenta, field+":"} #{v}"
|
89
|
+
end
|
62
90
|
end
|
63
91
|
else
|
64
|
-
|
65
|
-
puts "#{Log.color :magenta, field+":"} #{v}"
|
66
|
-
end
|
92
|
+
puts "#{Log.color :magenta, "value:"} #{Misc.fingerprint v}"
|
67
93
|
end
|
68
94
|
end
|
@@ -41,7 +41,7 @@ def list_jobs(options)
|
|
41
41
|
clean_file = file.sub('.info','')
|
42
42
|
begin
|
43
43
|
next if File.exist? clean_file and $quick
|
44
|
-
info = Step::
|
44
|
+
info = Step::INFO_SERIALIZER.load(Open.read(file, :mode => 'rb'))
|
45
45
|
next if (File.exist?(clean_file) or info[:status] == :done) and (info[:children_pids].nil? or info[:children_done] or info[:children_pids].select{|pid| Misc.pid_exists? pid}.empty?)
|
46
46
|
rescue Exception
|
47
47
|
puts "Error parsing info file: #{ file }"
|
@@ -86,7 +86,7 @@ def clean_jobs(options)
|
|
86
86
|
info = nil
|
87
87
|
next if File.exist? clean_file
|
88
88
|
begin
|
89
|
-
info = Step::
|
89
|
+
info = Step::INFO_SERIALIZER.load(Open.read(file, :mode => 'rb'))
|
90
90
|
rescue Exception
|
91
91
|
Log.debug "Error process #{ file }"
|
92
92
|
remove_job file if options[:errors]
|
@@ -117,7 +117,7 @@ begin
|
|
117
117
|
end
|
118
118
|
else
|
119
119
|
if options[:file]
|
120
|
-
info = Step::
|
120
|
+
info = Step::INFO_SERIALIZER.load(Open.read(options[:file], :mode => 'rb'))
|
121
121
|
print_job options[:file], info
|
122
122
|
else
|
123
123
|
list_jobs options
|
@@ -24,7 +24,7 @@ TP53 NFKB1|GLI1 activation|activation true|true
|
|
24
24
|
|
25
25
|
EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup
|
26
26
|
|
27
|
-
KNOWLEDGE_BASE = KnowledgeBase.new
|
27
|
+
KNOWLEDGE_BASE = KnowledgeBase.new Rbbt.tmp.test.kb_foo2, "Hsa"
|
28
28
|
KNOWLEDGE_BASE.format = {"Gene" => "Ensembl Gene ID"}
|
29
29
|
|
30
30
|
KNOWLEDGE_BASE.register :effects, EFFECT_TSV, EFFECT_OPTIONS.dup
|
data/test/rbbt/test_entity.rb
CHANGED
@@ -71,7 +71,9 @@ module ReversableString
|
|
71
71
|
}
|
72
72
|
end
|
73
73
|
end
|
74
|
+
|
74
75
|
persist :multiple_annotation_list, :annotations, :dir => TmpFile.tmp_file
|
76
|
+
#persist :multiple_annotation_list, :annotations, :dir => Rbbt.tmp.test.annots
|
75
77
|
end
|
76
78
|
|
77
79
|
class TestEntity < Test::Unit::TestCase
|
@@ -195,33 +197,40 @@ class TestEntity < Test::Unit::TestCase
|
|
195
197
|
string3 = 'AAABBBCCC_3'
|
196
198
|
string4 = 'AAABBBCCC_4'
|
197
199
|
|
200
|
+
|
201
|
+
$processed_multiple = []
|
202
|
+
Log.severity = 0
|
203
|
+
|
198
204
|
array = ReversableString.setup([string1, string2])
|
199
205
|
assert_equal [string1, string2].collect{|s| s.chars}, array.multiple_annotation_list
|
200
|
-
|
201
206
|
assert_equal string1.length, array[0].multiple_annotation_list.length
|
202
207
|
assert_equal $processed_multiple, [string1, string2]
|
203
208
|
|
204
209
|
array = ReversableString.setup([string2, string3])
|
205
|
-
assert_equal string2.
|
210
|
+
assert_equal [string2, string3].collect{|s| s.chars}, array.multiple_annotation_list
|
211
|
+
assert_equal string3, array.multiple_annotation_list.last * ""
|
206
212
|
assert_equal $processed_multiple, [string1, string2, string3]
|
207
213
|
|
214
|
+
$processed_multiple = []
|
208
215
|
array = ReversableString.setup([string2, string3])
|
216
|
+
assert_equal [string2, string3].collect{|s| s.chars}, array.multiple_annotation_list
|
209
217
|
assert_equal string2.length, array[0].multiple_annotation_list.length
|
210
|
-
assert_equal $processed_multiple, [
|
218
|
+
assert_equal $processed_multiple, []
|
211
219
|
|
212
220
|
$processed_multiple = []
|
213
221
|
array = ReversableString.setup([string2, string3, string4])
|
214
|
-
assert_equal string2.length, array[0].
|
222
|
+
assert_equal string2.length, array.multiple_annotation_list[0].length
|
215
223
|
assert_equal $processed_multiple, [string4]
|
216
224
|
|
217
225
|
string1 = 'aaabbbccc'
|
218
226
|
string2 = 'AAABBBCCC'
|
219
227
|
string3 = 'AAABBBCCC_3'
|
220
228
|
string4 = 'AAABBBCCC_4'
|
229
|
+
|
221
230
|
$processed_multiple = []
|
222
231
|
array = ReversableString.setup([string2, string3, string4])
|
223
232
|
assert_equal string2.length, array[0].multiple_annotation_list.length
|
224
|
-
assert_equal $processed_multiple, [
|
233
|
+
assert_equal $processed_multiple, []
|
225
234
|
|
226
235
|
end
|
227
236
|
|
@@ -92,9 +92,9 @@ class TestKnowledgeBase < Test::Unit::TestCase
|
|
92
92
|
assert downstream.length < downstream.follow(kb, :tfacts,false).flatten.length
|
93
93
|
|
94
94
|
Misc.benchmark(50) do
|
95
|
-
downstream.follow(kb, :tfacts,false)
|
96
|
-
downstream.backtrack(kb, :tfacts,false)
|
97
|
-
downstream.expand(kb, :tfacts,false)
|
95
|
+
downstream.follow(kb, :tfacts, false)
|
96
|
+
downstream.backtrack(kb, :tfacts, false)
|
97
|
+
downstream.expand(kb, :tfacts, false)
|
98
98
|
end
|
99
99
|
|
100
100
|
Misc.benchmark(50) do
|
@@ -40,8 +40,8 @@ module DepWorkflow
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
dep :task2
|
44
43
|
dep :task5
|
44
|
+
dep :task2
|
45
45
|
task :task6 => :array do
|
46
46
|
s1 = TSV.get_stream step(:task2)
|
47
47
|
s2 = TSV.get_stream step(:task5)
|
@@ -81,6 +81,26 @@ module ComputeWorkflow
|
|
81
81
|
|
82
82
|
end
|
83
83
|
|
84
|
+
module ResumeWorkflow
|
85
|
+
extend Workflow
|
86
|
+
|
87
|
+
resumable
|
88
|
+
task :resume => :string do
|
89
|
+
if file('foo').exists?
|
90
|
+
'done'
|
91
|
+
else
|
92
|
+
Open.mkdir files_dir
|
93
|
+
Open.touch(file('foo'))
|
94
|
+
raise
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
dep :resume
|
99
|
+
task :reverse => :string do
|
100
|
+
step(:resume).load.reverse
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
84
104
|
class TestWorkflowDependency < Test::Unit::TestCase
|
85
105
|
def test_task1
|
86
106
|
size = 10000
|
@@ -152,13 +172,14 @@ class TestWorkflowDependency < Test::Unit::TestCase
|
|
152
172
|
Log.severity = 0
|
153
173
|
TmpFile.with_file(content) do |input_file|
|
154
174
|
begin
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
175
|
+
job = DepWorkflow.job(:task6, "TEST", :input_file => input_file)
|
176
|
+
job.recursive_clean
|
177
|
+
job.run(:stream)
|
178
|
+
io = TSV.get_stream job
|
179
|
+
while line = io.gets
|
180
|
+
last_line = line.strip
|
181
|
+
end
|
182
|
+
io.join
|
162
183
|
rescue Exception
|
163
184
|
job.abort
|
164
185
|
raise $!
|
@@ -204,5 +225,16 @@ class TestWorkflowDependency < Test::Unit::TestCase
|
|
204
225
|
assert_equal "Line #{size}\tTask1\tTask2", last_line
|
205
226
|
end
|
206
227
|
end
|
228
|
+
|
229
|
+
def test_resume
|
230
|
+
Log.severity = 0
|
231
|
+
job = ResumeWorkflow.job(:reverse)
|
232
|
+
job.recursive_clean
|
233
|
+
assert_raise do
|
234
|
+
job.run
|
235
|
+
end
|
236
|
+
assert job.dependencies.first.file('foo').exists?
|
237
|
+
assert_equal 'done'.reverse, job.run
|
238
|
+
end
|
207
239
|
end
|
208
240
|
|
@@ -61,6 +61,18 @@ class TestRemoteWorkflow < Test::Unit::TestCase
|
|
61
61
|
def test_rest
|
62
62
|
Log.with_severity 0 do
|
63
63
|
|
64
|
+
remote_workflow_server(TestWFRest) do |client|
|
65
|
+
job = client.job(:hi, nil, {})
|
66
|
+
job.clean
|
67
|
+
job = client.job(:hi, nil, {})
|
68
|
+
assert ! job.done?
|
69
|
+
job.run
|
70
|
+
job.produce
|
71
|
+
job = client.job(:hi, nil, {})
|
72
|
+
assert job.done?
|
73
|
+
sleep 1
|
74
|
+
end
|
75
|
+
|
64
76
|
remote_workflow_server(TestWFRest) do |client|
|
65
77
|
assert_equal "Hello World", client.job(:hi, nil, {}).run.chomp
|
66
78
|
assert_equal "Hello Miguel", client.job(:hi, nil, {:name => :Miguel}).run.chomp
|
@@ -78,7 +90,7 @@ class TestRemoteWorkflow < Test::Unit::TestCase
|
|
78
90
|
|
79
91
|
def _test_ssh
|
80
92
|
Log.severity = 0
|
81
|
-
client = RemoteWorkflow.new "ssh
|
93
|
+
client = RemoteWorkflow.new "ssh://#{ENV["HOSTNAME"]}:Translation", "Translation"
|
82
94
|
job = client.job("translate", "SSH-TEST-1", :genes => ["TP53","KRAS"])
|
83
95
|
assert_equal 2, job.run.select{|l| l =~ /ENSG/}.length
|
84
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.27.
|
4
|
+
version: 5.27.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|