rbbt-util 5.5.12 → 5.5.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Zjg3YjYwNzBjODk3NmYzYTQ4MTI2NDRkZGYyNmUzMGMzNWZjOGVkMA==
4
+ NWZjMjY1ZjljYmM0MzZmNTBiN2E0OTU1Zjk4NGU0NDFmM2M3YjFkNw==
5
5
  data.tar.gz: !binary |-
6
- MmExODdlZjVkYWZkN2E0M2YyYzc4NjA0MGU2YjA1ZjhhYzY2MjE0ZQ==
6
+ MDM1YmM4NTVlMTE5YWE2NDY2NzU0MTI4YjEwM2FkN2I4MTJjNDc5Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTllODgwMzFhZDFmYzJjMWNjZWZjMmQ3MTBjNDdhZjJkY2FiNTliM2IxYjQ4
10
- YjQ4ZjNmODg5M2ZiMjBhOTMzY2EwN2IyY2M3ZTRjNTkzOWZlMzc2MDhlZDI3
11
- Mjk2MzJlYWY0MTRjZDgwOTY1YjgwMWExNThiZTk2YjlhMmI1ODg=
9
+ MWMwMjg5M2EwZTUxZDBiNDI2MTZhNGNlZDU2NTYxNzAzMDJlYWYzZTIwYzU3
10
+ MDcyMWYyZmMwNmE2ZTQwZTdjMDcxNjU1NzkwYjZmZDFkNGQ3NTBmYzFkZjVl
11
+ YTBmZmVmODJiMGU5YjNhNTNmZmY0ZGM2NjQ3NGQ5ZWViMjBiNDc=
12
12
  data.tar.gz: !binary |-
13
- YzdmZWU4YjMxN2M2ZTJkNTNjNTBlYzZhYTZmZTI5MWM1N2ZlNTMyMWQ3MTZl
14
- YzdlNDFjMmNiZjI1ZThhMzNhYTMzY2RmZjY5NWU2ZjQ5ZGU2ZDZmMGRhNWI0
15
- ZTcxY2MzNWVhZTBkMTI2ZTllNjkyMGQxYzI4MjUwYmFhZDk5OWE=
13
+ MGQ4Nzk0ZGViYmU2MTViMDY4NGEyZDgxODk4YzlmNzhkOWNmODNhZWVkMTE2
14
+ ZWFhNTcwNTlmNzYwNzliMjkzYjE5NmY3NmM0NGMwNWUwMzRkNWZkY2M4MWNl
15
+ YmQ4MTkxNWZjMGE1ZDUzYjI5Y2Y2YmYzYWY4ZGIxNjk4ZGZkMTM=
@@ -20,6 +20,7 @@ module Association
20
20
  if File.exists?(reverse_filename)
21
21
  new = Persist.open_tokyocabinet(reverse_filename, false, serializer, TokyoCabinet::BDB)
22
22
  else
23
+ FileUtils.mkdir_p File.basename(reverse_filename) unless File.exists?(File.basename(reverse_filename))
23
24
  new = Persist.open_tokyocabinet(reverse_filename, true, serializer, TokyoCabinet::BDB)
24
25
  new.write
25
26
  through do |key, value|
@@ -28,7 +29,7 @@ module Association
28
29
  end
29
30
  annotate(new)
30
31
  new.key_field = key_field.split("~").values_at(1,0,2).compact * "~"
31
- new.close
32
+ new.read
32
33
  end
33
34
 
34
35
  new.unnamed = true
@@ -21,7 +21,7 @@ module AssociationItem
21
21
 
22
22
  property :target_entity => :array2single do
23
23
  type = reverse ? knowledge_base.source(database) : knowledge_base.target(database)
24
- knowledge_base.annotate self.target, type if self.target.any?
24
+ knowledge_base.annotate self.target, type, database if self.target.any?
25
25
  end
26
26
 
27
27
  property :source_entity => :array2single do
@@ -17,7 +17,7 @@ class KnowledgeBase
17
17
 
18
18
  attr_accessor :namespace, :dir, :indices, :registry, :format, :databases, :entity_options
19
19
  def initialize(dir, namespace = nil)
20
- @dir = Path.setup dir
20
+ @dir = Path.setup(dir).find
21
21
 
22
22
  @namespace = namespace
23
23
  @format = IndiferentHash.setup({})
@@ -179,15 +179,18 @@ class KnowledgeBase
179
179
 
180
180
  #{{{ Annotate
181
181
 
182
- def entity_options_for(type)
182
+ def entity_options_for(type, database_name = nil)
183
183
  options = entity_options[Entity.formats[type]] || {}
184
184
  options[:format] = @format[type] if @format.include? :type
185
185
  options = {:organism => namespace}.merge(options)
186
+ if database_name and (database = get_database(database_name)).entity_options
187
+ options = options.merge database.entity_options
188
+ end
186
189
  options
187
190
  end
188
191
 
189
- def annotate(entities, type)
190
- Misc.prepare_entity(entities, type, entity_options_for(type))
192
+ def annotate(entities, type, database = nil)
193
+ Misc.prepare_entity(entities, type, entity_options_for(type, database))
191
194
  end
192
195
 
193
196
  #{{{ Identify
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.5.12
4
+ version: 5.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-03 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake