rbbt-util 5.25.4 → 5.25.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53463985df5e51f4106125b28e2a26a052bc7ad1
4
- data.tar.gz: 8215a6fdbebda4ad1b7b2277c05d5f041bd12e89
3
+ metadata.gz: e07b6ec4cc5c33daa9aa1ab26b968c7dd42b1c7d
4
+ data.tar.gz: 7a2cbbba275dac3f7981ce794468880faac8e306
5
5
  SHA512:
6
- metadata.gz: dfcef6b4df76925ae979b43e50f851b8c288ed415aa76d1348670b06529df26485902388b2a0e2d3a06e67175001f3aa9f31c752db4112cb57c8b5f3b964ff17
7
- data.tar.gz: 8c142f1a0eb354e0088e4c72ea917f5fe2237cf8a83d90a0177876e79ef10b90ad556d2a1f682b999888f78fc6bda207fc1db94f592d223077629039aaa6eb30
6
+ metadata.gz: 9a185e9f04e0be73b6d71b8d8358f4cd6c36669c7c93439e1e75876366a14b3aaf392f22be4fa0d19d363fd1256365d5e5258305e3fb9f3d1506aba862e7afc6
7
+ data.tar.gz: 02c0a3c7457da08b7445cfde0ef3e5799b69078a26a59b69f913b7c0f631647cf02e0cbb07ef821d82d193de0fd44a6a31dadda6ccbc3871e524183b78282fb3
@@ -45,6 +45,9 @@ class KnowledgeBase
45
45
  begin
46
46
  if options.empty?
47
47
  key = name.to_s
48
+ elsif options[:key]
49
+ key = options[:key]
50
+ key = name if key == :name
48
51
  else
49
52
  fp = Misc.hash2md5(options)
50
53
  key = name.to_s + "_" + fp
@@ -90,7 +93,13 @@ class KnowledgeBase
90
93
  def get_database(name, options = {})
91
94
  name = name.to_s
92
95
 
93
- options[:organism] ||= options[:namespace] ||= self.namespace unless self.namespace.nil?
96
+ options = options.dup
97
+ if self.namespace == options[:namespace]
98
+ options.delete(:namespace)
99
+ end
100
+ if self.namespace == options[:organism]
101
+ options.delete(:organism)
102
+ end
94
103
  @databases[[name, options]] ||=
95
104
  begin
96
105
  fp = Misc.fingerprint([name,options])
@@ -102,6 +111,8 @@ class KnowledgeBase
102
111
  key = name.to_s + "_" + fp
103
112
  end
104
113
 
114
+ options[:organism] ||= options[:namespace] ||= self.namespace unless self.namespace.nil?
115
+
105
116
  key += '.database'
106
117
  Persist.memory("Database:" << [key, dir] * "@") do
107
118
  options = options.dup
@@ -124,14 +135,14 @@ class KnowledgeBase
124
135
  persist_options = Misc.pull_keys options, :persist
125
136
 
126
137
  database = if persist_file.exists? and persist_options[:persist] and not persist_options[:update]
127
- Log.low "Re-opening database #{ name } from #{ Misc.fingerprint persist_file }. #{options}"
128
- Association.open(file, options, persist_options)
129
- else
130
- options = Misc.add_defaults options, registered_options if registered_options
131
- raise "Repo #{ name } not found and not registered" if file.nil?
132
- Log.medium "Opening database #{ name } from #{ Misc.fingerprint file }. #{options}"
133
- Association.open(file, options, persist_options)
134
- end
138
+ Log.low "Re-opening database #{ name } from #{ Misc.fingerprint persist_file }. #{options}"
139
+ Association.open(file, options, persist_options)
140
+ else
141
+ options = Misc.add_defaults options, registered_options if registered_options
142
+ raise "Repo #{ name } not found and not registered" if file.nil?
143
+ Log.medium "Opening database #{ name } from #{ Misc.fingerprint file }. #{options}"
144
+ Association.open(file, options, persist_options)
145
+ end
135
146
 
136
147
  database.namespace = self.namespace if self.namespace
137
148
 
@@ -640,6 +640,13 @@ class Step
640
640
  done? && info[:path] && info[:path] != path
641
641
  end
642
642
 
643
+ def knowledge_base(organism = nil)
644
+ @_kb ||= begin
645
+ kb_dir = self.file('knowledge_base')
646
+ KnowledgeBase.new kb_dir, organism
647
+ end
648
+ end
649
+
643
650
  end
644
651
 
645
652
  module Workflow
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.25.4
4
+ version: 5.25.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez