rbbt-util 5.21.94 → 5.21.95

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: 93f37afedb8b4b26bd91085eaaef7df99b82a0d8
4
- data.tar.gz: cbfd6a8d879360594894a34dd7345f30245b7082
3
+ metadata.gz: a8627482cbd18d7d3a64ca31e0d6c1035f741523
4
+ data.tar.gz: 3ec4150b254df3faaec0645421da191703778eb5
5
5
  SHA512:
6
- metadata.gz: 5e1cc9aa3f9fafba3994116cd51a0f61bee05fc79ac78ac941d02511168c44a067b32be2205c30f489d50f887713d417ce69c6f2d81aeb4c5c4f353dad32e3ef
7
- data.tar.gz: 110a36619736f08ef430e9da9c51bb79a69bd6352c4f1b4a98970504c9fe1d1dda23d3c6bcc55edb1688cbe3bf3b7f07e4252d06c42a4ba763143d6f612326e6
6
+ metadata.gz: da8334e8b9488bda2d6e24503b7ec0910b984d6f324730424e925c4a43d6614960bf3779c71872486e9cf759de6f428bd21550449e736857be334dd2d0fa7cee
7
+ data.tar.gz: 0b76b13dc1a568c0238c40564f4f159713fa6a597bf27058face9d6c32fa9f255d06615143615f58e97dc6196c38ff6d0f6aed90df88e4edaaa060167cbdaaed
data/lib/rbbt/util/cmd.rb CHANGED
@@ -32,6 +32,7 @@ module CMD
32
32
  log = options.delete(:log)
33
33
  no_fail = options.delete(:no_fail)
34
34
  no_wait = options.delete(:no_wait)
35
+
35
36
  dont_close_in = options.delete(:dont_close_in)
36
37
 
37
38
  log = true if log.nil?
@@ -127,12 +128,7 @@ module CMD
127
128
  sin.close
128
129
  end
129
130
 
130
- if no_wait
131
- pids = []
132
- else
133
- pids = [pid]
134
- end
135
-
131
+ pids = [pid]
136
132
 
137
133
  if pipe
138
134
  err_thread = Thread.new do
@@ -79,7 +79,7 @@ module ConcurrentStream
79
79
  @threads.each do |t|
80
80
  next if t == Thread.current
81
81
  begin
82
- t.join unless FalseClass === t.status
82
+ t.join #unless FalseClass === t.status
83
83
  rescue Exception
84
84
  Log.warn "Exception joining thread in ConcurrenStream: #{filename}"
85
85
  raise $!
@@ -114,7 +114,6 @@ module ConcurrentStream
114
114
  end
115
115
 
116
116
  def join
117
-
118
117
  join_threads
119
118
  join_pids
120
119
 
@@ -126,26 +125,24 @@ module ConcurrentStream
126
125
  close unless closed?
127
126
  end
128
127
 
129
- def abort_threads(exception)
128
+ def abort_threads(exception = nil)
129
+ return unless @threads and @threads.any?
130
130
  Log.low "Aborting threads (#{Thread.current.inspect}) #{@threads.collect{|t| t.inspect } * ", "}"
131
131
 
132
132
  @threads.each do |t|
133
133
  next if t == Thread.current
134
- Log.low "Aborting thread #{t.inspect}"
135
- t.raise exception ? exception : Aborted.new
136
- end if @threads
134
+ Log.low "Aborting thread #{t.inspect} with exception: #{exception}"
135
+ t.raise((exception.nil? ? Aborted.new : exception))
136
+ end
137
137
 
138
- sleeped = false
139
138
  @threads.each do |t|
140
139
  next if t == Thread.current
141
140
  if t.alive?
142
- sleep 1 unless sleeped
143
- sleeped = true
141
+ sleep 1
144
142
  Log.low "Kill thread #{t.inspect}"
145
143
  t.kill
146
144
  end
147
145
  begin
148
- Log.low "Join thread #{t.inspect}"
149
146
  t.join unless t == Thread.current
150
147
  rescue Aborted
151
148
  rescue Exception
@@ -157,6 +154,7 @@ module ConcurrentStream
157
154
  def abort_pids
158
155
  @pids.each do |pid|
159
156
  begin
157
+ Log.low "Killing PID #{pid} in ConcurrentStream #{filename}"
160
158
  Process.kill :INT, pid
161
159
  rescue Errno::ESRCH
162
160
  end
@@ -361,6 +361,7 @@ module Misc
361
361
  FileUtils.mkdir_p File.dirname(tmp_path) unless File.directory? File.dirname(tmp_path)
362
362
  FileUtils.rm_f tmp_path if File.exist? tmp_path
363
363
  begin
364
+
364
365
  case
365
366
  when block_given?
366
367
  File.open(tmp_path, 'wb', &block)
@@ -372,7 +373,7 @@ module Misc
372
373
  f.sync = true
373
374
  while block = content.read(BLOCK_SIZE)
374
375
  f.write block
375
- end
376
+ end
376
377
  end
377
378
  else
378
379
  File.open(tmp_path, 'wb') do |f| end
@@ -19,8 +19,7 @@ module TmpFile
19
19
  # up to +max+
20
20
  def self.random_name(s = "", max = 10000000)
21
21
  n = rand(max)
22
- s << n.to_s
23
- s
22
+ s + n.to_s
24
23
  end
25
24
 
26
25
  # Creates a random filename in the temporary directory
@@ -29,7 +28,8 @@ module TmpFile
29
28
  end
30
29
 
31
30
  def self.with_file(content = nil, erase = true, options = {})
32
- tmpfile = tmp_file
31
+ prefix = options[:prefix] || ""
32
+ tmpfile = tmp_file prefix
33
33
  if options[:extension]
34
34
  tmpfile += ".#{options[:extension]}"
35
35
  end
@@ -48,7 +48,8 @@ module TmpFile
48
48
  end
49
49
 
50
50
  def self.with_dir(erase = true, options = {})
51
- tmpdir = tmp_file
51
+ prefix = options[:prefix] || ""
52
+ tmpdir = tmp_file prefix
52
53
 
53
54
  FileUtils.mkdir_p tmpdir
54
55
 
@@ -399,7 +399,7 @@ class Step
399
399
  end
400
400
 
401
401
  def aborted?
402
- status == :aborted || nopid?
402
+ status == :aborted || (status != :noinfo && nopid?)
403
403
  end
404
404
 
405
405
  # {{{ INFO
data/share/Rlib/util.R CHANGED
@@ -499,9 +499,10 @@ rbbt.heatmap <- function(filename, data, width=500, height=500, take_log=FALSE,
499
499
  data = data[, colSums(is.na(data))==0]
500
500
  }
501
501
 
502
+ rbbt.require('pls')
502
503
  data = stdize(data)
503
504
 
504
- heatmap.2(data, margins = c(20,5), scale='column')
505
+ heatmap.2(data, scale='column', ...)
505
506
 
506
507
  dev.off();
507
508
  par(opar)
@@ -38,7 +38,11 @@ if options[:workdir]
38
38
  Workflow.workdir = options[:workdir]
39
39
  end
40
40
 
41
- options[:Port] ||= options[:port]
41
+ options[:Port] = options["port"]
42
+ options[:server] = options["server"]
43
+ options[:Host] = options["Host"]
44
+ options[:Bind = options["Bind"]
45
+
42
46
  options[:Host] ||= "0.0.0.0"
43
47
  options[:Bind] ||= "0.0.0.0"
44
48
 
@@ -17,6 +17,7 @@ Use - to read from STDIN
17
17
  -f--fields* Fields
18
18
  -t--type* Type
19
19
  -m--merge Merge from multiple rows
20
+ -z--zipped Assume data is zipped when merging (default is true)
20
21
  -s2--sep2* Second level separator. Default /[,|]\\s?/
21
22
  -h--help Print this help
22
23
 
@@ -34,6 +35,7 @@ excelfile = ARGV.first
34
35
 
35
36
  raise ParameterException, "No excel file given" if excelfile.nil?
36
37
 
38
+ options[:zipped] ||= true if options[:merge]
37
39
  require 'rbbt/tsv/excel'
38
40
  puts TSV.excel(excelfile, options).to_s
39
41
 
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.94
4
+ version: 5.21.95
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-08-14 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -503,7 +503,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
503
503
  version: '0'
504
504
  requirements: []
505
505
  rubyforge_project:
506
- rubygems_version: 2.6.12
506
+ rubygems_version: 2.6.13
507
507
  signing_key:
508
508
  specification_version: 4
509
509
  summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)