rbbt-util 5.21.130 → 5.21.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/accessor.rb +37 -4
- data/lib/rbbt/tsv/excel.rb +23 -5
- data/lib/rbbt/tsv/util.rb +1 -0
- data/lib/rbbt/util/misc/omics.rb +1 -1
- data/share/Rlib/svg.R +1 -1
- data/share/rbbt_commands/rsync +1 -2
- data/share/rbbt_commands/workflow/task +2 -2
- data/test/rbbt/tsv/test_accessor.rb +14 -0
- data/test/rbbt/util/test_misc.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30f68eea441653388fb59fd05ae206e5b120b8eb
|
4
|
+
data.tar.gz: 88a93f9598386c6605e086ce575c2d0ff31a3146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d21f9912e46073ec0c7593e15702be44445f9928405d70a5dd9c2d92c53d42cd0f04be8c9a33f9dd6dd29229ca4ec39a902cf3dc55682b15b7c9c081a5092c0
|
7
|
+
data.tar.gz: 22a459d7ed570054f06d3d33b9202ac577bded51a21c105669afa7e1d3cff160973a9f03bf3252f88518ade85418ba087430426f9fc5ecb3f3b7bcbdc9539c26
|
data/lib/rbbt/tsv/accessor.rb
CHANGED
@@ -574,7 +574,20 @@ module TSV
|
|
574
574
|
if keys
|
575
575
|
keys.each do |key|
|
576
576
|
if unmerge
|
577
|
-
|
577
|
+
value_list = self[key]
|
578
|
+
max = value_list.collect{|v| v.length}.max
|
579
|
+
|
580
|
+
if unmerge == :expand and max > 1
|
581
|
+
value_list = value_list.collect do |values|
|
582
|
+
if values.length == 1
|
583
|
+
[values.first] * max
|
584
|
+
else
|
585
|
+
values
|
586
|
+
end
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
Misc.zip_fields(value_list).each do |values|
|
578
591
|
dumper.add key, values
|
579
592
|
end
|
580
593
|
else
|
@@ -583,14 +596,26 @@ module TSV
|
|
583
596
|
end
|
584
597
|
else
|
585
598
|
with_unnamed do
|
586
|
-
each do |k,
|
599
|
+
each do |k,value_list|
|
587
600
|
|
588
601
|
if unmerge
|
589
|
-
|
602
|
+
max = value_list.collect{|v| v.length}.max
|
603
|
+
|
604
|
+
if unmerge == :expand and max > 1
|
605
|
+
value_list = value_list.collect do |values|
|
606
|
+
if values.length == 1
|
607
|
+
[values.first] * max
|
608
|
+
else
|
609
|
+
values
|
610
|
+
end
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
Misc.zip_fields(value_list).each do |values|
|
590
615
|
dumper.add k, values
|
591
616
|
end
|
592
617
|
else
|
593
|
-
dumper.add k,
|
618
|
+
dumper.add k, value_list
|
594
619
|
end
|
595
620
|
end
|
596
621
|
end
|
@@ -625,6 +650,14 @@ module TSV
|
|
625
650
|
str
|
626
651
|
end
|
627
652
|
|
653
|
+
def to_unmerged_s(keys = nil, no_options = false)
|
654
|
+
to_s keys, no_options, true
|
655
|
+
end
|
656
|
+
|
657
|
+
def to_unmerged_expanded_s(keys = nil, no_options = false)
|
658
|
+
to_s keys, no_options, :expand
|
659
|
+
end
|
660
|
+
|
628
661
|
def value_peek
|
629
662
|
peek = {}
|
630
663
|
i = 0
|
data/lib/rbbt/tsv/excel.rb
CHANGED
@@ -100,9 +100,18 @@ module TSV
|
|
100
100
|
text = Misc.process_options options, :text
|
101
101
|
|
102
102
|
header = true unless header == false
|
103
|
-
sheet ||= 0
|
104
|
-
|
105
|
-
|
103
|
+
sheet ||= "0"
|
104
|
+
|
105
|
+
workbook = Spreadsheet.open Open.open(file)
|
106
|
+
|
107
|
+
if sheet && sheet.to_s =~ /^\d+$/
|
108
|
+
sheet = workbook.worksheets.collect{|s| s.sheet_name }[sheet.to_i]
|
109
|
+
end
|
110
|
+
sheet_name = sheet
|
111
|
+
Log.debug "Opening LSX #{file} sheet #{ sheet_name }"
|
112
|
+
|
113
|
+
TmpFile.with_file :extension => Misc.sanitize_filename(sheet_name) do |filename|
|
114
|
+
|
106
115
|
sheet = workbook.worksheet sheet
|
107
116
|
|
108
117
|
rows = []
|
@@ -156,8 +165,17 @@ module TSV
|
|
156
165
|
text = Misc.process_options options, :text
|
157
166
|
|
158
167
|
header = true unless header == false
|
159
|
-
|
160
|
-
|
168
|
+
|
169
|
+
sheet ||= "0"
|
170
|
+
workbook = RubyXL::Parser.parse file
|
171
|
+
if sheet && sheet =~ /^\d+$/
|
172
|
+
sheet = workbook.worksheets.collect{|s| s.sheet_name }[sheet.to_i]
|
173
|
+
end
|
174
|
+
sheet_name = sheet
|
175
|
+
Log.debug "Opening XLSX #{file} sheet #{ sheet_name }"
|
176
|
+
|
177
|
+
TmpFile.with_file :extension => Misc.sanitize_filename(sheet_name) do |filename|
|
178
|
+
|
161
179
|
sheet = sheet ? workbook[sheet] : workbook.worksheets.first
|
162
180
|
|
163
181
|
rows = []
|
data/lib/rbbt/tsv/util.rb
CHANGED
data/lib/rbbt/util/misc/omics.rb
CHANGED
data/share/Rlib/svg.R
CHANGED
@@ -19,7 +19,7 @@ rbbt.SVG.extract <- function(plot, size=NULL, prefix=NULL, ...){
|
|
19
19
|
base.size = 10 * (7/size)
|
20
20
|
resolution = 72 * (size/7)
|
21
21
|
|
22
|
-
if (length(plot$theme) == 0) plot <- plot +
|
22
|
+
if (length(plot$theme) == 0) plot <- plot + theme_light();
|
23
23
|
if (length(plot$theme$text) == 0) plot <- plot + theme(text = element_text(size=base.size));
|
24
24
|
|
25
25
|
plot$theme$text$size = base.size
|
data/share/rbbt_commands/rsync
CHANGED
@@ -106,7 +106,7 @@ def fix_options(workflow, task, job_options)
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
when :array
|
109
|
-
if input_options[name] and input_options[name][:stream] and String === value and Misc.is_filename?
|
109
|
+
if input_options[name] and input_options[name][:stream] and String === value and Misc.is_filename?(value) and not input_options[name][:nofile]
|
110
110
|
get_value_stream(value)
|
111
111
|
elsif input_options[name] and input_options[name][:stream] and value == "-"
|
112
112
|
STDIN
|
@@ -119,7 +119,7 @@ def fix_options(workflow, task, job_options)
|
|
119
119
|
when value == '-'
|
120
120
|
array_separator ||= "\n"
|
121
121
|
STDIN.read
|
122
|
-
when (String === value and File.exist?(value))
|
122
|
+
when (String === value and File.exist?(value) and not input_options[name][:nofile])
|
123
123
|
array_separator ||= "\n"
|
124
124
|
Open.read(value)
|
125
125
|
else
|
@@ -222,6 +222,20 @@ row2 aa|aa|AA|AA b1|b2|B1|B2 Id1|Id1|Id2|Id2
|
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
+
def test_to_s_unmerge_expand
|
226
|
+
content =<<-EOF
|
227
|
+
#Id ValueA ValueB OtherID
|
228
|
+
row1 a|A b|B Id1
|
229
|
+
row2 aa|aa|AA|AA b1|b2|B1|B2 Id2
|
230
|
+
EOF
|
231
|
+
|
232
|
+
TmpFile.with_file(content) do |filename|
|
233
|
+
tsv = TSV.open(filename, :sep => /\s+/)
|
234
|
+
text = tsv.to_s(nil, false, :expand)
|
235
|
+
assert text =~ /row2\taa\tb2\tId2/
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
225
239
|
def test_remove_duplicates
|
226
240
|
content =<<-EOF
|
227
241
|
#Id ValueA ValueB OtherID
|
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -428,6 +428,10 @@ eum fugiat quo voluptas nulla pariatur?"
|
|
428
428
|
assert_equal [737407, ["-----", "-----G", "-----GTTAAT"]], Misc.correct_vcf_mutation(737406, "GTTAAT", "G,GG,GGTTAAT")
|
429
429
|
end
|
430
430
|
|
431
|
+
def test_mutation_to_ensembl_format
|
432
|
+
assert_equal Misc.mutation_to_ensembl_format("1:100:T", "A"), %w(1 100 100 A/T)
|
433
|
+
end
|
434
|
+
|
431
435
|
def test_fingerprint
|
432
436
|
assert_equal '{:a=>1}', Misc.fingerprint({:a => 1})
|
433
437
|
end
|
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.
|
4
|
+
version: 5.21.131
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|