rbbt-util 5.19.9 → 5.19.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f225a36ad80052aa37d0afe96a946a12144f38a8
4
- data.tar.gz: 948a27e4e5063aa205ff63017423494b6d5cec7e
3
+ metadata.gz: a2ef5af815d45af2cfaaa690e733714b5352fd2a
4
+ data.tar.gz: ba78cb831ba748606f3b75b36fc9292cd98d6ddb
5
5
  SHA512:
6
- metadata.gz: fc12ab569e13c6071af67eea02801d6af983739124bb98e8dbddeab605c43d8bea96741b40cb49c5a47504594599de79a67c6834c9b0f14eff5cb71f7e90a80e
7
- data.tar.gz: 42cacda94789f436a2bd873df1da7f569feb8d7921e05db43207ec0e31322ab2ce0d5fe635dd4481d75d45bb042ee7be1aa7a41d7ee6932f31dd843335668887
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.fingerprint([name,options])
47
- key = name.to_s + "_" + Misc.digest(fp)
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(nil, options, persist_options.dup)
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(nil, options, persist_options)
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
@@ -431,7 +431,8 @@ module Persist
431
431
  end
432
432
 
433
433
  else
434
- persist_file(path.find, type, persist_options, &block)
434
+ path = path.find if Path === path
435
+ persist_file(path, type, persist_options, &block)
435
436
  end
436
437
 
437
438
  end
@@ -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 _test_through
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 _test_reorder_simple
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 _test_reorder_remove_field
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 _test_slice
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 _test_select
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 _test_select_invert
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 _test_process
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 _test_add_field
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 _test_add_field_double_with_list_result
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 _test_through_headless
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
- _test = false
234
+ test = false
235
235
  tsv.through do
236
- _test = true
236
+ test = true
237
237
  end
238
- assert _test
238
+ assert test
239
239
 
240
240
  end
241
241
 
242
242
  end
243
243
 
244
- def _test_reorder_flat
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 _test_transpose
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 _test_through_flat
278
+ def test_through_flat
279
279
  content =<<-EOF
280
280
  #: :type=:flat
281
281
  #Row vA
@@ -124,7 +124,6 @@ data = rbbt.model.inpute(data, CI ~ Dose, method=drm, classes='numeric', fct=LL.
124
124
  y = 10 + 3 * x
125
125
 
126
126
  pred = model.predict x
127
- iii model.predict_interval(x)
128
127
  assert pred > y and pred < y + 4
129
128
  end
130
129
  end
@@ -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
- assert_equal "TEST", Open.read(job.file("test"))
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
- assert_equal "TEST", Open.read(job.file("test"))
181
- assert job.messages.include? "WRITE"
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.9
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: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake