rbbt-util 5.26.82 → 5.26.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/stream.rb +11 -3
- data/lib/rbbt/util/R.rb +1 -0
- data/lib/rbbt/util/R/plot.rb +2 -6
- data/lib/rbbt/util/config.rb +1 -1
- data/lib/rbbt/workflow.rb +1 -1
- data/share/Rlib/util.R +29 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6ab0538fa770f31569dcc29a7c10f69c2baa671faa5d544bc29d67e44188acb
|
4
|
+
data.tar.gz: fe65f02a82226b98bff48fc39c862d892d8ffaf1fa68a7b101d7bf5befb67db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 756e42e468afcf1d93d4a9616ab2f5ab4eeb1ad6511d91aeb1b447f79ef2f00a076601eb02eec17bddd20576f9824ae34a5db5d913043e17a97758f4bbca84f6
|
7
|
+
data.tar.gz: cbd3625ce98062162ef323a10a3e991e60947e883171a1c63af25368af2ee076d622ade4321172a59503744acf47db055ec48003a9fa7ed54d12376f5609eca2
|
data/lib/rbbt/tsv/stream.rb
CHANGED
@@ -21,7 +21,7 @@ module TSV
|
|
21
21
|
|
22
22
|
def self.paste_streams(streams, options = {})
|
23
23
|
options = Misc.add_defaults options, :sep => "\t", :sort => true
|
24
|
-
sort, sep, preamble, header, same_fields, fix_flat, all_match = Misc.process_options options, :sort, :sep, :preamble, :header, :same_fields, :fix_flat, :all_match
|
24
|
+
sort, sep, preamble, header, same_fields, fix_flat, all_match, field_prefix = Misc.process_options options, :sort, :sep, :preamble, :header, :same_fields, :fix_flat, :all_match, :field_prefix
|
25
25
|
|
26
26
|
out = Misc.open_pipe do |sin|
|
27
27
|
|
@@ -57,12 +57,20 @@ module TSV
|
|
57
57
|
|
58
58
|
streams = streams.collect do |stream|
|
59
59
|
parser = TSV::Parser.new stream, options.dup
|
60
|
+
sfields = parser.fields
|
61
|
+
|
62
|
+
if field_prefix
|
63
|
+
index = streams.index stream
|
64
|
+
prefix = field_prefix[index]
|
65
|
+
|
66
|
+
sfields = sfields.collect{|f| [prefix, f] * ":" }
|
67
|
+
end
|
60
68
|
|
61
69
|
lines << parser.first_line
|
62
70
|
empty << stream if parser.first_line.nil?
|
63
71
|
key_fields << parser.key_field
|
64
|
-
fields <<
|
65
|
-
sizes <<
|
72
|
+
fields << sfields
|
73
|
+
sizes << sfields.length if sfields
|
66
74
|
input_options << parser.options
|
67
75
|
preambles << parser.preamble if preamble and not parser.preamble.empty?
|
68
76
|
|
data/lib/rbbt/util/R.rb
CHANGED
@@ -40,6 +40,7 @@ source('#{UTIL}');
|
|
40
40
|
Log.debug{"R Script:\n#{ cmd }"}
|
41
41
|
|
42
42
|
if monitor
|
43
|
+
#io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true))
|
43
44
|
io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true))
|
44
45
|
while line = io.gets
|
45
46
|
case monitor
|
data/lib/rbbt/util/R/plot.rb
CHANGED
@@ -220,16 +220,12 @@ data = NULL
|
|
220
220
|
options[:R_open] ||= "colClasses=c('character'," + field_classes * ", " + ')' if field_classes.any?
|
221
221
|
|
222
222
|
data.R <<-EOF, :plot, options
|
223
|
-
|
224
|
-
{ #{script} }
|
225
|
-
dev.off()
|
223
|
+
rbbt.png_plot("#{ filename }", width=#{ width }, height = #{ height }, function(){ #{script} })
|
226
224
|
data = NULL
|
227
225
|
EOF
|
228
226
|
else
|
229
227
|
R.run <<-EOF, :plot, options
|
230
|
-
|
231
|
-
{ #{script} }
|
232
|
-
dev.off()
|
228
|
+
rbbt.png_plot("#{ filename }", width=#{ width }, height = #{ height }, function(){ #{script} })
|
233
229
|
EOF
|
234
230
|
end
|
235
231
|
end
|
data/lib/rbbt/util/config.rb
CHANGED
@@ -110,7 +110,7 @@ module Rbbt::Config
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
value = priorities.empty? ? default : priorities.collect{|p| p }.sort_by{|p,v| p}.first.last.
|
113
|
+
value = priorities.empty? ? default : priorities.collect{|p| p }.sort_by{|p,v| p}.first.last.first
|
114
114
|
value = false if value == 'false'
|
115
115
|
|
116
116
|
Log.debug "Value #{value.inspect} for config key '#{ key }': #{tokens * ", "}"
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -422,7 +422,7 @@ module Workflow
|
|
422
422
|
task_inputs = task_info[:inputs]
|
423
423
|
persist_inputs = inputs.values_at(*task_inputs)
|
424
424
|
persist_inputs += inputs.values_at(*inputs.keys.select{|k| String === k && k.include?("#") }.sort)
|
425
|
-
Persist.memory("STEP", :taskname => taskname, :jobname => jobname, :inputs => persist_inputs, :repo => step_cache) do
|
425
|
+
Persist.memory("STEP", :workflow => self.to_s, :taskname => taskname, :jobname => jobname, :inputs => persist_inputs, :repo => step_cache) do
|
426
426
|
__job(taskname, jobname, inputs)
|
427
427
|
end
|
428
428
|
end
|
data/share/Rlib/util.R
CHANGED
@@ -563,14 +563,22 @@ rbbt.get.modes <- function(x,bw = NULL,spar = NULL) {
|
|
563
563
|
#{{{ PLOTS
|
564
564
|
|
565
565
|
rbbt.png_plot <- function(filename, p, width=500, height=500, ...){
|
566
|
-
png(filename=filename, width=width, height=height, ...);
|
567
|
-
|
566
|
+
png(filename=filename, width=width, height=height, type='cairo', ...);
|
567
|
+
if (is.function(p)) {
|
568
|
+
p()
|
569
|
+
}else{
|
570
|
+
eval(parse(text=p));
|
571
|
+
}
|
568
572
|
dev.off()
|
569
573
|
}
|
570
574
|
|
571
575
|
rbbt.tiff_plot <- function(filename, p, width=500, height=500, ...){
|
572
576
|
tiff(filename=filename, width=width, height=height, ...);
|
573
|
-
|
577
|
+
if (is.function(p)) {
|
578
|
+
p()
|
579
|
+
}else{
|
580
|
+
eval(parse(text=p));
|
581
|
+
}
|
574
582
|
dev.off()
|
575
583
|
}
|
576
584
|
|
@@ -713,9 +721,21 @@ rbbt.plot.matrix <- function(x, ...){
|
|
713
721
|
layout(1);
|
714
722
|
}
|
715
723
|
|
724
|
+
rbbt.plot.set_colors <- function(size, set="Set1"){
|
725
|
+
rbbt.require('RColorBrewer')
|
726
|
+
return(brewer.pal(size, set))
|
727
|
+
}
|
728
|
+
|
716
729
|
# Adapted from: https://rstudio-pubs-static.s3.amazonaws.com/13301_6641d73cfac741a59c0a851feb99e98b.html
|
717
|
-
rbbt.plot.venn <- function(data, a, ...) {
|
730
|
+
rbbt.plot.venn <- function(data, a=NULL, category=NULL, fill=NULL, ...) {
|
718
731
|
rbbt.require('VennDiagram')
|
732
|
+
|
733
|
+
if (is.null(a)){
|
734
|
+
a = names(data);
|
735
|
+
category = a;
|
736
|
+
fill=rbbt.plot.set_colors(dim(data)[2], "Set3")
|
737
|
+
}
|
738
|
+
|
719
739
|
group.matches <- function(data, fields) {
|
720
740
|
sub = data
|
721
741
|
for (i in 1:length(fields)) {
|
@@ -725,20 +745,20 @@ rbbt.plot.venn <- function(data, a, ...) {
|
|
725
745
|
}
|
726
746
|
|
727
747
|
if (length(a) == 1) {
|
728
|
-
out <- draw.single.venn(group.matches(data, a), ...)
|
748
|
+
out <- draw.single.venn(group.matches(data, a), category=category, fill=fill, ...)
|
729
749
|
}
|
730
750
|
if (length(a) == 2) {
|
731
|
-
out <- draw.pairwise.venn(group.matches(data, a[1]), group.matches(data, a[2]), group.matches(data, a[1:2]), ...)
|
751
|
+
out <- draw.pairwise.venn(group.matches(data, a[1]), group.matches(data, a[2]), group.matches(data, a[1:2]), category=category, fill=fill, ...)
|
732
752
|
}
|
733
753
|
if (length(a) == 3) {
|
734
754
|
out <- draw.triple.venn(group.matches(data, a[1]), group.matches(data, a[2]), group.matches(data, a[3]), group.matches(data, a[1:2]),
|
735
|
-
group.matches(data, a[2:3]), group.matches(data, a[c(1, 3)]), group.matches(data, a), ...)
|
755
|
+
group.matches(data, a[2:3]), group.matches(data, a[c(1, 3)]), group.matches(data, a), category=category, fill=fill, ...)
|
736
756
|
}
|
737
757
|
if (length(a) == 4) {
|
738
758
|
out <- draw.quad.venn(group.matches(data, a[1]), group.matches(data, a[2]), group.matches(data, a[3]), group.matches(data, a[4]),
|
739
759
|
group.matches(data, a[1:2]), group.matches(data, a[c(1, 3)]), group.matches(data, a[c(1, 4)]), group.matches(data, a[2:3]),
|
740
760
|
group.matches(data, a[c(2, 4)]), group.matches(data, a[3:4]), group.matches(data, a[1:3]), group.matches(data, a[c(1, 2,
|
741
|
-
4)]), group.matches(data, a[c(1, 3, 4)]), group.matches(data, a[2:4]), group.matches(data, a), ...)
|
761
|
+
4)]), group.matches(data, a[c(1, 3, 4)]), group.matches(data, a[2:4]), group.matches(data, a), category=category, fill=fill, ...)
|
742
762
|
}
|
743
763
|
if (length(a) == 5) {
|
744
764
|
out <- draw.quintuple.venn(
|
@@ -755,7 +775,7 @@ rbbt.plot.venn <- function(data, a, ...) {
|
|
755
775
|
group.matches(data, a[c(3, 4, 5)]),
|
756
776
|
group.matches(data, a[c(1, 2, 3, 4)]),group.matches(data, a[c(1, 2, 3, 5)]),group.matches(data, a[c(1, 2, 4, 5)]),group.matches(data, a[c(1, 3, 4, 5)]),group.matches(data, a[c(2, 3, 4, 5)]),
|
757
777
|
group.matches(data, a),
|
758
|
-
...)
|
778
|
+
category=category, fill=fill, ...)
|
759
779
|
|
760
780
|
}
|
761
781
|
if (!exists("out"))
|
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.26.
|
4
|
+
version: 5.26.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|