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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec2769ac8dcfb78a8e3b33cdf905f2b0e53e9340
4
- data.tar.gz: 9362e1f40b97de7451f0f4ed7467a7f386745128
3
+ metadata.gz: c98abc284aedb4105b8168c0860250a1acc2f3f8
4
+ data.tar.gz: 868baa16f1fe6f287f9b6ad793d14608fb0b49cb
5
5
  SHA512:
6
- metadata.gz: 5df33607c693b25c3a0ff547ef690be714f2fa568fb9fd2f8d39819cd6ab8166fbd69cc5f212f5514460693190f349c4c699215c786b9ddcf3d546805dff174b
7
- data.tar.gz: 53fdcaded28ebccbe7f88335e3448046300698554deba0bcf3e44b478ea131229128c2b2460f8db18e0ad3f67d83c425020c89bb22013c707a2c377a281937f2
6
+ metadata.gz: 23c3a24f663d611f2fa838b86c2231433b0c52cac8d8d7a3f4e4665f46b5421436e05a6c27b90fb3f16534dfd4efcf9280ba6f79104ec154ef155087824b3964
7
+ data.tar.gz: 2001725c848637abccf349964c8bcf16751849afb85898d6b67b90ed07b5878b19b1724a33d9ee4e41937946305557045b4bba0833a2d6a7db54e2825bf24c46
data/bin/rbbt CHANGED
@@ -75,6 +75,7 @@ if mem_dump = options.delete(:dump_mem)
75
75
  Rbbt.dump_memory(mem_dump, Symbol)
76
76
  end
77
77
 
78
+
78
79
  if options.delete :nostream
79
80
  ENV["RBBT_NO_STREAM"] = "true"
80
81
  end
@@ -1,7 +1,11 @@
1
1
  class KnowledgeBase
2
2
  def syndicate(name, kb)
3
3
  kb.all_databases.each do |database|
4
- db_name = [database, name] * "@"
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]
@@ -111,6 +111,7 @@ module TSV
111
111
  return index
112
112
  end
113
113
  rescue Exception
114
+ Log.exception $!
114
115
  Log.error "Exception reading identifier file: #{file.find}"
115
116
  end
116
117
  end
@@ -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
@@ -83,6 +83,7 @@ module R
83
83
 
84
84
  bin_path = File.join(ENV["R_HOME"], "bin/Rserve")
85
85
  cmd = bin_path + " " + args*" "
86
+ $stdout.reopen File.new('/dev/null', 'w')
86
87
  exec(ENV, cmd)
87
88
  end
88
89
  while not File.exists? pid_file
@@ -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*:-w--workflows*"
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
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.17.31
4
+ version: 5.17.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez