rbbt-util 5.17.77 → 5.17.78
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/association/database.rb +1 -1
- data/lib/rbbt/tsv/attach.rb +24 -1
- data/lib/rbbt/tsv/parser.rb +4 -3
- data/lib/rbbt/tsv/util.rb +8 -3
- data/lib/rbbt/util/misc/omics.rb +18 -4
- 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: 449421ec50d68a1e7d718c4c81a5a764be546877
|
|
4
|
+
data.tar.gz: 43a60da2015d8a802c79c88d051dab6a4dfb59c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41591d6fb40e8402e33a9dad54e5b758b59055b7e7cf062af116933c19428eea3385ff2650bdb10a556f69de719aae4e599cdde77fe672d665f96857234ed585
|
|
7
|
+
data.tar.gz: 9e68f594e322108c7bf4d6e05fcfa7996d00fa62af40ba4c1b8b578723f8ca995e7f0166a4caa5ec7320cd5fe64afb625ab2c88e80c752931e715e1a698a7d80
|
|
@@ -140,7 +140,7 @@ module Association
|
|
|
140
140
|
|
|
141
141
|
def self.database(file, options = {})
|
|
142
142
|
database = case file
|
|
143
|
-
when Step
|
|
143
|
+
when (defined? Step and Step)
|
|
144
144
|
file.clean if file.error? or file.aborted? or file.dirty?
|
|
145
145
|
file.run(true) unless file.done? or file.started?
|
|
146
146
|
file.join unless file.done?
|
data/lib/rbbt/tsv/attach.rb
CHANGED
|
@@ -176,7 +176,7 @@ module TSV
|
|
|
176
176
|
|
|
177
177
|
def attach(other, options = {})
|
|
178
178
|
options = Misc.add_defaults options, :in_namespace => false, :persist_input => true
|
|
179
|
-
fields, one2one = Misc.process_options options, :fields, :one2one
|
|
179
|
+
fields, one2one, complete = Misc.process_options options, :fields, :one2one, :complete
|
|
180
180
|
in_namespace = options[:in_namespace]
|
|
181
181
|
|
|
182
182
|
unless TSV === other
|
|
@@ -195,6 +195,29 @@ module TSV
|
|
|
195
195
|
other_filename = other.respond_to?(:filename) ? other.filename : other.inspect
|
|
196
196
|
Log.low("Attaching fields:#{Misc.fingerprint fields } from #{other_filename}.")
|
|
197
197
|
|
|
198
|
+
if complete
|
|
199
|
+
fill = TrueClass === complete ? nil : complete
|
|
200
|
+
missing = other.keys - self.keys
|
|
201
|
+
case type
|
|
202
|
+
when :single
|
|
203
|
+
missing.each do |k|
|
|
204
|
+
self[k] = nil
|
|
205
|
+
end
|
|
206
|
+
when :list
|
|
207
|
+
missing.each do |k|
|
|
208
|
+
self[k] = [nil] * field_length
|
|
209
|
+
end
|
|
210
|
+
when :double
|
|
211
|
+
missing.each do |k|
|
|
212
|
+
self[k] = [[]] * field_length
|
|
213
|
+
end
|
|
214
|
+
when :flat
|
|
215
|
+
missing.each do |k|
|
|
216
|
+
self[k] = []
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
198
221
|
same_key = true
|
|
199
222
|
begin
|
|
200
223
|
case
|
data/lib/rbbt/tsv/parser.rb
CHANGED
|
@@ -25,7 +25,7 @@ module TSV
|
|
|
25
25
|
|
|
26
26
|
# Process options line
|
|
27
27
|
|
|
28
|
-
if line and line =~ /^#{@header_hash}: (.*)/
|
|
28
|
+
if line and (String === @header_hash and line =~ /^#{@header_hash}: (.*)/)
|
|
29
29
|
options = Misc.string2hash $1.chomp
|
|
30
30
|
line = stream.gets
|
|
31
31
|
line = Misc.fixutf8 line.chomp if line
|
|
@@ -38,15 +38,16 @@ module TSV
|
|
|
38
38
|
# Process fields line
|
|
39
39
|
|
|
40
40
|
preamble << line if line
|
|
41
|
-
while line and Misc.fixutf8(line) =~ /^#{@header_hash}/
|
|
41
|
+
while line and (TrueClass === @header_hash or (String === @header_hash and Misc.fixutf8(line) =~ /^#{@header_hash}/ ))
|
|
42
42
|
@fields = line.split(@sep)
|
|
43
43
|
@key_field = @fields.shift
|
|
44
|
-
@key_field = @key_field[(0 + header_hash.length)..-1]
|
|
44
|
+
@key_field = @key_field[(0 + header_hash.length)..-1] if String === @header_hash
|
|
45
45
|
|
|
46
46
|
#Thread.pass while IO.select([stream], nil, nil, 1).nil? if IO === stream
|
|
47
47
|
line = (@header_hash != "" ? stream.gets : nil)
|
|
48
48
|
line = Misc.fixutf8 line.chomp if line
|
|
49
49
|
preamble << line if line
|
|
50
|
+
@header_hash = false if TrueClass === @header_hash
|
|
50
51
|
end
|
|
51
52
|
|
|
52
53
|
@preamble = preamble[0..-3] * "\n"
|
data/lib/rbbt/tsv/util.rb
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
require 'rbbt/resource/path'
|
|
2
2
|
module TSV
|
|
3
3
|
|
|
4
|
+
def self.guess_id(identifier_file, values, options = {})
|
|
5
|
+
field_matches = TSV.field_match_counts(identifier_file, values, options)
|
|
6
|
+
field_matches.sort_by{|field, count| count.to_i}.last
|
|
7
|
+
end
|
|
8
|
+
|
|
4
9
|
def self.reorder_stream(stream, positions, sep = "\t")
|
|
5
10
|
Misc.open_pipe do |sin|
|
|
6
11
|
line = stream.gets
|
|
@@ -50,7 +55,7 @@ module TSV
|
|
|
50
55
|
|
|
51
56
|
filename = TSV === file ? file.filename : file
|
|
52
57
|
path = Persist.persist filename, :string, persist_options.merge(:no_load => true) do
|
|
53
|
-
tsv = TSV === file ? file : TSV.open(file)
|
|
58
|
+
tsv = TSV === file ? file : TSV.open(file, options)
|
|
54
59
|
|
|
55
60
|
text = ""
|
|
56
61
|
fields = nil
|
|
@@ -64,8 +69,8 @@ module TSV
|
|
|
64
69
|
text
|
|
65
70
|
end
|
|
66
71
|
|
|
67
|
-
TmpFile.with_file(values.uniq * "\n") do |value_file|
|
|
68
|
-
cmd = "cat '#{ path }' | sed 's/\\t/\\tHEADERNOMATCH/' | grep -w -F -f '#{ value_file }' |
|
|
72
|
+
TmpFile.with_file(values.uniq * "\n", false) do |value_file|
|
|
73
|
+
cmd = "cat '#{ path }' | sed 's/\\t/\\tHEADERNOMATCH/' | grep -w -F -f '#{ value_file }' | sed 's/HEADERNOMATCH//' |sort -u|cut -f 2 |sort|uniq -c|sed 's/^ *//;s/ /\t/'"
|
|
69
74
|
begin
|
|
70
75
|
TSV.open(CMD.cmd(cmd), :key_field => 1, :type => :single, :cast => :to_i)
|
|
71
76
|
rescue
|
data/lib/rbbt/util/misc/omics.rb
CHANGED
|
@@ -145,8 +145,15 @@ module Misc
|
|
|
145
145
|
when (ref.length == 1 and m.length == 1)
|
|
146
146
|
m
|
|
147
147
|
else
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
if ref == '-'
|
|
149
|
+
res = '+' + m
|
|
150
|
+
else
|
|
151
|
+
res = '-' * ref.length
|
|
152
|
+
res << m unless m == '-'
|
|
153
|
+
end
|
|
154
|
+
Log.debug{"Non-standard annotation: #{[ref, m]} (#{ muts }) => #{ res }"}
|
|
155
|
+
|
|
156
|
+
res
|
|
150
157
|
end
|
|
151
158
|
end
|
|
152
159
|
|
|
@@ -173,8 +180,15 @@ module Misc
|
|
|
173
180
|
when (ref.length == 1 and m.length == 1)
|
|
174
181
|
m
|
|
175
182
|
else
|
|
176
|
-
|
|
177
|
-
|
|
183
|
+
if ref == '-'
|
|
184
|
+
res = '+' + m
|
|
185
|
+
else
|
|
186
|
+
res = '-' * ref.length
|
|
187
|
+
res << m unless m == '-'
|
|
188
|
+
end
|
|
189
|
+
Log.debug{"Non-standard annotation: #{[ref, m]} (#{ muts }) => #{ res }"}
|
|
190
|
+
|
|
191
|
+
res
|
|
178
192
|
end
|
|
179
193
|
end
|
|
180
194
|
|
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.17.
|
|
4
|
+
version: 5.17.78
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miguel Vazquez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|