rbbt-util 5.21.42 → 5.21.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/R/plot.rb +73 -29
- data/lib/rbbt/workflow/accessor.rb +1 -1
- data/lib/rbbt/workflow/step.rb +5 -1
- metadata +62 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10eea8e63f986c9ce28afb952ca203a7553da870
|
4
|
+
data.tar.gz: fb6e78a215cf9763eac45fa1cdaf5dfa6785e7d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae836057fdbf7f61c5cbfbec7f9138a933193cec13f2f091b956004f84fe8ee119b94958af79b72cb76457fe778851512418f85f74201a46208680083a8e3514
|
7
|
+
data.tar.gz: fb166d2973f256978e1e7cc77a611c431a9acd21a4e581acf55de1cd959353724db6a5d414842fd6983ddeac6b743d9c55a42995e833b40af5f287c8af5c8150
|
data/lib/rbbt/util/R/plot.rb
CHANGED
@@ -121,49 +121,93 @@ data = NULL
|
|
121
121
|
EOF
|
122
122
|
end
|
123
123
|
|
124
|
-
def self.plot(filename, data, script = nil, width = nil, height = nil, options = {})
|
124
|
+
def self.plot(filename, data = nil, script = nil, width = nil, height = nil, options = {}, &block)
|
125
125
|
width ||= 200
|
126
126
|
height ||= 200
|
127
127
|
values = []
|
128
128
|
|
129
|
-
|
129
|
+
script ||= ""
|
130
|
+
if block_given?
|
131
|
+
s = StringIO.new
|
132
|
+
class << s
|
133
|
+
def method_missing(name, *args)
|
134
|
+
name = name.to_s
|
135
|
+
if name[-1] == '='
|
136
|
+
arg = args.first
|
137
|
+
value = if String === arg
|
138
|
+
arg
|
139
|
+
else
|
140
|
+
R.ruby2R arg
|
141
|
+
end
|
142
|
+
add("" << name[0..-2] << "=" << value)
|
143
|
+
else
|
144
|
+
args_strs = []
|
145
|
+
args.each do |arg|
|
146
|
+
value = if String === arg
|
147
|
+
arg
|
148
|
+
else
|
149
|
+
R.ruby2R arg
|
150
|
+
end
|
151
|
+
args_strs << value
|
152
|
+
end
|
153
|
+
add("" << name << "(" << args_strs * ", " << ")")
|
154
|
+
end
|
155
|
+
end
|
130
156
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
157
|
+
def add(line)
|
158
|
+
self.write line << "\n"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
block.call(s)
|
162
|
+
s.rewind
|
163
|
+
script << "\n" << s.read
|
136
164
|
end
|
165
|
+
sources = [:plot, options[:source]].flatten.compact
|
166
|
+
|
167
|
+
if data
|
168
|
+
data.each do |k,v|
|
169
|
+
v = Array === v ? v : [v]
|
170
|
+
next if v == "NA" or v.nil? or v.include? "NA" or v.include? nil
|
171
|
+
values = v
|
172
|
+
break
|
173
|
+
end
|
137
174
|
|
138
|
-
|
175
|
+
values = [values] unless values.nil? or Array === values
|
139
176
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
"'numeric'"
|
146
|
-
when String
|
147
|
-
if v.strip =~ /^[-+]?[\d\.]+$/
|
177
|
+
field_classes = values.collect do |v|
|
178
|
+
case v
|
179
|
+
when FalseClass, TrueClass
|
180
|
+
"'logical'"
|
181
|
+
when Fixnum, Float
|
148
182
|
"'numeric'"
|
183
|
+
when String
|
184
|
+
if v.strip =~ /^[-+]?[\d\.]+$/
|
185
|
+
"'numeric'"
|
186
|
+
else
|
187
|
+
"'character'"
|
188
|
+
end
|
189
|
+
when Symbol
|
190
|
+
"'factor'"
|
149
191
|
else
|
150
|
-
"
|
192
|
+
":NA"
|
151
193
|
end
|
152
|
-
when Symbol
|
153
|
-
"'factor'"
|
154
|
-
else
|
155
|
-
":NA"
|
156
194
|
end
|
157
|
-
end
|
158
195
|
|
159
|
-
|
196
|
+
options[:R_open] ||= "colClasses=c('character'," + field_classes * ", " + ')' if field_classes.any?
|
160
197
|
|
161
|
-
|
162
|
-
png("#{ filename }", #{ width }, #{ height })
|
163
|
-
{ #{script} }
|
164
|
-
dev.off()
|
165
|
-
data = NULL
|
166
|
-
|
198
|
+
data.R <<-EOF, :plot, options
|
199
|
+
png("#{ filename }", #{ width }, #{ height })
|
200
|
+
{ #{script} }
|
201
|
+
dev.off()
|
202
|
+
data = NULL
|
203
|
+
EOF
|
204
|
+
else
|
205
|
+
R.run <<-EOF, :plot, options
|
206
|
+
png("#{ filename }", #{ width }, #{ height })
|
207
|
+
{ #{script} }
|
208
|
+
dev.off()
|
209
|
+
EOF
|
210
|
+
end
|
167
211
|
end
|
168
212
|
end
|
169
213
|
end
|
@@ -350,7 +350,7 @@ class Step
|
|
350
350
|
end
|
351
351
|
|
352
352
|
def dirty?
|
353
|
-
rec_dependencies.collect{|dependency| dependency.path unless dependency.error? and not dependency.recoverable_error? }.compact.uniq.reject{|path| not Path === path or path.exists?}.any?
|
353
|
+
rec_dependencies.collect{|dependency| dependency.path unless dependency.error? and not dependency.recoverable_error? }.compact.uniq.reject{|path| not (Path === path) or path.exists?}.any?
|
354
354
|
end
|
355
355
|
|
356
356
|
def done?
|
data/lib/rbbt/workflow/step.rb
CHANGED
@@ -221,7 +221,11 @@ class Step
|
|
221
221
|
end
|
222
222
|
|
223
223
|
def clean
|
224
|
-
|
224
|
+
status = " "
|
225
|
+
status << "dirty" if dirty?
|
226
|
+
status << "not running" if not done? and not running?
|
227
|
+
status.strip
|
228
|
+
Log.medium "Cleaning step: #{path}#{status}"
|
225
229
|
abort if not done? and running?
|
226
230
|
Step.clean(path)
|
227
231
|
self
|
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.21.
|
4
|
+
version: 5.21.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
@@ -487,82 +487,82 @@ signing_key:
|
|
487
487
|
specification_version: 4
|
488
488
|
summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
|
489
489
|
test_files:
|
490
|
-
- test/
|
490
|
+
- test/test_helper.rb
|
491
491
|
- test/rbbt/resource/test_path.rb
|
492
|
-
- test/rbbt/
|
493
|
-
- test/rbbt/
|
494
|
-
- test/rbbt/
|
495
|
-
- test/rbbt/
|
496
|
-
- test/rbbt/
|
497
|
-
- test/rbbt/util/
|
492
|
+
- test/rbbt/association/test_item.rb
|
493
|
+
- test/rbbt/association/test_database.rb
|
494
|
+
- test/rbbt/association/test_open.rb
|
495
|
+
- test/rbbt/association/test_index.rb
|
496
|
+
- test/rbbt/association/test_util.rb
|
497
|
+
- test/rbbt/util/test_concurrency.rb
|
498
498
|
- test/rbbt/util/test_log.rb
|
499
|
+
- test/rbbt/util/test_chain_methods.rb
|
500
|
+
- test/rbbt/util/test_simpleopt.rb
|
501
|
+
- test/rbbt/util/simpleopt/test_parse.rb
|
502
|
+
- test/rbbt/util/simpleopt/test_get.rb
|
503
|
+
- test/rbbt/util/simpleopt/test_setup.rb
|
504
|
+
- test/rbbt/util/test_cmd.rb
|
505
|
+
- test/rbbt/util/test_semaphore.rb
|
506
|
+
- test/rbbt/util/concurrency/test_threads.rb
|
507
|
+
- test/rbbt/util/concurrency/processes/test_socket.rb
|
508
|
+
- test/rbbt/util/concurrency/test_processes.rb
|
509
|
+
- test/rbbt/util/test_tmpfile.rb
|
499
510
|
- test/rbbt/util/test_open.rb
|
511
|
+
- test/rbbt/util/test_filecache.rb
|
512
|
+
- test/rbbt/util/R/test_eval.rb
|
513
|
+
- test/rbbt/util/R/test_model.rb
|
514
|
+
- test/rbbt/util/test_simpleDSL.rb
|
515
|
+
- test/rbbt/util/log/test_progress.rb
|
516
|
+
- test/rbbt/util/test_colorize.rb
|
517
|
+
- test/rbbt/util/test_R.rb
|
500
518
|
- test/rbbt/util/misc/test_lock.rb
|
501
|
-
- test/rbbt/util/misc/test_multipart_payload.rb
|
502
|
-
- test/rbbt/util/misc/test_bgzf.rb
|
503
519
|
- test/rbbt/util/misc/test_pipes.rb
|
520
|
+
- test/rbbt/util/misc/test_bgzf.rb
|
504
521
|
- test/rbbt/util/misc/test_omics.rb
|
505
|
-
- test/rbbt/util/
|
506
|
-
- test/rbbt/util/test_R.rb
|
507
|
-
- test/rbbt/util/log/test_progress.rb
|
508
|
-
- test/rbbt/util/test_colorize.rb
|
509
|
-
- test/rbbt/util/test_simpleopt.rb
|
522
|
+
- test/rbbt/util/misc/test_multipart_payload.rb
|
510
523
|
- test/rbbt/util/test_excel2tsv.rb
|
511
|
-
- test/rbbt/util/test_filecache.rb
|
512
|
-
- test/rbbt/util/concurrency/test_processes.rb
|
513
|
-
- test/rbbt/util/concurrency/test_threads.rb
|
514
|
-
- test/rbbt/util/concurrency/processes/test_socket.rb
|
515
|
-
- test/rbbt/util/test_semaphore.rb
|
516
524
|
- test/rbbt/util/test_misc.rb
|
517
|
-
- test/rbbt/util/test_tmpfile.rb
|
518
|
-
- test/rbbt/util/R/test_model.rb
|
519
|
-
- test/rbbt/util/R/test_eval.rb
|
520
|
-
- test/rbbt/test_packed_index.rb
|
521
|
-
- test/rbbt/entity/test_identifiers.rb
|
522
|
-
- test/rbbt/test_association.rb
|
523
|
-
- test/rbbt/knowledge_base/test_traverse.rb
|
524
|
-
- test/rbbt/knowledge_base/test_registry.rb
|
525
|
-
- test/rbbt/knowledge_base/test_entity.rb
|
526
|
-
- test/rbbt/knowledge_base/test_enrichment.rb
|
527
|
-
- test/rbbt/knowledge_base/test_syndicate.rb
|
528
|
-
- test/rbbt/knowledge_base/test_query.rb
|
529
|
-
- test/rbbt/test_resource.rb
|
530
525
|
- test/rbbt/test_entity.rb
|
531
|
-
- test/rbbt/test_knowledge_base.rb
|
532
|
-
- test/rbbt/annotations/test_util.rb
|
533
|
-
- test/rbbt/association/test_index.rb
|
534
|
-
- test/rbbt/association/test_item.rb
|
535
|
-
- test/rbbt/association/test_open.rb
|
536
|
-
- test/rbbt/association/test_util.rb
|
537
|
-
- test/rbbt/association/test_database.rb
|
538
|
-
- test/rbbt/test_tsv.rb
|
539
526
|
- test/rbbt/workflow/step/test_dependencies.rb
|
540
|
-
- test/rbbt/workflow/test_task.rb
|
541
|
-
- test/rbbt/workflow/test_step.rb
|
542
527
|
- test/rbbt/workflow/test_doc.rb
|
543
|
-
- test/rbbt/
|
544
|
-
- test/rbbt/
|
545
|
-
- test/rbbt/
|
546
|
-
- test/rbbt/
|
547
|
-
- test/rbbt/
|
548
|
-
- test/rbbt/
|
549
|
-
- test/rbbt/persist/tsv/test_sharder.rb
|
550
|
-
- test/rbbt/persist/tsv/test_cdb.rb
|
551
|
-
- test/rbbt/persist/tsv/test_tokyocabinet.rb
|
552
|
-
- test/rbbt/persist/tsv/test_leveldb.rb
|
553
|
-
- test/rbbt/tsv/test_field_index.rb
|
528
|
+
- test/rbbt/workflow/test_step.rb
|
529
|
+
- test/rbbt/workflow/test_task.rb
|
530
|
+
- test/rbbt/test_association.rb
|
531
|
+
- test/rbbt/test_knowledge_base.rb
|
532
|
+
- test/rbbt/tsv/parallel/test_traverse.rb
|
533
|
+
- test/rbbt/tsv/parallel/test_through.rb
|
554
534
|
- test/rbbt/tsv/test_parallel.rb
|
555
|
-
- test/rbbt/tsv/
|
556
|
-
- test/rbbt/tsv/test_matrix.rb
|
535
|
+
- test/rbbt/tsv/test_accessor.rb
|
557
536
|
- test/rbbt/tsv/test_change_id.rb
|
558
|
-
- test/rbbt/tsv/test_parser.rb
|
559
537
|
- test/rbbt/tsv/test_stream.rb
|
560
|
-
- test/rbbt/tsv/test_util.rb
|
561
|
-
- test/rbbt/tsv/test_accessor.rb
|
562
538
|
- test/rbbt/tsv/test_filter.rb
|
539
|
+
- test/rbbt/tsv/test_matrix.rb
|
563
540
|
- test/rbbt/tsv/test_attach.rb
|
564
541
|
- test/rbbt/tsv/test_manipulate.rb
|
565
|
-
- test/rbbt/tsv/
|
566
|
-
- test/rbbt/tsv/
|
542
|
+
- test/rbbt/tsv/test_field_index.rb
|
543
|
+
- test/rbbt/tsv/test_index.rb
|
544
|
+
- test/rbbt/tsv/test_util.rb
|
545
|
+
- test/rbbt/tsv/test_parser.rb
|
546
|
+
- test/rbbt/test_packed_index.rb
|
547
|
+
- test/rbbt/test_persist.rb
|
567
548
|
- test/rbbt/test_fix_width_table.rb
|
568
|
-
- test/
|
549
|
+
- test/rbbt/knowledge_base/test_traverse.rb
|
550
|
+
- test/rbbt/knowledge_base/test_entity.rb
|
551
|
+
- test/rbbt/knowledge_base/test_query.rb
|
552
|
+
- test/rbbt/knowledge_base/test_enrichment.rb
|
553
|
+
- test/rbbt/knowledge_base/test_syndicate.rb
|
554
|
+
- test/rbbt/knowledge_base/test_registry.rb
|
555
|
+
- test/rbbt/entity/test_identifiers.rb
|
556
|
+
- test/rbbt/test_monitor.rb
|
557
|
+
- test/rbbt/test_workflow.rb
|
558
|
+
- test/rbbt/test_annotations.rb
|
559
|
+
- test/rbbt/annotations/test_util.rb
|
560
|
+
- test/rbbt/test_resource.rb
|
561
|
+
- test/rbbt/persist/tsv/test_tokyocabinet.rb
|
562
|
+
- test/rbbt/persist/tsv/test_kyotocabinet.rb
|
563
|
+
- test/rbbt/persist/tsv/test_lmdb.rb
|
564
|
+
- test/rbbt/persist/tsv/test_leveldb.rb
|
565
|
+
- test/rbbt/persist/tsv/test_cdb.rb
|
566
|
+
- test/rbbt/persist/tsv/test_sharder.rb
|
567
|
+
- test/rbbt/persist/test_tsv.rb
|
568
|
+
- test/rbbt/test_tsv.rb
|