rbbt-util 5.17.31 → 5.17.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt +1 -0
- data/lib/rbbt/knowledge_base/syndicate.rb +5 -1
- data/lib/rbbt/tsv/change_id.rb +1 -0
- data/lib/rbbt/tsv/manipulate.rb +10 -1
- data/lib/rbbt/util/R/eval.rb +1 -0
- data/share/rbbt_commands/app/template +1 -1
- data/share/rbbt_commands/workflow/task +18 -0
- data/test/rbbt/entity/test_identifiers.rb +33 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98abc284aedb4105b8168c0860250a1acc2f3f8
|
4
|
+
data.tar.gz: 868baa16f1fe6f287f9b6ad793d14608fb0b49cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23c3a24f663d611f2fa838b86c2231433b0c52cac8d8d7a3f4e4665f46b5421436e05a6c27b90fb3f16534dfd4efcf9280ba6f79104ec154ef155087824b3964
|
7
|
+
data.tar.gz: 2001725c848637abccf349964c8bcf16751849afb85898d6b67b90ed07b5878b19b1724a33d9ee4e41937946305557045b4bba0833a2d6a7db54e2825bf24c46
|
data/bin/rbbt
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
class KnowledgeBase
|
2
2
|
def syndicate(name, kb)
|
3
3
|
kb.all_databases.each do |database|
|
4
|
-
|
4
|
+
if name.nil?
|
5
|
+
db_name = database
|
6
|
+
else
|
7
|
+
db_name = [database, name] * "@"
|
8
|
+
end
|
5
9
|
file, kb_options = kb.registry[database]
|
6
10
|
options = {}
|
7
11
|
options[:entity_options] = kb_options[:entity_options]
|
data/lib/rbbt/tsv/change_id.rb
CHANGED
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -21,6 +21,14 @@ module TSV
|
|
21
21
|
[key, new]
|
22
22
|
end
|
23
23
|
|
24
|
+
def process_reorder_single(key, values)
|
25
|
+
new_key = @new_key_field == :key ? key : values
|
26
|
+
new_value = @new_fields.collect{|field| field == :key ? key : values }.first
|
27
|
+
return [new_key, new_value]
|
28
|
+
[ [values[@new_key_field]],
|
29
|
+
@new_fields.collect{|field| field == :key ? key : values[field] }]
|
30
|
+
end
|
31
|
+
|
24
32
|
def process_reorder_list(key, values)
|
25
33
|
[ [values[@new_key_field]],
|
26
34
|
@new_fields.collect{|field| field == :key ? key : values[field] }]
|
@@ -141,6 +149,8 @@ module TSV
|
|
141
149
|
end
|
142
150
|
when :flat
|
143
151
|
self.instance_eval do alias process process_reorder_flat end
|
152
|
+
when :single
|
153
|
+
self.instance_eval do alias process process_reorder_single end
|
144
154
|
else
|
145
155
|
self.instance_eval do alias process process_reorder_list end
|
146
156
|
end
|
@@ -561,7 +571,6 @@ module TSV
|
|
561
571
|
field_pos = identify_field field
|
562
572
|
|
563
573
|
through do |key, values|
|
564
|
-
|
565
574
|
case
|
566
575
|
when type == :single
|
567
576
|
field_values = values
|
data/lib/rbbt/util/R/eval.rb
CHANGED
@@ -13,7 +13,7 @@ require 'rbbt/rest/knowledge_base'
|
|
13
13
|
require 'rbbt/rest/helpers'
|
14
14
|
require 'rbbt/rest/web_tool'
|
15
15
|
|
16
|
-
options = SOPT.get "-e--environment*:-p--port*:-s--server*:-b--bind*:-e--environment*:-R--RServe_session*:--finder:--views
|
16
|
+
options = SOPT.get "-e--environment*:-p--port*:-s--server*:-b--bind*:-e--environment*:-R--RServe_session*:--finder:--views*"
|
17
17
|
|
18
18
|
template = ARGV.first
|
19
19
|
|
@@ -187,6 +187,8 @@ the job dependencies recursively.
|
|
187
187
|
--load_inputs* Load inputs from a directory
|
188
188
|
--info Show the job info:
|
189
189
|
--provenance Report the jobs provenance:
|
190
|
+
-W--workflows* Load a list of workflows
|
191
|
+
-R--requires* Require a list of files
|
190
192
|
EOF
|
191
193
|
|
192
194
|
workflow = ARGV.shift
|
@@ -216,6 +218,22 @@ end
|
|
216
218
|
|
217
219
|
workflow = Workflow.require_workflow workflow
|
218
220
|
|
221
|
+
if options[:workflows]
|
222
|
+
require 'rbbt/workflow'
|
223
|
+
workflows = options[:workflows].split(',')
|
224
|
+
workflows.each do |workflow|
|
225
|
+
workflow.strip!
|
226
|
+
Workflow.require_workflow workflow
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
if options[:requires]
|
231
|
+
requires = options[:requires].split(',')
|
232
|
+
requires.each do |req|
|
233
|
+
req.strip!
|
234
|
+
require req
|
235
|
+
end
|
236
|
+
end
|
219
237
|
# Set task
|
220
238
|
namespace = nil, nil
|
221
239
|
|
@@ -36,5 +36,37 @@ class TestEntityIdentifiers < Test::Unit::TestCase
|
|
36
36
|
assert_match "hsa", Gene.setup("ENSG00000141510", "Ensembl Gene ID", "Hsa/feb2014").to("KEGG Gene ID")
|
37
37
|
assert_match "TP53", Gene.setup("ENSG00000141510", "Ensembl Gene ID", "Hsa/feb2014").to("KEGG Gene ID").to(:name)
|
38
38
|
end
|
39
|
-
end
|
40
39
|
|
40
|
+
def ___test_complex
|
41
|
+
|
42
|
+
file = Path.setup('/home/mvazquezg/git/workflows/PanCancer/share/network/gene_sets/CORUM_protein_complexes.gmt')
|
43
|
+
name = File.basename(file).sub(/\.gmt$/,'')
|
44
|
+
organism = "Hsa/feb2014"
|
45
|
+
key_field = "#{ name } Pathway ID"
|
46
|
+
description_field = "#{name} Pathway Description"
|
47
|
+
description_file = file.find + '.identifiers'
|
48
|
+
tsv = TSV.open(file, :fix => Proc.new{|l| p=l.split"\t"; [p[0], p[1], p[2..-1]*"|"]*"\t"})
|
49
|
+
tsv.namespace = organism
|
50
|
+
tsv.unnamed = true
|
51
|
+
gene_field, count = Organism.guess_id(organism, tsv.values.collect{|l| l.last}.flatten.uniq )
|
52
|
+
tsv.key_field = key_field
|
53
|
+
tsv.fields = [description_field, gene_field]
|
54
|
+
descriptions = tsv.slice(description_field)
|
55
|
+
Open.write(description_file, descriptions.to_single.to_s) #unless File.exists? description_file
|
56
|
+
values = tsv.slice(gene_field)
|
57
|
+
values.identifiers = description_file
|
58
|
+
|
59
|
+
mod = Module.new
|
60
|
+
mod_name = Misc.camel_case(key_field.gsub(/\s+/,'_').sub(/_ID$/,''))
|
61
|
+
Object.const_set(mod_name, mod)
|
62
|
+
mod.instance_eval do
|
63
|
+
extend Entity
|
64
|
+
add_identifiers Path.setup(description_file), key_field, description_field
|
65
|
+
|
66
|
+
annotation :format
|
67
|
+
end
|
68
|
+
entity = "CORUM:6052"
|
69
|
+
mod.setup(entity, :format => key_field)
|
70
|
+
puts entity.name
|
71
|
+
end
|
72
|
+
end
|