rbbt-util 5.8.1 → 5.8.2

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: d5612376bb0b3bc5345a607fd72cfb4f744eeba8
4
- data.tar.gz: 8d8d53efd7203512d28462d609bf6f52a1c492c0
3
+ metadata.gz: 242874c88c6d442034c3e929a735f9d8b5613f53
4
+ data.tar.gz: e7b40e285fbc4faf3961fdda643c9278eba21096
5
5
  SHA512:
6
- metadata.gz: f858ffbc83f9a199a22c9c1a49b1d40f0de1f1ea8e9979820901040a23a9eb3c7077f354aac6260876c7f04941bd2a2eea976262f6b73a1a46687421fbc441f7
7
- data.tar.gz: 3dd1ed9a2dcf25fa5939935f27ad026df16c10a8e464743122e7f6725f8317db82cdee7c5f01b5c7866a442aee9ac9cfc963eca6e276eba372bacc6749ee84d2
6
+ metadata.gz: 022e09717e9f321571373dcd56e3f1a589fdcf37d731a9db885535964e59f1209c6071017d7efe15a60cdc309538c675d2db9dbf9baae21564c1fc7e071ae13a
7
+ data.tar.gz: 244ad59bc44e11e54a015efd5ac17f69c496b35051807118ac9b931fb08a3196d47a6030966007dca9d4402e4be6738cbc1f19fd484f8c3a4daa66372bf191fc
@@ -78,12 +78,11 @@ module Association
78
78
  :persist => false,
79
79
  :key_field => all_fields.index(source),
80
80
  :fields => fields.collect{|f| String === f ? all_fields.index(f): f },
81
- :type => options[:type].to_s == :flat ? :flat : :double,
81
+ :type => (options[:type] and options[:type].to_sym == :flat) ? :flat : :double,
82
82
  :unnamed => true,
83
- :merge => options[:type].to_s == :flat ? false : true
83
+ :merge => (options[:type] and options[:type].to_sym == :flat) ? false : true
84
84
  })
85
85
 
86
- # Preserve first line, which would have been considered a header otherwise
87
86
  open_options["header_hash"] = "#" if options["header_hash"] == ""
88
87
 
89
88
  field_headers = all_fields.values_at *open_options[:fields]
@@ -129,6 +128,7 @@ module Association
129
128
  end
130
129
  end
131
130
 
131
+
132
132
  # Translate target
133
133
  if target_final_format and target_field != target_final_format and
134
134
  Entity.formats[target_field] and
@@ -140,11 +140,12 @@ module Association
140
140
  tsv.key_field = "MASKED"
141
141
 
142
142
  tsv.with_unnamed do
143
- tsv = tsv.swap_id tsv.fields.first, target_final_format, :identifiers => Organism.identifiers(tsv.namespace), :persist => true
143
+ tsv = tsv.swap_id tsv.fields.first, target_final_format, :identifiers => Organism.identifiers(tsv.namespace), :persist => true, :compact => true
144
144
  end
145
145
 
146
146
  tsv.key_field = save_key_field
147
147
  end
148
+
148
149
  tsv
149
150
  end
150
151
 
@@ -307,6 +307,7 @@ module TSV
307
307
  in_namespace = options[:in_namespace]
308
308
 
309
309
  identifiers1 = tsv1.identifier_files || []
310
+ identifiers1 += options[:identifiers] if options[:identifiers]
310
311
  identifiers2 = tsv2.identifier_files || []
311
312
 
312
313
  identifiers1.unshift tsv1
@@ -17,6 +17,7 @@ module TSV
17
17
  else
18
18
  tsv = tsv.attach identifiers, :fields => [format], :persist_input => true
19
19
  end
20
+
20
21
  tsv = tsv.reorder(format, tsv.fields - [format])
21
22
 
22
23
  tsv = tsv.to_flat if orig_type == :flat
@@ -35,9 +36,9 @@ module TSV
35
36
  end
36
37
 
37
38
  def self.swap_id(tsv, field, format, options = {}, &block)
38
- options = Misc.add_defaults options, :persist => false, :identifiers => tsv.identifiers
39
+ options = Misc.add_defaults options, :persist => false, :identifiers => tsv.identifiers, :compact => true
39
40
 
40
- identifiers, persist_input = Misc.process_options options, :identifiers, :persist
41
+ identifiers, persist_input, compact = Misc.process_options options, :identifiers, :persist, :compact
41
42
 
42
43
  fields = identifiers.all_fields.include?(field)? [field] : nil
43
44
  index = identifiers.index :target => format, :fields => fields, :persist => persist_input
@@ -54,7 +55,9 @@ module TSV
54
55
  end
55
56
  else
56
57
  tsv.through do |k,v|
57
- v[pos] = index.values_at(*v[pos])
58
+ _values = index.values_at(*v[pos])
59
+ _values.compact! if compact
60
+ v[pos] = _values
58
61
  tsv[k] = v
59
62
  end
60
63
  end
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.8.1
4
+ version: 5.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez