rbbt-util 5.21.90 → 5.21.91

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: e68de8ec56241c9fbc4bceed94f7c632a859c930
4
- data.tar.gz: 3e4caace384777f8e4ecce35d89c003be40354fc
3
+ metadata.gz: f563cccf569fa61510d611058e9bbc3f15f4ecca
4
+ data.tar.gz: 8d11affe29abde8039c69e64c53206a40584bfd0
5
5
  SHA512:
6
- metadata.gz: 29df479899b22d4577a28714247a80102836b4a63cd97548e3432d3d9cbcf469b13e3211c757ff4f83940e73f8a96696fa9779c0a5b9e43e8272f95b9738d926
7
- data.tar.gz: a89236195f0add1240259fac4627a5e51e5808b73548f8d279586e3390688ef0aafc9e1d288f0704e68febbaf48a4159a6f3e86fbf875e836e320b12cccc3fe9
6
+ metadata.gz: db6be501c52eefb3e8f7a66a494772462fb26652d3ec17f20215da24958f91d17ae5e7fb648c8dd12770cd500eced281fcd4fdbb174e1f9f86705cfd71f01bfe
7
+ data.tar.gz: ce353bf4de86ec04797f6cf6b839bb6ee7fb19e4ad67e21d481404d34ea253ab0f79e7d09fc436a3c476be27e9ca33618562f2faa8987acfacb3940f5d1f0c26
@@ -100,7 +100,7 @@ module TSV
100
100
  key1 = key2 = nil
101
101
  while key1.nil?
102
102
  while (line1 = file1.gets) =~ /^#/
103
- key_field1, *fields1 = line1.strip.sub('#','').split(sep)
103
+ key_field1, *fields1 = line1.chomp.sub('#','').split(sep)
104
104
  end
105
105
  key1, *parts1 = line1.sub("\n",'').split(sep, -1)
106
106
  cols1 = parts1.length
@@ -108,7 +108,7 @@ module TSV
108
108
 
109
109
  while key2.nil?
110
110
  while (line2 = file2.gets) =~ /^#/
111
- key_field2, *fields2 = line2.strip.sub('#','').split(sep)
111
+ key_field2, *fields2 = line2.chomp.sub('#','').split(sep)
112
112
  end
113
113
  key2, *parts2 = line2.sub("\n",'').split(sep, -1)
114
114
  cols2 = parts2.length
@@ -76,7 +76,7 @@ module TSV
76
76
  if type == :double
77
77
  self[key] = values.concat field_positions.collect{|v| []}
78
78
  else
79
- self[key] = values.concat [nil] * field_positions
79
+ self[key] = values.concat [nil] * field_positions.length
80
80
  end
81
81
  when Array === source_keys
82
82
  all_new_values = source_keys.collect do |source_key|
@@ -174,7 +174,7 @@ module TSV
174
174
  end
175
175
  end
176
176
  begin
177
- callback.call yield line.strip
177
+ callback.call yield line.chomp
178
178
  ensure
179
179
  bar.tick if bar
180
180
  end
@@ -183,7 +183,7 @@ module TSV
183
183
  bar.init if bar
184
184
  while line = io.gets
185
185
  begin
186
- yield line.strip
186
+ yield line.chomp
187
187
  ensure
188
188
  bar.tick if bar
189
189
  end
@@ -238,12 +238,12 @@ module TSV
238
238
  def self.reorder_stream(stream, positions, sep = "\t")
239
239
  Misc.open_pipe do |sin|
240
240
  line = stream.gets
241
- line.strip! unless line.nil?
241
+ line.chomp! unless line.nil?
242
242
 
243
243
  while line =~ /^#\:/
244
244
  sin.puts line
245
245
  line = stream.gets
246
- line.strip! unless line.nil?
246
+ line.chomp! unless line.nil?
247
247
  end
248
248
 
249
249
  while line =~ /^#/
@@ -255,9 +255,9 @@ module TSV
255
255
  end
256
256
  positions = new
257
257
  end
258
- sin.puts "#" + line.sub(/^#/,'').strip.split(sep).values_at(*positions).compact * sep
258
+ sin.puts "#" + line.sub(/^#/,'').chomp.split(sep).values_at(*positions).compact * sep
259
259
  line = stream.gets
260
- line.strip! unless line.nil?
260
+ line.chomp! unless line.nil?
261
261
  end
262
262
 
263
263
  while line
@@ -273,7 +273,7 @@ module TSV
273
273
  new_values = values.values_at(*positions)
274
274
  sin.puts new_values * sep
275
275
  line = stream.gets
276
- line.strip! unless line.nil?
276
+ line.chomp! unless line.nil?
277
277
  end
278
278
  end
279
279
  end
@@ -48,13 +48,22 @@ module Log
48
48
  else
49
49
  20
50
50
  end
51
- max_history = 100 if max_history > 100
51
+ max_history = 30 if max_history > 30
52
52
  @history.shift if @history.length > max_history
53
53
  end
54
54
 
55
55
  @mean_max ||= 0
56
56
  if @history.length > 3
57
- mean = @mean = Misc.mean(@history)
57
+
58
+ w_mean = 0
59
+ total_w = 0
60
+ @history.each_with_index do |v,i|
61
+ c = i ** 10
62
+ w_mean += v * c
63
+ total_w += c
64
+ end
65
+ mean = @mean = w_mean.to_f / total_w
66
+
58
67
  @mean_max = mean if mean > @mean_max
59
68
  end
60
69
 
@@ -307,7 +307,7 @@ module Misc
307
307
  end
308
308
 
309
309
  def self.intersect_streams_read(io, sep=":")
310
- line = io.gets.strip
310
+ line = io.gets.chomp
311
311
  parts = line.split(sep)
312
312
  chr, start, eend, *rest = parts
313
313
  start = start.to_i
@@ -523,7 +523,7 @@ module Misc
523
523
  keys[i] = nil
524
524
  parts[i] = []
525
525
  else
526
- key, *p = line.strip.split(sep, -1)
526
+ key, *p = line.chomp.split(sep, -1)
527
527
  keys[i] = key
528
528
  parts[i] = p
529
529
  end
@@ -542,7 +542,7 @@ module Misc
542
542
  keys[i] = nil
543
543
  parts[i] = nil
544
544
  else
545
- k, *p = line.strip.split(sep, -1)
545
+ k, *p = line.chomp.split(sep, -1)
546
546
  keys[i] = k
547
547
  parts[i] = p
548
548
  end
@@ -121,7 +121,7 @@ class Step
121
121
  when :array
122
122
  array = []
123
123
  while line = value.gets
124
- array << line.strip
124
+ array << line.chomp
125
125
  end
126
126
  array
127
127
  when :tsv
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.90
4
+ version: 5.21.91
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-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -508,83 +508,83 @@ signing_key:
508
508
  specification_version: 4
509
509
  summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
510
510
  test_files:
511
- - test/test_helper.rb
511
+ - test/rbbt/test_workflow.rb
512
512
  - test/rbbt/resource/test_path.rb
513
- - test/rbbt/association/test_item.rb
514
- - test/rbbt/association/test_database.rb
515
- - test/rbbt/association/test_open.rb
516
- - test/rbbt/association/test_index.rb
517
- - test/rbbt/association/test_util.rb
518
- - test/rbbt/util/test_concurrency.rb
519
- - test/rbbt/util/test_log.rb
520
- - test/rbbt/util/test_chain_methods.rb
521
- - test/rbbt/util/test_simpleopt.rb
522
- - test/rbbt/util/simpleopt/test_parse.rb
523
- - test/rbbt/util/simpleopt/test_get.rb
524
- - test/rbbt/util/simpleopt/test_setup.rb
525
513
  - test/rbbt/util/test_cmd.rb
526
- - test/rbbt/util/test_semaphore.rb
527
- - test/rbbt/util/concurrency/test_threads.rb
528
- - test/rbbt/util/concurrency/processes/test_socket.rb
529
- - test/rbbt/util/concurrency/test_processes.rb
530
- - test/rbbt/util/test_tmpfile.rb
531
- - test/rbbt/util/test_open.rb
532
- - test/rbbt/util/test_filecache.rb
533
- - test/rbbt/util/R/test_eval.rb
534
- - test/rbbt/util/R/test_model.rb
514
+ - test/rbbt/util/simpleopt/test_setup.rb
515
+ - test/rbbt/util/simpleopt/test_get.rb
516
+ - test/rbbt/util/simpleopt/test_parse.rb
517
+ - test/rbbt/util/test_chain_methods.rb
535
518
  - test/rbbt/util/test_simpleDSL.rb
536
- - test/rbbt/util/log/test_progress.rb
537
- - test/rbbt/util/test_colorize.rb
538
- - test/rbbt/util/test_R.rb
519
+ - test/rbbt/util/test_log.rb
520
+ - test/rbbt/util/test_open.rb
539
521
  - test/rbbt/util/misc/test_lock.rb
540
- - test/rbbt/util/misc/test_pipes.rb
522
+ - test/rbbt/util/misc/test_multipart_payload.rb
541
523
  - test/rbbt/util/misc/test_bgzf.rb
524
+ - test/rbbt/util/misc/test_pipes.rb
542
525
  - test/rbbt/util/misc/test_omics.rb
543
- - test/rbbt/util/misc/test_multipart_payload.rb
526
+ - test/rbbt/util/test_concurrency.rb
527
+ - test/rbbt/util/test_R.rb
528
+ - test/rbbt/util/log/test_progress.rb
529
+ - test/rbbt/util/test_colorize.rb
530
+ - test/rbbt/util/test_simpleopt.rb
544
531
  - test/rbbt/util/test_excel2tsv.rb
532
+ - test/rbbt/util/test_filecache.rb
533
+ - test/rbbt/util/concurrency/test_processes.rb
534
+ - test/rbbt/util/concurrency/test_threads.rb
535
+ - test/rbbt/util/concurrency/processes/test_socket.rb
536
+ - test/rbbt/util/test_semaphore.rb
545
537
  - test/rbbt/util/test_misc.rb
538
+ - test/rbbt/util/test_tmpfile.rb
539
+ - test/rbbt/util/R/test_model.rb
540
+ - test/rbbt/util/R/test_eval.rb
541
+ - test/rbbt/test_packed_index.rb
542
+ - test/rbbt/entity/test_identifiers.rb
543
+ - test/rbbt/test_association.rb
544
+ - test/rbbt/knowledge_base/test_traverse.rb
545
+ - test/rbbt/knowledge_base/test_registry.rb
546
+ - test/rbbt/knowledge_base/test_entity.rb
547
+ - test/rbbt/knowledge_base/test_enrichment.rb
548
+ - test/rbbt/knowledge_base/test_syndicate.rb
549
+ - test/rbbt/knowledge_base/test_query.rb
550
+ - test/rbbt/test_resource.rb
546
551
  - test/rbbt/test_entity.rb
552
+ - test/rbbt/test_knowledge_base.rb
553
+ - test/rbbt/annotations/test_util.rb
554
+ - test/rbbt/association/test_index.rb
555
+ - test/rbbt/association/test_item.rb
556
+ - test/rbbt/association/test_open.rb
557
+ - test/rbbt/association/test_util.rb
558
+ - test/rbbt/association/test_database.rb
559
+ - test/rbbt/test_tsv.rb
547
560
  - test/rbbt/workflow/step/test_dependencies.rb
548
- - test/rbbt/workflow/test_doc.rb
549
- - test/rbbt/workflow/test_step.rb
550
561
  - test/rbbt/workflow/test_task.rb
551
- - test/rbbt/test_association.rb
552
- - test/rbbt/test_knowledge_base.rb
553
- - test/rbbt/tsv/parallel/test_traverse.rb
554
- - test/rbbt/tsv/parallel/test_through.rb
562
+ - test/rbbt/workflow/test_step.rb
563
+ - test/rbbt/workflow/test_doc.rb
564
+ - test/rbbt/test_monitor.rb
565
+ - test/rbbt/test_persist.rb
566
+ - test/rbbt/test_annotations.rb
567
+ - test/rbbt/persist/test_tsv.rb
568
+ - test/rbbt/persist/tsv/test_lmdb.rb
569
+ - test/rbbt/persist/tsv/test_kyotocabinet.rb
570
+ - test/rbbt/persist/tsv/test_sharder.rb
571
+ - test/rbbt/persist/tsv/test_cdb.rb
572
+ - test/rbbt/persist/tsv/test_tokyocabinet.rb
573
+ - test/rbbt/persist/tsv/test_leveldb.rb
574
+ - test/rbbt/tsv/test_field_index.rb
555
575
  - test/rbbt/tsv/test_parallel.rb
556
- - test/rbbt/tsv/test_excel.rb
557
- - test/rbbt/tsv/test_accessor.rb
576
+ - test/rbbt/tsv/test_index.rb
577
+ - test/rbbt/tsv/test_matrix.rb
558
578
  - test/rbbt/tsv/test_change_id.rb
579
+ - test/rbbt/tsv/test_parser.rb
559
580
  - test/rbbt/tsv/test_stream.rb
581
+ - test/rbbt/tsv/test_util.rb
582
+ - test/rbbt/tsv/test_excel.rb
583
+ - test/rbbt/tsv/test_accessor.rb
560
584
  - test/rbbt/tsv/test_filter.rb
561
- - test/rbbt/tsv/test_matrix.rb
562
585
  - test/rbbt/tsv/test_attach.rb
563
586
  - test/rbbt/tsv/test_manipulate.rb
564
- - test/rbbt/tsv/test_field_index.rb
565
- - test/rbbt/tsv/test_index.rb
566
- - test/rbbt/tsv/test_util.rb
567
- - test/rbbt/tsv/test_parser.rb
568
- - test/rbbt/test_packed_index.rb
569
- - test/rbbt/test_persist.rb
587
+ - test/rbbt/tsv/parallel/test_through.rb
588
+ - test/rbbt/tsv/parallel/test_traverse.rb
570
589
  - test/rbbt/test_fix_width_table.rb
571
- - test/rbbt/knowledge_base/test_traverse.rb
572
- - test/rbbt/knowledge_base/test_entity.rb
573
- - test/rbbt/knowledge_base/test_query.rb
574
- - test/rbbt/knowledge_base/test_enrichment.rb
575
- - test/rbbt/knowledge_base/test_syndicate.rb
576
- - test/rbbt/knowledge_base/test_registry.rb
577
- - test/rbbt/entity/test_identifiers.rb
578
- - test/rbbt/test_monitor.rb
579
- - test/rbbt/test_workflow.rb
580
- - test/rbbt/test_annotations.rb
581
- - test/rbbt/annotations/test_util.rb
582
- - test/rbbt/test_resource.rb
583
- - test/rbbt/persist/tsv/test_tokyocabinet.rb
584
- - test/rbbt/persist/tsv/test_kyotocabinet.rb
585
- - test/rbbt/persist/tsv/test_lmdb.rb
586
- - test/rbbt/persist/tsv/test_leveldb.rb
587
- - test/rbbt/persist/tsv/test_cdb.rb
588
- - test/rbbt/persist/tsv/test_sharder.rb
589
- - test/rbbt/persist/test_tsv.rb
590
- - test/rbbt/test_tsv.rb
590
+ - test/test_helper.rb