rbbt-util 5.40.4 → 5.40.5

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
  SHA256:
3
- metadata.gz: 0c086b1d2a4bfd64cc80729a4962b2ba04268b5745ae6c79b5d954fc5b15a7a9
4
- data.tar.gz: 8d0ee0a0942be2cf07259baed09d2c2feb98a67b314adc70bd0ac1e03ecba4f9
3
+ metadata.gz: bc59a09644d58c21eb59f643cd04bd50d4fc81a494f024cef8af1ea26197a0e7
4
+ data.tar.gz: 84c1669d61fce9e4a239ec7865aee04b67684f99911cc9e378b569517b819388
5
5
  SHA512:
6
- metadata.gz: 8ca4b7b1b59eb4546b9e1484fd397c687003389b406de77461da5aa3c773679a87533050c640c90feacc48f9bdadf1c565bcfe9727e8661b2440938ed3c69dbc
7
- data.tar.gz: 613f30647a8d317984e12a5618fe8d03ab94c3d4ca1acc8ee38460c8f67869c13e8dd83f3d1c4332e813a34802af55d6346f87d898863095ff12368c9f715ba6
6
+ metadata.gz: df0ae52fabfa8c84c0d4a18861912972ac44b347867580087842d1856d4558f7dd1d4e2b7d9b0b0ae23f766a7001516445662114e050c3054458190061caab5e
7
+ data.tar.gz: 3e5c396193a6423d7c8afbb381c623844bf457d0a34ef329b7bfe6ac29f6a13841f23b9ce7c3bb051fdeeb35a2e72bfed16279aff52fb3a0ff1484b1587bb841
@@ -359,7 +359,16 @@ module Path
359
359
  end
360
360
 
361
361
  def list
362
- Open.read(self.produce.find).split "\n"
362
+ begin
363
+ path = self.produce
364
+ rescue Resource::ResourceNotFound => e
365
+ begin
366
+ path = self.set_extension('list').produce
367
+ rescue Resource::ResourceNotFound
368
+ raise e
369
+ end
370
+ end
371
+ Open.read(path).split("\n")
363
372
  end
364
373
 
365
374
  def keys(field = 0, sep = "\t")
@@ -26,6 +26,7 @@ puts path.glob_all.collect{|p| File.directory?(p) ? p + "/" : p } * "\n"
26
26
  if original_path.located?
27
27
  paths = [original_path]
28
28
  else
29
+ path = Path.setup(path) unless Path === path
29
30
  paths = (path.directory? ? path.glob_all : path.find_all)
30
31
  end
31
32
 
@@ -165,7 +165,8 @@ module Workflow
165
165
  workflow, dep_task, options = dependency
166
166
 
167
167
  if override_dependencies[workflow.to_s] && value = override_dependencies[workflow.to_s][dep_task]
168
- overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
168
+ overriden = true if (inputs.nil? || ! inputs[:not_overriden]) && (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
169
+ #overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
169
170
  setup_override_dependency(value, workflow, dep_task)
170
171
  else
171
172
 
@@ -189,21 +190,23 @@ module Workflow
189
190
  job = workflow._job(dep_task, jobname, _inputs)
190
191
  ComputeDependency.setup(job, compute) if compute
191
192
 
192
- overriden = true if TrueClass === job.overriden && (options.nil? || ! options[:not_overriden])
193
+ overriden = true if Symbol === job.overriden? && (d.nil? || ! d[:not_overriden]) && (inputs.nil? || ! inputs[:not_overriden])
193
194
 
194
195
  job
195
196
  end
196
197
  when Step
197
198
  job = dependency
198
- overriden = true if TrueClass === job.overriden && (options.nil? || ! options[:not_overriden])
199
+ overriden = true if Symbol === job.overriden? && (d.nil? || ! d[:not_overriden]) && (inputs.nil? || ! inputs[:not_overriden])
199
200
  job
200
201
  when Symbol
201
202
  if override_dependencies[self.to_s] && value = override_dependencies[self.to_s][dependency]
202
- overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
203
+ overriden = true if (inputs.nil? || ! inputs[:not_overriden]) && (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
204
+ #overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
203
205
  setup_override_dependency(value, self, dependency)
204
206
  else
205
207
  job = _job(dependency, jobname, _inputs)
206
- overriden = true if TrueClass === job.overriden && (options.nil? || ! options[:not_overriden])
208
+ overriden = true if Symbol === job.overriden && (options.nil? || ! options[:not_overriden]) && (inputs.nil? || ! inputs[:not_overriden])
209
+
207
210
  job
208
211
  end
209
212
  when Proc
@@ -212,7 +215,8 @@ module Workflow
212
215
  wf, task_name, options = orig_dep
213
216
 
214
217
  if override_dependencies[wf.to_s] && value = override_dependencies[wf.to_s][task_name]
215
- overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
218
+ overriden = true if (inputs.nil? || ! inputs[:not_overriden]) && (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
219
+ #overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
216
220
  dep = setup_override_dependency(value, wf, task_name)
217
221
  else
218
222
 
@@ -243,7 +247,8 @@ module Workflow
243
247
  d[:task] ||= task_name
244
248
  _override_dependencies = override_dependencies.merge(override_dependencies(d[:inputs] || {}))
245
249
  d = if _override_dependencies[d[:workflow].to_s] && value = _override_dependencies[d[:workflow].to_s][d[:task]]
246
- overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
250
+ overriden = true if (inputs.nil? || ! inputs[:not_overriden]) && (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
251
+ #overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
247
252
  setup_override_dependency(value, d[:workflow], d[:task])
248
253
  else
249
254
  task_info = d[:workflow].task_info(d[:task])
@@ -251,7 +256,7 @@ module Workflow
251
256
  _inputs = assign_dep_inputs({}, options.merge(d[:inputs] || {}), real_dependencies, task_info)
252
257
  _jobname = d.include?(:jobname) ? d[:jobname] : jobname
253
258
  job = d[:workflow]._job(d[:task], _jobname, _inputs)
254
- overriden = true if TrueClass === job.overriden && (d.nil? || ! d[:not_overriden])
259
+ overriden = true if Symbol === job.overriden? && (d.nil? || ! d[:not_overriden]) && (inputs.nil? || ! inputs[:not_overriden])
255
260
  job
256
261
  end
257
262
  end
@@ -267,14 +272,15 @@ module Workflow
267
272
  dep[:workflow] ||= wf || self
268
273
  _override_dependencies = override_dependencies.merge(override_dependencies(dep[:inputs] || {}))
269
274
  if _override_dependencies[dep[:workflow].to_s] && value = _override_dependencies[dep[:workflow].to_s][dep[:task]]
270
- overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
275
+ overriden = true if (inputs.nil? || ! inputs[:not_overriden]) && (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
276
+ #overriden = true if (options.nil? || ! options[:not_overriden]) && ! unlocated_override?(value)
271
277
  setup_override_dependency(value, dep[:workflow], dep[:task])
272
278
  else
273
279
  task_info = (dep[:task] && dep[:workflow]) ? dep[:workflow].task_info(dep[:task]) : nil
274
280
  _inputs = assign_dep_inputs({}, dep[:inputs], real_dependencies, task_info)
275
281
  _jobname = dep.include?(:jobname) ? dep[:jobname] : jobname
276
282
  job = dep[:workflow]._job(dep[:task], _jobname, _inputs)
277
- overriden = true if TrueClass === job.overriden && (d.nil? || ! d[:not_overriden])
283
+ overriden = true if Symbol === job.overriden? && (d.nil? || ! d[:not_overriden]) && (inputs.nil? || ! inputs[:not_overriden])
278
284
  job
279
285
  end
280
286
  end
@@ -16,6 +16,17 @@ class Step
16
16
  end
17
17
  end
18
18
 
19
+ def relocated
20
+ if @relocated.nil?
21
+ if Open.exists?(info_file) and (info[:path] != path)
22
+ @relocated = true
23
+ else
24
+ @relocated = false
25
+ end
26
+ end
27
+ @relocated
28
+ end
29
+
19
30
  def self.serialize_info(info)
20
31
  info = info.clean_version if IndiferentHash === info
21
32
  INFO_SERIALIZER.dump(info)
@@ -48,7 +48,11 @@ class Step
48
48
  IndiferentHash.setup info_inputs
49
49
  @inputs = NamedArray.setup info_inputs.values_at(*task.inputs.collect{|name| name.to_s}), task.inputs
50
50
  else
51
- @inputs = NamedArray.setup info_inputs.values, info_inputs.keys
51
+ if Hash === info_inputs
52
+ @inputs = NamedArray.setup info_inputs.values, info_inputs.keys
53
+ else
54
+ @inputs = info_inputs
55
+ end
52
56
  end
53
57
  else
54
58
  nil
@@ -51,9 +51,6 @@ class Step
51
51
  @info_mutex = Mutex.new
52
52
  @inputs = inputs
53
53
  NamedArray.setup @inputs, task.inputs.collect{|s| s.to_s} if task and task.respond_to? :inputs and task.inputs
54
- if Open.exists?(info_file) and (info[:path] != path)
55
- @relocated = true
56
- end
57
54
  end
58
55
 
59
56
  def workflow
data/lib/rbbt/workflow.rb CHANGED
@@ -495,7 +495,8 @@ module Workflow
495
495
  end
496
496
  end
497
497
 
498
- overriden = true if dependencies.select{|d| d.overriden && d.clean_name != d.name }.any?
498
+ #overriden = true if dependencies.select{|d| d.overriden && d.clean_name != d.name }.any?
499
+ overriden = true if dependencies.select{|d| Symbol === d.overriden }.any?
499
500
 
500
501
  input_values = task.take_input_values(inputs)
501
502
  if real_inputs.empty? && Workflow::TAG != :inputs && ! overriden #&& ! dependencies.select{|d| d.overriden && d.clean_name != d.name }.any?
@@ -665,6 +666,7 @@ module Workflow
665
666
  step = Step.new path
666
667
  relocated = false
667
668
  dependencies = (step.info[:dependencies] || []).collect do |task,name,dep_path|
669
+ dep_path = task if dep_path.nil?
668
670
  if Open.exists?(dep_path) || Open.exists?(dep_path + '.info') || Open.remote?(dep_path) || Open.ssh?(dep_path)
669
671
  Workflow._load_step dep_path
670
672
  else
@@ -7,11 +7,12 @@ $0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_c
7
7
 
8
8
  options = SOPT.setup <<EOF
9
9
 
10
- Description
10
+ Write a Excel file with the contents of a TSV
11
11
 
12
- $ rbbt tsv write_excel [options] <filename.tsv|-> <filename.xls|filename.xlsx>
12
+ $ rbbt tsv write_excel [options] <filename.tsv|-> [<filename.xls|filename.xlsx>]
13
13
 
14
- Use - to read from STDIN
14
+ If no target file is specified it uses the same input files but replaces extension. Specifying
15
+ the extension of the excel file select the excel format to use.
15
16
 
16
17
  -k--key_field* Key field
17
18
  -f--fields* Fields
@@ -70,9 +70,14 @@ begin
70
70
  exit 0
71
71
  else
72
72
  if command == 'bootstrap'
73
- Log.info "No bootstrap for #{ workflow }, running examples instead"
74
- puts `rbbt workflow example #{ workflow }`
75
- exit 0
73
+ if wf.libdir["test_workflow.rb"].exists?
74
+ Log.info "No bootstrap for #{ workflow }, running test_workflow.rb instead"
75
+ CMD.cmd_log('ruby', wf.libdir["test_workflow.rb"].find)
76
+ else
77
+ Log.info "No bootstrap for #{ workflow }, running examples instead"
78
+ CMD.cmd_log("rbbt workflow example #{ workflow }")
79
+ exit 0
80
+ end
76
81
  end
77
82
 
78
83
  raise ParameterException, "Error: Command not understood: #{command}"
@@ -114,6 +114,7 @@ end
114
114
  if dependencies and dependencies.any?
115
115
  puts Log.color(:magenta, "Dependencies") << ": "
116
116
  dependencies.each do |name,task,file|
117
+ file = name if file.nil?
117
118
  puts " " << file
118
119
  end
119
120
  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.40.4
4
+ version: 5.40.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -584,7 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
584
584
  - !ruby/object:Gem::Version
585
585
  version: '0'
586
586
  requirements: []
587
- rubygems_version: 3.4.19
587
+ rubygems_version: 3.5.0.dev
588
588
  signing_key:
589
589
  specification_version: 4
590
590
  summary: Utilities for the Ruby Bioinformatics Toolkit (rbbt)