rbbt-util 5.9.1 → 5.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt +5 -1
- data/lib/rbbt/tsv.rb +0 -6
- data/lib/rbbt/tsv/attach.rb +6 -0
- data/lib/rbbt/tsv/parallel/traverse.rb +29 -1
- data/lib/rbbt/tsv/parser.rb +1 -1
- data/lib/rbbt/workflow/doc.rb +1 -0
- data/lib/rbbt/workflow/usage.rb +3 -1
- data/share/rbbt_commands/file_server/add +18 -1
- data/test/rbbt/tsv/parallel/test_traverse.rb +14 -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: 74f82edf975ef1ad0c05363e915c57fa2ae1ec43
|
4
|
+
data.tar.gz: f42669bd1035c8734f8425f317ce30f8a0aedbaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c8e0ca5a067f5cc2dc79dea4eaba8ebe369509ac5f23b24740ebcdddc80cf9bd2b7ee78b19359f8b5382ff27a40c5a92285f0450919e87b6209935c20996f60
|
7
|
+
data.tar.gz: d617993ba70c9cb43a5aa9ba176da9994db0493aafc484831b68bb7c1804f34ffff3a7f88c2342d21d3b06cfd4a5db08014e033cd90915669e6cd7b56625f18f
|
data/bin/rbbt
CHANGED
@@ -16,11 +16,15 @@ $ rbbt <command> <subcommand> ... -a --arg1 --arg2='value' --arg3 'another-value
|
|
16
16
|
--locate_file #{Log.color :yellow, "Report the location of the script instead of executing it"}
|
17
17
|
EOF
|
18
18
|
|
19
|
-
|
19
|
+
if options[:nocolor]
|
20
|
+
Log.nocolor = true
|
21
|
+
end
|
22
|
+
|
20
23
|
locate = options.delete :locate_file
|
21
24
|
|
22
25
|
if options[:log]
|
23
26
|
Log.severity = options[:log].to_i
|
27
|
+
SOPT.input_descriptions.each{|t,d| d.replace Log.uncolor(d) }
|
24
28
|
end
|
25
29
|
|
26
30
|
if options[:command_dir]
|
data/lib/rbbt/tsv.rb
CHANGED
@@ -159,10 +159,4 @@ module TSV
|
|
159
159
|
|
160
160
|
data
|
161
161
|
end
|
162
|
-
|
163
|
-
def self.traverse_old(file, options, &block)
|
164
|
-
return file.through(options[:key_field], options[:fields], &block) if TSV === file
|
165
|
-
|
166
|
-
TSV::Parser.traverse(TSV.get_stream(file), options, &block)
|
167
|
-
end
|
168
162
|
end
|
data/lib/rbbt/tsv/attach.rb
CHANGED
@@ -14,6 +14,20 @@ module TSV
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.traverse_hash(hash, options = {}, &block)
|
18
|
+
callback = Misc.process_options options, :callback
|
19
|
+
|
20
|
+
if callback
|
21
|
+
hash.each do |k,v|
|
22
|
+
callback.call yield(k,v)
|
23
|
+
end
|
24
|
+
else
|
25
|
+
hash.each do |k,v|
|
26
|
+
yield k,v
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
17
31
|
def self.traverse_array(array, options = {}, &block)
|
18
32
|
callback = Misc.process_options options, :callback
|
19
33
|
|
@@ -38,6 +52,8 @@ module TSV
|
|
38
52
|
case obj
|
39
53
|
when TSV
|
40
54
|
traverse_tsv(obj, options, &block)
|
55
|
+
when Hash
|
56
|
+
traverse_hash(obj, options, &block)
|
41
57
|
when IO
|
42
58
|
callback = Misc.process_options options, :callback
|
43
59
|
if callback
|
@@ -48,6 +64,10 @@ module TSV
|
|
48
64
|
else
|
49
65
|
TSV::Parser.traverse(obj, options, &block)
|
50
66
|
end
|
67
|
+
when Path
|
68
|
+
obj.open do |stream|
|
69
|
+
traverse_obj(stream, options, &block)
|
70
|
+
end
|
51
71
|
when Array
|
52
72
|
traverse_array(obj, options, &block)
|
53
73
|
else
|
@@ -102,12 +122,20 @@ module TSV
|
|
102
122
|
def self.store_into(obj, value)
|
103
123
|
case obj
|
104
124
|
when Hash
|
125
|
+
return if value.nil?
|
105
126
|
if Hash === value
|
106
|
-
obj.
|
127
|
+
if TSV === obj and obj.type == :double
|
128
|
+
obj.merge_zip value
|
129
|
+
else
|
130
|
+
obj.merge! value
|
131
|
+
end
|
107
132
|
else
|
108
133
|
k,v = value
|
109
134
|
obj[k] = v
|
110
135
|
end
|
136
|
+
when IO
|
137
|
+
return if value.nil?
|
138
|
+
obj << value
|
111
139
|
else
|
112
140
|
obj << value
|
113
141
|
end
|
data/lib/rbbt/tsv/parser.rb
CHANGED
data/lib/rbbt/workflow/doc.rb
CHANGED
@@ -46,6 +46,7 @@ module Workflow
|
|
46
46
|
def load_documentation
|
47
47
|
@documentation = Workflow.parse_workflow_doc documentation_markdown
|
48
48
|
@documentation[:tasks].each do |task, description|
|
49
|
+
raise "Documentation for #{ task }, but not a #{ self.to_s } task" unless tasks.include? task.to_sym
|
49
50
|
tasks[task.to_sym].description = description
|
50
51
|
end
|
51
52
|
end
|
data/lib/rbbt/workflow/usage.rb
CHANGED
@@ -58,7 +58,9 @@ module Workflow
|
|
58
58
|
puts
|
59
59
|
|
60
60
|
tasks.each do |name,task|
|
61
|
-
|
61
|
+
description = task.description || ""
|
62
|
+
description = description.split("\n\n").first
|
63
|
+
puts Misc.format_definition_list_item(name.to_s, description, 80, 30, :yellow)
|
62
64
|
end
|
63
65
|
|
64
66
|
else
|
@@ -1,6 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'rbbt'
|
3
|
+
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
5
|
+
|
6
|
+
$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands
|
7
|
+
|
8
|
+
options = SOPT.setup <<EOF
|
9
|
+
Sets a file server for a particular resource
|
10
|
+
|
11
|
+
$ rbbt file_server add <Resource> <URL>
|
12
|
+
|
13
|
+
It sets the entry in #{Rbbt.etc.file_servers.find}
|
14
|
+
|
15
|
+
E.g. rbbt file_server add Organism http://<server>:<port>
|
16
|
+
|
17
|
+
-h--help Print this help
|
18
|
+
|
19
|
+
EOF
|
20
|
+
rbbt_usage and exit 0 if options[:help]
|
4
21
|
|
5
22
|
resource, url = ARGV
|
6
23
|
|
@@ -66,6 +66,20 @@ class TestTSVParallelThrough < Test::Unit::TestCase
|
|
66
66
|
assert_equal head, res.keys.compact.sort.length
|
67
67
|
end
|
68
68
|
|
69
|
+
def test_traverse_stream_cpus
|
70
|
+
require 'rbbt/sources/organism'
|
71
|
+
|
72
|
+
head = 100
|
73
|
+
|
74
|
+
tsv = Organism.identifiers("Hsa")
|
75
|
+
res = {}
|
76
|
+
TSV.traverse tsv, :head => head, :cpus => 5, :into => res do |k,v|
|
77
|
+
[k,v]
|
78
|
+
end
|
79
|
+
|
80
|
+
assert_equal head, res.keys.compact.sort.length
|
81
|
+
end
|
82
|
+
|
69
83
|
def test_traverse_stream_keys
|
70
84
|
require 'rbbt/sources/organism'
|
71
85
|
|
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.9.
|
4
|
+
version: 5.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
318
|
version: '0'
|
319
319
|
requirements: []
|
320
320
|
rubyforge_project:
|
321
|
-
rubygems_version: 2.2.
|
321
|
+
rubygems_version: 2.2.2
|
322
322
|
signing_key:
|
323
323
|
specification_version: 4
|
324
324
|
summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)
|