rbbt-util 5.19.9 → 5.19.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/association/database.rb +1 -0
- data/lib/rbbt/association/util.rb +14 -1
- data/lib/rbbt/knowledge_base/registry.rb +4 -4
- data/lib/rbbt/persist.rb +2 -1
- data/share/rbbt_commands/workflow/knowledge_base +0 -1
- data/test/rbbt/tsv/test_manipulate.rb +16 -16
- data/test/rbbt/util/R/test_model.rb +0 -1
- data/test/rbbt/workflow/test_step.rb +11 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ef5af815d45af2cfaaa690e733714b5352fd2a
|
4
|
+
data.tar.gz: ba78cb831ba748606f3b75b36fc9292cd98d6ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2abbf6a68b9bb7721e924025d2f51e0174ecdee38cdb132fee51dbb0eb20449eae4e106b783e7b015e157d537e34482d7207a2d9b5871caf5c345d63f578ec28
|
7
|
+
data.tar.gz: d6b7cd2954c7f4cc5f4796c7b677beb1c82e178e430dac066d3d4db9e99d56e9b1f1fecc4440e69ed1c08dc9e00e028aaeb07ffff4f28735d4a791b65fa9b935
|
@@ -34,6 +34,7 @@ module Association
|
|
34
34
|
Log.debug("Changing source format from #{tsv.key_field} to #{source_final_format}")
|
35
35
|
|
36
36
|
identifier_files = tsv.identifier_files.dup
|
37
|
+
identifier_files = [Organism.identifiers("NAMESPACE")] if identifier_files.empty?
|
37
38
|
identifier_files.concat Entity.identifier_files(source_final_format) if defined? Entity
|
38
39
|
identifier_files.uniq!
|
39
40
|
identifier_files.collect!{|f| f.annotate(f.gsub(/\bNAMESPACE\b/, namespace))} if namespace
|
@@ -42,7 +42,7 @@ module Association
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.extract_specs(all_fields=nil, options = {})
|
45
|
-
source, source_format, target, target_format = Misc.process_options options, :source, :source_format, :target, :target_format
|
45
|
+
source, source_format, target, target_format, format = Misc.process_options options, :source, :source_format, :target, :target_format, :format
|
46
46
|
|
47
47
|
key_field, *fields = all_fields.nil? ? [nil] : all_fields
|
48
48
|
|
@@ -84,6 +84,19 @@ module Association
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
# If format is specified, then perhaps we need to change the
|
88
|
+
if target_specs[2].nil?
|
89
|
+
target_type = Entity.formats[target_specs[1] || target_specs[0]]
|
90
|
+
target_specs[2] = format[target_type.to_s] if format
|
91
|
+
target_specs[2] = nil if target_specs[2] == target_specs[0] or target_specs[2] == target_specs[1]
|
92
|
+
end
|
93
|
+
|
94
|
+
if source_specs[2].nil?
|
95
|
+
source_type = Entity.formats[source_specs[1] || source_specs[0]]
|
96
|
+
source_specs[2] = format[source_type.to_s] if format
|
97
|
+
source_specs[2] = nil if source_specs[2] == source_specs[0] or source_specs[2] == source_specs[1]
|
98
|
+
end
|
99
|
+
|
87
100
|
{:source => source_specs, :target => target_specs}
|
88
101
|
end
|
89
102
|
|
@@ -43,8 +43,8 @@ class KnowledgeBase
|
|
43
43
|
options[:organism] ||= options[:namespace] ||= self.namespace
|
44
44
|
@indices[[name, options]] ||=
|
45
45
|
begin
|
46
|
-
fp = Misc.
|
47
|
-
key = name.to_s + "_" +
|
46
|
+
fp = Misc.hash2md5(options)
|
47
|
+
key = name.to_s + "_" + fp
|
48
48
|
|
49
49
|
Persist.memory("Index:" << [key, dir] * "@") do
|
50
50
|
options = options.dup
|
@@ -67,7 +67,7 @@ class KnowledgeBase
|
|
67
67
|
|
68
68
|
index = if persist_file.exists? and persist_options[:persist] and not persist_options[:update]
|
69
69
|
Log.low "Re-opening index #{ name } from #{ Misc.fingerprint persist_file }. #{options}"
|
70
|
-
Association.index(
|
70
|
+
Association.index(file, options, persist_options.dup)
|
71
71
|
else
|
72
72
|
options = Misc.add_defaults options, registered_options if registered_options
|
73
73
|
raise "Repo #{ name } not found and not registered" if file.nil?
|
@@ -110,7 +110,7 @@ class KnowledgeBase
|
|
110
110
|
|
111
111
|
database = if persist_file.exists? and persist_options[:persist] and not persist_options[:update]
|
112
112
|
Log.low "Re-opening database #{ name } from #{ Misc.fingerprint persist_file }. #{options}"
|
113
|
-
Association.open(
|
113
|
+
Association.open(file, options, persist_options)
|
114
114
|
else
|
115
115
|
options = Misc.add_defaults options, registered_options if registered_options
|
116
116
|
raise "Repo #{ name } not found and not registered" if file.nil?
|
data/lib/rbbt/persist.rb
CHANGED
@@ -13,7 +13,6 @@ $ rbbt workflow knowledge_base <workflow> [<database>] [<action>] [<options>]
|
|
13
13
|
Access workflow knowledge base
|
14
14
|
|
15
15
|
-h--help Show this help:
|
16
|
-
-cl--clean Clean the last step of the job so that it gets recomputed:
|
17
16
|
-s--source_entities* Source entities
|
18
17
|
-sf--source_format* Source format
|
19
18
|
-t--target_entities* Target entities
|
@@ -20,7 +20,7 @@ rowa a|aa b|BB C|CC
|
|
20
20
|
end
|
21
21
|
|
22
22
|
|
23
|
-
def
|
23
|
+
def test_through
|
24
24
|
content =<<-EOF
|
25
25
|
#Id ValueA ValueB OtherID
|
26
26
|
row1 a|aa|aaa b Id1|Id2
|
@@ -39,7 +39,7 @@ row3 a C Id4
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def test_reorder_simple
|
43
43
|
content =<<-EOF
|
44
44
|
#Id ValueA ValueB OtherID
|
45
45
|
row1 a|aa|aaa b Id1|Id2
|
@@ -61,7 +61,7 @@ row3 a C Id4
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
64
|
+
def test_reorder_remove_field
|
65
65
|
content =<<-EOF
|
66
66
|
#Id ValueA ValueB OtherID
|
67
67
|
row1 a|aa|aaa b Id1|Id2
|
@@ -83,7 +83,7 @@ row3 a C Id4
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def
|
86
|
+
def test_slice
|
87
87
|
content =<<-EOF
|
88
88
|
#ID ValueA ValueB Comment
|
89
89
|
row1 a b c
|
@@ -96,7 +96,7 @@ row2 A B C
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
99
|
+
def test_select
|
100
100
|
content =<<-EOF
|
101
101
|
#Id ValueA ValueB OtherID
|
102
102
|
row1 a|aa|aaa b Id1|Id2
|
@@ -134,7 +134,7 @@ row3 a C Id4
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
def
|
137
|
+
def test_select_invert
|
138
138
|
content =<<-EOF
|
139
139
|
#Id ValueA ValueB OtherID
|
140
140
|
row1 a|aa|aaa b Id1|Id2
|
@@ -165,7 +165,7 @@ row3 a C Id4
|
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
-
def
|
168
|
+
def test_process
|
169
169
|
content =<<-EOF
|
170
170
|
#Id ValueA ValueB OtherID
|
171
171
|
row1 a|aa|aaa b Id1|Id2
|
@@ -184,7 +184,7 @@ row3 a C Id4
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
def
|
187
|
+
def test_add_field
|
188
188
|
content =<<-EOF
|
189
189
|
#Id LetterValue:ValueA LetterValue:ValueB OtherID
|
190
190
|
row1 a|aa|aaa b Id1|Id2
|
@@ -202,7 +202,7 @@ row3 a C Id4
|
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
def
|
205
|
+
def test_add_field_double_with_list_result
|
206
206
|
content =<<-EOF
|
207
207
|
#Id LetterValue:ValueA LetterValue:ValueB OtherID
|
208
208
|
row1 a|aa|aaa b Id1|Id2
|
@@ -221,7 +221,7 @@ row3 a C Id4
|
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
|
-
def
|
224
|
+
def test_through_headless
|
225
225
|
content =<<-EOF
|
226
226
|
row1 a|aa|aaa b Id1|Id2
|
227
227
|
row2 A B Id3
|
@@ -231,17 +231,17 @@ row3 a C Id4
|
|
231
231
|
TmpFile.with_file(content) do |filename|
|
232
232
|
tsv = TSV.open(filename, :sep => /\s+/)
|
233
233
|
|
234
|
-
|
234
|
+
test = false
|
235
235
|
tsv.through do
|
236
|
-
|
236
|
+
test = true
|
237
237
|
end
|
238
|
-
assert
|
238
|
+
assert test
|
239
239
|
|
240
240
|
end
|
241
241
|
|
242
242
|
end
|
243
243
|
|
244
|
-
def
|
244
|
+
def test_reorder_flat
|
245
245
|
content =<<-EOF
|
246
246
|
#Id ValueA
|
247
247
|
row1 a aa aaa
|
@@ -257,7 +257,7 @@ row3 a
|
|
257
257
|
end
|
258
258
|
end
|
259
259
|
|
260
|
-
def
|
260
|
+
def test_transpose
|
261
261
|
content =<<-EOF
|
262
262
|
#: :type=:list
|
263
263
|
#Row vA vB vID
|
@@ -275,7 +275,7 @@ row3 a C Id4
|
|
275
275
|
|
276
276
|
end
|
277
277
|
|
278
|
-
def
|
278
|
+
def test_through_flat
|
279
279
|
content =<<-EOF
|
280
280
|
#: :type=:flat
|
281
281
|
#Row vA
|
@@ -141,9 +141,10 @@ class TestStep < Test::Unit::TestCase
|
|
141
141
|
end
|
142
142
|
TmpFile.with_file do |tmp|
|
143
143
|
step = Step.new tmp, task
|
144
|
-
job = step.fork
|
145
|
-
while not job.done? do sleep 1 end
|
146
|
-
|
144
|
+
#job = step.fork
|
145
|
+
#while not job.done? do sleep 1 end
|
146
|
+
step.run
|
147
|
+
assert_equal "TEST", Open.read(step.file("test"))
|
147
148
|
end
|
148
149
|
end
|
149
150
|
end
|
@@ -153,6 +154,8 @@ class TestStep < Test::Unit::TestCase
|
|
153
154
|
task = Task.setup do
|
154
155
|
message "WRITE"
|
155
156
|
Open.write(file("test"),"TEST")
|
157
|
+
Open.write(path,"done")
|
158
|
+
nil
|
156
159
|
end
|
157
160
|
|
158
161
|
TmpFile.with_file do |tmp|
|
@@ -175,10 +178,11 @@ class TestStep < Test::Unit::TestCase
|
|
175
178
|
|
176
179
|
TmpFile.with_file do |tmp|
|
177
180
|
step = Step.new File.join(tmp, 'subdir1', 'subdir2'), task
|
178
|
-
job = step.fork
|
179
|
-
while not job.done? do sleep 1 end
|
180
|
-
|
181
|
-
|
181
|
+
#job = step.fork
|
182
|
+
#while not job.done? do sleep 1 end
|
183
|
+
step.run
|
184
|
+
assert_equal "TEST", Open.read(step.file("test"))
|
185
|
+
assert step.messages.include? "WRITE"
|
182
186
|
end
|
183
187
|
end
|
184
188
|
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.19.
|
4
|
+
version: 5.19.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|