rbbt-util 5.21.68 → 5.21.69
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/association/database.rb +40 -26
- data/lib/rbbt/association/index.rb +2 -2
- data/lib/rbbt/association/open.rb +2 -2
- data/lib/rbbt/association/util.rb +1 -1
- data/lib/rbbt/tsv/serializers.rb +5 -1
- 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: 399599687a33ccd54d3e3072a1293d167e39af90
|
4
|
+
data.tar.gz: a615f143621c1d9b81346ca23b8ee432fc6a67fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '029a96a494c99358d38858cdb772e78314d6e923248589a2145e6b3e1d52dec61eb66429890d7ede8224be097c41c53c0a6d4ffbae23d3263f8ba9c250997a89'
|
7
|
+
data.tar.gz: 4b05254ba442351affed8db14ae7b462b06f6f92d310adf9e9336cd04e33dc626e3ed3d86c8bfb84544d81ef764e1ec5abe743fb971843df9a04fb8362d76bd4
|
@@ -30,36 +30,50 @@ module Association
|
|
30
30
|
target_field = tsv.fields.first
|
31
31
|
namespace = tsv.namespace
|
32
32
|
|
33
|
-
|
34
|
-
Log.debug("Changing source format from #{tsv.key_field} to #{source_final_format}")
|
33
|
+
data = Misc.process_options options, :data
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
data ||= {}
|
36
|
+
TmpFile.with_file do |tmpfile1|
|
37
|
+
TmpFile.with_file do |tmpfile2|
|
38
|
+
tmp_data1 = Persist.open_database(tmpfile1, true, :double, "HDB")
|
39
|
+
tmp_data2 = Persist.open_database(tmpfile2, true, :double, "HDB")
|
40
|
+
|
41
|
+
if source_final_format and source_field != source_final_format
|
42
|
+
Log.debug("Changing source format from #{tsv.key_field} to #{source_final_format}")
|
43
|
+
|
44
|
+
identifier_files = tsv.identifier_files.dup
|
45
|
+
identifier_files = [Organism.identifiers("NAMESPACE")] if identifier_files.empty?
|
46
|
+
identifier_files.concat Entity.identifier_files(source_final_format) if defined? Entity
|
47
|
+
identifier_files.uniq!
|
48
|
+
identifier_files.collect!{|f| f.annotate(f.gsub(/\bNAMESPACE\b/, namespace))} if namespace
|
49
|
+
identifier_files.reject!{|f| f.match(/\bNAMESPACE\b/)}
|
50
|
+
|
51
|
+
tsv = TSV.translate(tsv, source_field, source_final_format, options.merge(:identifier_files => identifier_files, :persist_data => tmp_data1))
|
52
|
+
end
|
42
53
|
|
43
|
-
|
44
|
-
|
54
|
+
# Translate target
|
55
|
+
if target_final_format and target_field != target_final_format
|
56
|
+
Log.debug("Changing target format from #{target_field} to #{target_final_format}")
|
57
|
+
old_key_field = tsv.key_field
|
58
|
+
tsv.key_field = "MASK"
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
60
|
+
identifier_files = tsv.identifier_files.dup
|
61
|
+
identifier_files.concat Entity.identifier_files(target_final_format) if defined? Entity
|
62
|
+
identifier_files.uniq!
|
63
|
+
identifier_files.collect!{|f| f.annotate(f.gsub(/\bNAMESPACE\b/, namespace))} if namespace
|
64
|
+
identifier_files.reject!{|f| f.match(/\bNAMESPACE\b/)}
|
51
65
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
identifier_files.collect!{|f| f.annotate(f.gsub(/\bNAMESPACE\b/, namespace))} if namespace
|
56
|
-
identifier_files.reject!{|f| f.match(/\bNAMESPACE\b/)}
|
66
|
+
tsv = TSV.translate(tsv, target_field, target_final_format, options.merge(:identifier_files => identifier_files, :persist_data => tmp_data2))
|
67
|
+
tsv.key_field = old_key_field
|
68
|
+
end
|
57
69
|
|
58
|
-
|
59
|
-
|
60
|
-
|
70
|
+
tsv.through do |k,v|
|
71
|
+
data[k] = v
|
72
|
+
end
|
61
73
|
|
62
|
-
|
74
|
+
tsv.annotate data
|
75
|
+
end
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
def self.reorder_tsv(tsv, options = {})
|
@@ -84,7 +98,7 @@ module Association
|
|
84
98
|
tsv.fields = field_headers
|
85
99
|
|
86
100
|
if source_format or target_format
|
87
|
-
tsv = translate tsv, source_format, target_format, :persist => true, :
|
101
|
+
tsv = translate tsv, source_format, target_format, :persist => true, :data => data
|
88
102
|
else
|
89
103
|
tsv.through do |k,v|
|
90
104
|
data[k] = v
|
@@ -152,7 +166,7 @@ module Association
|
|
152
166
|
tsv.fields = field_headers
|
153
167
|
|
154
168
|
if source_format or target_format
|
155
|
-
tsv = translate tsv, source_format, target_format, :persist => true, :
|
169
|
+
tsv = translate tsv, source_format, target_format, :persist => true, :data => data
|
156
170
|
else
|
157
171
|
tsv.through do |k,v|
|
158
172
|
data[k] = v
|
@@ -7,11 +7,11 @@ module Association
|
|
7
7
|
options = options.nil? ? {} : options.dup
|
8
8
|
persist_options = persist_options.nil? ? Misc.pull_keys(options, :persist) : persist_options.dup
|
9
9
|
|
10
|
-
persist_options = Misc.add_defaults persist_options.dup, :persist => true
|
10
|
+
persist_options = Misc.add_defaults persist_options.dup, :persist => true, :dir => Rbbt.var.associations
|
11
11
|
persist = persist_options[:persist]
|
12
12
|
|
13
13
|
file = version_file(file, options[:namespace]) if options[:namespace] and String === file
|
14
|
-
Persist.persist_tsv(file,
|
14
|
+
Persist.persist_tsv(file, nil, options, persist_options.merge(:engine => "BDB", :prefix => "Association Index")) do |data|
|
15
15
|
options = Misc.add_defaults options.dup, :monitor => "Building index for #{Misc.fingerprint file}"
|
16
16
|
recycle = options[:recycle]
|
17
17
|
undirected = options[:undirected]
|
@@ -13,12 +13,12 @@ module Association
|
|
13
13
|
|
14
14
|
options = Misc.add_defaults options, :zipped => true, :merge => true, :monitor => {:desc => "Opening database #{Misc.fingerprint file}"}
|
15
15
|
options[:zipped] = false unless options[:merge]
|
16
|
-
persist_options = Misc.add_defaults persist_options, :persist => true, :dir => Rbbt.var.associations
|
16
|
+
persist_options = Misc.add_defaults persist_options.dup, :persist => true, :dir => Rbbt.var.associations
|
17
17
|
persist = persist_options[:persist]
|
18
18
|
|
19
19
|
file = version_file(file, options[:namespace]) if options[:namespace] and String === file
|
20
20
|
|
21
|
-
data = Persist.persist_tsv(file,
|
21
|
+
data = Persist.persist_tsv(file, nil, options, persist_options.merge(:prefix => "Association Database")) do |data|
|
22
22
|
file = file.call if Proc === file
|
23
23
|
|
24
24
|
options = options.dup
|
@@ -57,7 +57,7 @@ module Association
|
|
57
57
|
|
58
58
|
if source_specs.first and not all_fields.include? source_specs.first and defined? Entity and (_format = Entity.formats[source_specs.first.to_s])
|
59
59
|
_source = all_fields.select{|f| Entity.formats[f.to_s] == _format }.first
|
60
|
-
raise "Source not found #{source_specs}. Options: #{Misc.fingerprint all_fields}" if
|
60
|
+
raise "Source not found #{source_specs}. Options: #{Misc.fingerprint all_fields}" if _source.nil?
|
61
61
|
source_specs[0] = _source
|
62
62
|
end
|
63
63
|
|
data/lib/rbbt/tsv/serializers.rb
CHANGED
@@ -57,7 +57,11 @@ module TSV
|
|
57
57
|
|
58
58
|
class StringDoubleArraySerializer
|
59
59
|
def self.dump(array)
|
60
|
-
|
60
|
+
begin
|
61
|
+
array.collect{|a| a.collect{|a| a.to_s } * "|"} * "\t"
|
62
|
+
rescue Encoding::CompatibilityError
|
63
|
+
array.collect{|a| a.collect{|a| a.to_s.force_encoding('UTF-8')} * "|"} * "\t"
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
63
67
|
def self.load(string)
|
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.21.
|
4
|
+
version: 5.21.69
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|