rbbt-util 5.19.28 → 5.19.29

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: 2149fa7923fc0214ca857eec7d13d18f386b3e9e
4
- data.tar.gz: ed588eb8da4eb1868e2bdfb4a7211ff282c1ce3d
3
+ metadata.gz: dcf03395fb6992f9b928709c4c1a5b62bc8409f8
4
+ data.tar.gz: 3d06adac3fe7750350c7185c93f61afae8f0b09e
5
5
  SHA512:
6
- metadata.gz: 9c1709fc586ddeb17dc5c13485a6c10c8655db5d36bfc59ff2098bd3059b874bac079814a3ab2dd24368834d4b0060d8616c9d268736e5502c9a412d8ac22f43
7
- data.tar.gz: 34f31ba40eccf2bc78f83332374217a52177f1e43dfa15be80cff52c1c80fe2f2ff76e27b99bac38cae2d276c930390263409ff208cfab25742115401cee4357
6
+ metadata.gz: 06501f7fca063beaff2358c021a46d14a93630d9ab3fd0b68c1df4e4f98e5c810916168401d2dd79d8e3b835b50a5907ac4cf41bae2bce7e18b28f7e9ef1245b
7
+ data.tar.gz: 91ee3cf063dc7b645b28c3005ee911d5a51d5f1eaf6d78b10a1fd19ebbf64e73d7a95e8793328883febfa67bfee7ee1a6ae77b41c57272432d2e0e98187a9a68
@@ -29,7 +29,7 @@ module TSV
29
29
  end
30
30
  end
31
31
 
32
- new_values.collect!{|v| [v]} if type == :double and not other.type == :double
32
+ new_values.collect!{|v| [v]} if type == :double and not (other.type == :double or other.type == :flat)
33
33
  new_values.collect!{|v| v.nil? ? nil : (other.type == :single ? v : v.first)} if not type == :double and other.type == :double
34
34
 
35
35
  new_values.flatten if type == :flat
@@ -51,8 +51,10 @@ module TSV
51
51
  options = Misc.add_defaults options, :persist => false, :identifiers => tsv.identifiers, :compact => true
52
52
 
53
53
  identifiers, persist_input, compact = Misc.process_options options, :identifiers, :persist, :compact
54
+ identifiers = tsv.identifier_files.first if identifiers.nil?
55
+ identifiers = Organism.identifiers(tsv.namespace) if identifiers.nil? and tsv.namespace and Organism.identifiers(tsv.namespace).exists?
54
56
 
55
- fields = identifiers.all_fields.include?(field)? [field] : nil
57
+ fields = (identifiers and identifiers.all_fields.include?(field))? [field] : nil
56
58
  index = identifiers.index :target => format, :fields => fields, :persist => persist_input
57
59
 
58
60
  orig_type = tsv.type
@@ -18,7 +18,7 @@ module TSV
18
18
 
19
19
  def self.paste_streams(streams, options = {})
20
20
  options = Misc.add_defaults options, :sep => "\t", :sort => true
21
- sort, sep, preamble, header, same_fields, fix_flat = Misc.process_options options, :sort, :sep, :preamble, :header, :same_fields, :fix_flat
21
+ sort, sep, preamble, header, same_fields, fix_flat, all_match = Misc.process_options options, :sort, :sep, :preamble, :header, :same_fields, :fix_flat, :all_match
22
22
 
23
23
  out = Misc.open_pipe do |sin|
24
24
 
@@ -127,6 +127,9 @@ module TSV
127
127
  min = keys.compact.sort.first
128
128
  break if min.nil?
129
129
  str = []
130
+
131
+ skip = all_match && keys.uniq != [min]
132
+
130
133
  keys.each_with_index do |key,i|
131
134
  case key
132
135
  when min
@@ -161,6 +164,8 @@ module TSV
161
164
  end
162
165
  end
163
166
 
167
+ next if skip
168
+
164
169
  if same_fields
165
170
 
166
171
  values = nil
@@ -292,7 +292,7 @@ module TSV
292
292
  through do |k,v| new[k] = v[pos] end
293
293
  end
294
294
  when :flat
295
- self
295
+ return self
296
296
  when :single
297
297
  through do |k,v|
298
298
  new[k] = [v]
@@ -247,8 +247,8 @@ module Log
247
247
 
248
248
  def self.tsv(tsv)
249
249
  STDERR.puts Log.color :magenta, "TSV log: " << Log.last_caller(caller)
250
- puts Log.color(:blue, "=> "<< Misc.fingerprint(tsv), true)
251
- puts Log.color(:cyan, "=> " << tsv.summary)
250
+ STDERR.puts Log.color(:blue, "=> "<< Misc.fingerprint(tsv), true)
251
+ STDERR.puts Log.color(:cyan, "=> " << tsv.summary)
252
252
  end
253
253
 
254
254
  def self.stack(stack)
@@ -365,6 +365,10 @@ module Misc
365
365
  current_parts[i] = current_parts[i] << "|" << part
366
366
  end
367
367
  end
368
+
369
+ (parts.length..current_parts.length-1).to_a.each do |pos|
370
+ current_parts[pos] = current_parts[pos] << "|" << ""
371
+ end
368
372
  when current_key != key
369
373
  sin.puts [current_key, current_parts].flatten * sep
370
374
  current_key = key
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.28
4
+ version: 5.19.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake