rbbt-util 5.17.21 → 5.17.22

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: 557142d92147d54d45af152135df1fe1743002bd
4
- data.tar.gz: 5f56410a030766911e3ca59be65a887a84925636
3
+ metadata.gz: d71a299df6e7ad5194c3eae79edea89ae8e4b274
4
+ data.tar.gz: dd907c1ed5886f7523e01bd5bd9aade9c75db0dd
5
5
  SHA512:
6
- metadata.gz: a58ff556d9be4894195d4e317ef7d9f0fb82bca320b7f03804355fb8d7eda0e72307caa50fb432fe1451d4d55ca40d03da5f20d059e105a4cd89044bdbe15ad1
7
- data.tar.gz: 79582eaa89d75dccbce3396e71553b4ab3fad049d8787daaa6a6fc93a6fbac0309d0f277639f05faeb6b71ca779d9aeb4d1ec0ad96407ddfd7af30f2ffb06891
6
+ metadata.gz: dcd03456906cec78394d31424b837e68831201ed9db7a20bf95e6327f1d61b2485b64639d38197a5ebd024a572d103183aa87918a681b44566752620171b2460
7
+ data.tar.gz: 32e0ee7a9423802af6aaa8f08eb2e9ea841f483d684aee8352e9e2946b4a40b5c04c0f591dbe406e1da25c0bd5b62849ce170fb8dec0d93ad8768904ba18a8a4
@@ -374,10 +374,12 @@ module Misc
374
374
  parts = []
375
375
  lines.each_with_index do |line,i|
376
376
  if line.nil?
377
+ keys[i] = nil
378
+ parts[i] = []
379
+ else
377
380
  key, *p = line.strip.split(sep, -1)
378
381
  keys[i] = key
379
382
  parts[i] = p
380
- else
381
383
  end
382
384
  end
383
385
  sizes = parts.collect{|p| p.nil? ? 0 : p.length }
@@ -40,7 +40,7 @@ row3 ccc
40
40
  s1 = StringIO.new text1
41
41
  s2 = StringIO.new text2
42
42
  s3 = StringIO.new text3
43
- tsv = TSV.open Misc.paste_streams([s1,s2,s3],nil, " "), :sep => " ", :type => :list
43
+ tsv = TSV.open Misc.paste_streams([s1,s2,s3], nil, " "), :sep => " ", :type => :list
44
44
  assert_equal ["A", "B", "C", "a", "b", "c"], tsv["row1"]
45
45
  assert_equal ["AA", "BB", "CC", "aa", "bb", "cc"], tsv["row2"]
46
46
  assert_equal ["AAA", "BBB", "CCC", "", "", "ccc"], tsv["row3"]
@@ -6,7 +6,7 @@ require 'rbbt/entity'
6
6
 
7
7
  class TestMisc < Test::Unit::TestCase
8
8
 
9
- def _test_object_delta
9
+ def test_object_delta
10
10
  a = []
11
11
  b = nil
12
12
  d = Misc.object_delta(String) do
@@ -16,13 +16,13 @@ class TestMisc < Test::Unit::TestCase
16
16
  assert_match /^0\.\d+$/, a.first
17
17
  end
18
18
 
19
- def _test_format_seconds
19
+ def test_format_seconds
20
20
  t = 61.3232
21
21
  assert_equal "00:01:01", Misc.format_seconds(t)
22
22
  assert_equal "00:01:01.32", Misc.format_seconds(t, true)
23
23
  end
24
24
 
25
- def _test_format_paragraph
25
+ def test_format_paragraph
26
26
  p = <<-EOF
27
27
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
28
28
  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
@@ -42,7 +42,7 @@ in culpa qui officia deserunt mollit anim id est laborum.
42
42
  assert Misc.format_paragraph(p, 70, 10, 5) =~ /\n\s*\* two/sm
43
43
  end
44
44
 
45
- def _test_format_dl
45
+ def test_format_dl
46
46
  p1 = <<-EOF
47
47
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
48
48
  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
@@ -72,13 +72,13 @@ eum fugiat quo voluptas nulla pariatur?"
72
72
  assert Misc.format_definition_list({:paragraph_first => p1, :paragraph_second => p2}) =~ / /
73
73
  end
74
74
 
75
- def _test_parse_cmd_params
75
+ def test_parse_cmd_params
76
76
  assert_equal ["workflow", "task", "Translation", "translate", "-f", "Associated Gene Name", "-l", "-"],
77
77
  Misc.parse_cmd_params("workflow task Translation translate -f 'Associated Gene Name' -l -")
78
78
  end
79
79
 
80
80
 
81
- def _test_fixutf8
81
+ def test_fixutf8
82
82
  string = "abc\xffdef"
83
83
  string = string.force_encoding("UTF-8") if string.respond_to? :force_encoding
84
84
  assert(! string.valid_encoding?) if string.respond_to? :valid_encoding?
@@ -87,37 +87,37 @@ eum fugiat quo voluptas nulla pariatur?"
87
87
  assert( Misc.fixutf8(string).valid_encoding) if string.respond_to? :valid_encoding
88
88
  end
89
89
 
90
- def _test_colors_for
90
+ def test_colors_for
91
91
  colors, used = Misc.colors_for([1,2,2,1,2,1,2,2,3,3,2,3,2])
92
92
  assert_equal Misc::COLOR_LIST[1], used[2]
93
93
  end
94
94
 
95
- def _test_total_length
95
+ def test_total_length
96
96
  ranges = [(0..100), (50..150), (120..160)]
97
97
  ranges = [(0..100), (50..150), (120..160), (51..70)]
98
98
  assert_equal 161, Misc.total_length(ranges)
99
99
  end
100
100
 
101
- def _test_id_filename?
101
+ def test_id_filename?
102
102
  TmpFile.with_file("") do |file|
103
103
  assert Misc.is_filename?(file)
104
104
  assert ! Misc.is_filename?("TEST STRING")
105
105
  end
106
106
  end
107
107
 
108
- def _test_merge_sorted_arrays
108
+ def test_merge_sorted_arrays
109
109
  assert_equal [1,2,3,4], Misc.merge_sorted_arrays([1,3], [2,4])
110
110
  end
111
111
 
112
- def _test_intersect_sorted_arrays
112
+ def test_intersect_sorted_arrays
113
113
  assert_equal [2,4], Misc.intersect_sorted_arrays([1,2,3,4], [2,4])
114
114
  end
115
115
 
116
- def _test_sorted_array_matches
116
+ def test_sorted_array_matches
117
117
  assert_equal [1,3], Misc.sorted_array_hits(%w(a b c d e), %w(b d))
118
118
  end
119
119
 
120
- def _test_binary_include?
120
+ def test_binary_include?
121
121
  a = %w(a b c d e).sort
122
122
  assert Misc.binary_include?(a, "a")
123
123
  assert(!Misc.binary_include?(a, "z"))
@@ -126,12 +126,12 @@ eum fugiat quo voluptas nulla pariatur?"
126
126
  assert(Misc.binary_include?(a, "d"))
127
127
  end
128
128
 
129
- def _test_process_to_hash
129
+ def test_process_to_hash
130
130
  list = [1,2,3,4]
131
131
  assert_equal 4, Misc.process_to_hash(list){|l| l.collect{|e| e * 2}}[2]
132
132
  end
133
133
 
134
- def _test_pipe_fork
134
+ def test_pipe_fork
135
135
  sout, sin = Misc.pipe
136
136
  pid = Process.fork do
137
137
  Misc.purge_pipes(sin)
@@ -143,7 +143,7 @@ eum fugiat quo voluptas nulla pariatur?"
143
143
  Process.kill :INT, pid
144
144
  end
145
145
 
146
- def _test_open_pipe
146
+ def test_open_pipe
147
147
  t = 5
148
148
  stream = Misc.open_pipe do |sin|
149
149
  t.times do |i|
@@ -164,7 +164,7 @@ eum fugiat quo voluptas nulla pariatur?"
164
164
  assert_equal (0..t-1).to_a.collect{|i| "LINE #{ i }"}, lines
165
165
  end
166
166
 
167
- def _test_open_pipe_fork
167
+ def test_open_pipe_fork
168
168
  t = 5
169
169
  stream = Misc.open_pipe(true) do |sin|
170
170
  t.times do |i|
@@ -185,7 +185,7 @@ eum fugiat quo voluptas nulla pariatur?"
185
185
  assert_equal (0..t-1).to_a.collect{|i| "LINE #{ i }"}, lines
186
186
  end
187
187
 
188
- def _test_open_pipe_fork_cascade
188
+ def test_open_pipe_fork_cascade
189
189
  t = 500
190
190
  sleep_time = 2.0 / t
191
191
  time = Time.now
@@ -221,7 +221,7 @@ eum fugiat quo voluptas nulla pariatur?"
221
221
  assert_equal (0..t-1).to_a.collect{|i| "LINE #{ i }".reverse.downcase}, lines
222
222
  end
223
223
 
224
- def _test_tee_stream
224
+ def test_tee_stream
225
225
  t = 500
226
226
  sleep_time = 2.0 / t
227
227
  time = Time.now
@@ -271,7 +271,7 @@ eum fugiat quo voluptas nulla pariatur?"
271
271
  end
272
272
 
273
273
 
274
- def _test_string2hash
274
+ def test_string2hash
275
275
  assert(Misc.string2hash("--user-agent=firefox").include? "--user-agent")
276
276
  assert_equal(true, Misc.string2hash(":true")[:true])
277
277
  assert_equal(true, Misc.string2hash("true")["true"])
@@ -282,16 +282,16 @@ eum fugiat quo voluptas nulla pariatur?"
282
282
  assert_equal(:j, Misc.string2hash("a=b#c=d#:h=:j")[:h])
283
283
  end
284
284
 
285
- def _test_named_array
285
+ def test_named_array
286
286
  a = NamedArray.setup([1,2,3,4], %w(a b c d))
287
287
  assert_equal(1, a['a'])
288
288
  end
289
289
 
290
- def _test_path_relative_to
290
+ def test_path_relative_to
291
291
  assert_equal "test/foo", Misc.path_relative_to('/test', '/test/test/foo')
292
292
  end
293
293
 
294
- def _test_hash2string
294
+ def test_hash2string
295
295
  hash = {}
296
296
  assert_equal hash, Misc.string2hash(Misc.hash2string(hash))
297
297
 
@@ -309,14 +309,14 @@ eum fugiat quo voluptas nulla pariatur?"
309
309
 
310
310
  end
311
311
 
312
- def _test_merge
312
+ def test_merge
313
313
  a = [[1],[2]]
314
314
  a = NamedArray.setup a, %w(1 2)
315
315
  a.merge [3,4]
316
316
  assert_equal [1,3], a[0]
317
317
  end
318
318
 
319
- def _test_indiferent_hash
319
+ def test_indiferent_hash
320
320
  a = {:a => 1, "b" => 2}
321
321
  a.extend IndiferentHash
322
322
 
@@ -326,7 +326,7 @@ eum fugiat quo voluptas nulla pariatur?"
326
326
  assert_equal 2, a[:b]
327
327
  end
328
328
 
329
- def _test_lockfile
329
+ def test_lockfile
330
330
 
331
331
  TmpFile.with_file do |tmpfile|
332
332
  pids = []
@@ -350,7 +350,7 @@ eum fugiat quo voluptas nulla pariatur?"
350
350
  end
351
351
  end
352
352
 
353
- def _test_positions2hash
353
+ def test_positions2hash
354
354
  inputs = Misc.positional2hash([:one, :two, :three], 1, :two => 2, :four => 4)
355
355
  assert_equal 1, inputs[:one]
356
356
  assert_equal 2, inputs[:two]
@@ -358,44 +358,44 @@ eum fugiat quo voluptas nulla pariatur?"
358
358
  assert_equal nil, inputs[:four]
359
359
  end
360
360
 
361
- def _test_mean
361
+ def test_mean
362
362
  assert_equal 2, Misc.mean([1,2,3])
363
363
  assert_equal 3, Misc.mean([1,2,3,4,5])
364
364
  end
365
365
 
366
- def _test_zip_fields
366
+ def test_zip_fields
367
367
  current = [[:a,1], [:b,2]]
368
368
  assert_equal [[:a, :b],[1,2]], Misc.zip_fields(current)
369
369
  assert_equal current, Misc.zip_fields(Misc.zip_fields(current))
370
370
  end
371
371
 
372
- def _test_zip_fields_comp
372
+ def test_zip_fields_comp
373
373
  current = [[:a,1], [:b,2], [:c]]
374
374
  assert_equal [[:a, :b, :c],[1,2,nil]], Misc.zip_fields(current)
375
375
  assert_equal current, Misc.zip_fields(Misc.zip_fields(current)).collect{|v| v.compact }
376
376
  end
377
377
 
378
- def _test_add_zipped
378
+ def test_add_zipped
379
379
  current = [[:a,1], [:b,2]]
380
380
  new = %w(A B)
381
381
  Misc.append_zipped current, new
382
382
  assert_equal [[:a,1,"A"], [:b,2,"B"]], current
383
383
  end
384
384
 
385
- def _test_divide
385
+ def test_divide
386
386
  assert_equal 2, Misc.divide(%w(1 2 3 4 5 6 7 8 9),2).length
387
387
  end
388
388
 
389
- def _test_ordered_divide
389
+ def test_ordered_divide
390
390
  assert_equal 5, Misc.ordered_divide(%w(1 2 3 4 5 6 7 8 9),2).length
391
391
  end
392
392
 
393
- def _test_collapse_ranges
393
+ def test_collapse_ranges
394
394
  ranges = [(0..100), (50..150), (51..61),(200..250), (300..324),(320..350)]
395
395
  assert_equal [(0..150),(200..250), (300..350)], Misc.collapse_ranges(ranges)
396
396
  end
397
397
 
398
- def _test_humanize
398
+ def test_humanize
399
399
  str1 = "test_string"
400
400
  str2 = "TEST_string"
401
401
  str3 = "test"
@@ -407,22 +407,22 @@ eum fugiat quo voluptas nulla pariatur?"
407
407
  assert_equal "mutation_enrichment", Misc.snake_case("MutationEnrichment")
408
408
  end
409
409
 
410
- def _test_snake_case
410
+ def test_snake_case
411
411
  str1 = "ACRONIMTest"
412
412
  str2 = "ACRONIM_test"
413
413
  assert_equal "ACRONIM_test", Misc.snake_case(str1)
414
414
  assert_equal "ACRONIM_test", Misc.snake_case(str2)
415
415
  end
416
416
 
417
- def _test_correct_vcf_mutations
417
+ def test_correct_vcf_mutations
418
418
  assert_equal [737407, ["-----", "-----G", "-----GTTAAT"]], Misc.correct_vcf_mutation(737406, "GTTAAT", "G,GG,GGTTAAT")
419
419
  end
420
420
 
421
- def _test_fingerprint
421
+ def test_fingerprint
422
422
  assert_equal '{a=>1}', Misc.fingerprint({:a => 1})
423
423
  end
424
424
 
425
- def _test_tarize
425
+ def test_tarize
426
426
  path = File.expand_path('/home/mvazquezg/git/rbbt-util/lib')
427
427
  stream = Misc.tarize(path)
428
428
  TmpFile.with_file do |res|
@@ -432,7 +432,7 @@ eum fugiat quo voluptas nulla pariatur?"
432
432
  end
433
433
  end
434
434
 
435
- def _test_camel_case
435
+ def test_camel_case
436
436
  assert_equal "DbSNP", Misc.camel_case("db_SNP")
437
437
  assert_equal "D3Js", Misc.camel_case("D3Js")
438
438
  assert_equal "Structure", Misc.camel_case("Structure")
@@ -440,7 +440,7 @@ eum fugiat quo voluptas nulla pariatur?"
440
440
  assert_equal "COSMIC", Misc.camel_case("COSMIC")
441
441
  end
442
442
 
443
- def _test_texar
443
+ def test_texar
444
444
  ppp Misc.html_tag('textarea', "hola\nadios\nagain")
445
445
  end
446
446
 
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.17.21
4
+ version: 5.17.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-06 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake