rbbt-util 5.14.4 → 5.14.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
  SHA1:
3
- metadata.gz: de7c9170a1eadbc1ee1117b6f1930ad96d94b63b
4
- data.tar.gz: 7763cbe7760e56fc1faeba8d117ec7deddd25f88
3
+ metadata.gz: f1fa2f550e7cac4d0ccdfe338c6a5012288bbdff
4
+ data.tar.gz: af4d638b5f65f37eac8279b3f6be21f87fd71b65
5
5
  SHA512:
6
- metadata.gz: e082be066b8392739566438b2c8ce7c8064aae3a29622702af4e34980fafeb53f566c6f80472d2d892862f84cef03b6138462ebe4f33aa97a9941734b97bbf75
7
- data.tar.gz: 71e7400483d8ba1bc92bc804ccd96f9bd2ea0ddd906fa63e7599bfa2cdea3ec433a4a5ca95ccb147d4616e5693c7032d2708dc174ea54f0bee286dbf6ab618a7
6
+ metadata.gz: b4695a330e812a45fc5f1bdcf0bf36752b49161b408022da3f37f64133e2c9ba5b7ed4754861ef189f588601e81f5a5f2d32008d464ed3bc98846a066dd3171e
7
+ data.tar.gz: 4475cf87c50919517a7a56e32e9d4fbb653b65adf9fe7e3935f8db24562d72ae2d4e5ea991bba6c1db441aa643abf11e0e6e4cacc3974d54422745b742d034e2
@@ -260,7 +260,7 @@ module Annotation
260
260
  annotations.each_with_index do |name,i|
261
261
  value = values[i]
262
262
 
263
- value = value.split("|") if String === value and value.index "|"
263
+ value = value.split("|") if String === value and value.include? "|"
264
264
 
265
265
  annotation_values[name] = value
266
266
  end
@@ -123,6 +123,10 @@ module Path
123
123
  sub('{SUBPATH}', subpath).
124
124
  sub('{PATH}', self).
125
125
  sub('{LIBDIR}', libdir) #, @pkgdir, @resource, @search_paths
126
+
127
+ path = path + '.gz' if File.exists? path + '.gz'
128
+ path = path + '.bgz' if File.exists? path + '.bgz'
129
+
126
130
  self.annotate path
127
131
  end
128
132
  end
@@ -150,19 +154,21 @@ module Path
150
154
  self.find
151
155
  end
152
156
 
157
+ def _exists?
158
+ Open.exists? self.find.to_s
159
+ end
160
+
153
161
  def exists?
154
162
  begin
155
163
  self.produce
156
- File.exists? self.find
164
+ _exists?
157
165
  rescue Exception
158
166
  false
159
167
  end
160
168
  end
161
169
 
162
170
  def produce(force = false)
163
- path = self.find
164
-
165
- return self if Open.exists?(path.to_s) and not force
171
+ return self if _exists? and not force
166
172
 
167
173
  raise "No resource defined to produce file: #{ self }" if resource.nil?
168
174
 
@@ -33,17 +33,20 @@ module Bgzf
33
33
 
34
34
  def _index
35
35
  @_index ||= begin
36
- index = []
37
- pos = 0
38
- while true do
39
- blockdata_offset = tell
40
- block = read_block
41
- break unless block
42
- index << [pos, blockdata_offset]
43
- pos += block.length
44
- end
45
- @block_cache_size = Math.log(index.length).to_i + 1
46
- index
36
+ index = Persist.persist("BGZF index" + filename.sub(/.bgz$/,''), :marshal, :dir => Rbbt.var.bgzf_index) do
37
+ index = []
38
+ pos = 0
39
+ while true do
40
+ blockdata_offset = tell
41
+ block = read_block
42
+ break unless block
43
+ index << [pos, blockdata_offset]
44
+ pos += block.length
45
+ end
46
+ index
47
+ end
48
+ @block_cache_size = Math.log(index.length).to_i + 1
49
+ index
47
50
  end
48
51
  end
49
52
 
@@ -131,6 +134,10 @@ module Bgzf
131
134
  end
132
135
  end
133
136
 
137
+ def getc
138
+ read(1)
139
+ end
140
+
134
141
  def gets
135
142
  str = nil
136
143
  current = @data_offset
@@ -449,16 +449,16 @@ module Workflow
449
449
  end
450
450
 
451
451
  def task_from_dep(dep)
452
- case dep
453
- when Array
454
- dep.first.tasks[dep.last]
455
- when String
456
- tasks[dep.to_sym]
457
- when Symbol
458
- tasks[dep.to_sym]
459
- else
460
- raise "Unknown dependency: #{Misc.fingerprint dep}"
461
- end
452
+ task = case dep
453
+ when Array
454
+ dep.first.tasks[dep[1]]
455
+ when String
456
+ tasks[dep.to_sym]
457
+ when Symbol
458
+ tasks[dep.to_sym]
459
+ end
460
+ raise "Unknown dependency: #{Misc.fingerprint dep}" if task.nil?
461
+ task
462
462
  end
463
463
 
464
464
  def rec_inputs(taskname)
@@ -467,28 +467,28 @@ module Workflow
467
467
 
468
468
  def rec_input_defaults(taskname)
469
469
  [taskname].concat(rec_dependencies(taskname)).inject(IndiferentHash.setup({})){|acc, tn|
470
- new = (Array === tn ? tn.first.tasks[tn.last.to_sym] : tasks[tn.to_sym]).input_defaults
470
+ new = (Array === tn ? tn.first.tasks[tn[1].to_sym] : tasks[tn.to_sym]).input_defaults
471
471
  acc = new.merge(acc)
472
472
  }.tap{|h| IndiferentHash.setup(h)}
473
473
  end
474
474
 
475
475
  def rec_input_types(taskname)
476
476
  [taskname].concat(rec_dependencies(taskname)).inject({}){|acc, tn|
477
- new = (Array === tn ? tn.first.tasks[tn.last.to_sym] : tasks[tn.to_sym]).input_types
477
+ new = (Array === tn ? tn.first.tasks[tn[1].to_sym] : tasks[tn.to_sym]).input_types
478
478
  acc = new.merge(acc)
479
479
  }.tap{|h| IndiferentHash.setup(h)}
480
480
  end
481
481
 
482
482
  def rec_input_descriptions(taskname)
483
483
  [taskname].concat(rec_dependencies(taskname)).inject({}){|acc, tn|
484
- new = (Array === tn ? tn.first.tasks[tn.last.to_sym] : tasks[tn.to_sym]).input_descriptions
484
+ new = (Array === tn ? tn.first.tasks[tn[1].to_sym] : tasks[tn.to_sym]).input_descriptions
485
485
  acc = new.merge(acc)
486
486
  }.tap{|h| IndiferentHash.setup(h)}
487
487
  end
488
488
 
489
489
  def rec_input_options(taskname)
490
490
  [taskname].concat(rec_dependencies(taskname)).inject({}){|acc, tn|
491
- new = (Array === tn ? tn.first.tasks[tn.last.to_sym] : tasks[tn.to_sym]).input_options
491
+ new = (Array === tn ? tn.first.tasks[tn[1].to_sym] : tasks[tn.to_sym]).input_options
492
492
  acc = new.merge(acc)
493
493
  }.tap{|h| IndiferentHash.setup(h)}
494
494
  end
@@ -498,7 +498,18 @@ module Workflow
498
498
  dependencies.each do |dependency|
499
499
  real_dependencies << case dependency
500
500
  when Array
501
- dependency.first.job(dependency.last, jobname, inputs)
501
+ inputs = inputs.dup
502
+ options = dependency.last if Hash === dependency.last
503
+ options.each{|i,v|
504
+ case v
505
+ when Symbol
506
+ rec_dependency = real_dependencies.select{|d| d.task.name == v }.first
507
+ inputs[i] = rec_dependency
508
+ else
509
+ inputs[i] = v
510
+ end
511
+ } if options
512
+ dependency.first.job(dependency[1], jobname, inputs)
502
513
  when Step
503
514
  dependency
504
515
  when Symbol
@@ -36,7 +36,7 @@ module Workflow
36
36
 
37
37
  def dep(*dependency_list, &block)
38
38
  @dependencies ||= []
39
- if Array === dependency_list and Module === dependency_list.first
39
+ if Module === dependency_list.first or Hash === dependency_list.last
40
40
  @dependencies << dependency_list
41
41
  else
42
42
  @dependency_list ||= []
@@ -31,9 +31,11 @@ module Task
31
31
  deps.each do |dep|
32
32
  next if seen.include? dep.name
33
33
  seen << dep.name
34
+ new_inputs = (dep.inputs - self.inputs)
35
+ next unless new_inputs.any?
34
36
  puts " #{Log.color :yellow, dep.name.to_s}:"
35
37
  puts
36
- puts SOPT.input_doc((dep.inputs - self.inputs), dep.input_types, dep.input_descriptions, dep.input_defaults, true)
38
+ puts SOPT.input_doc(new_inputs, dep.input_types, dep.input_descriptions, dep.input_defaults, true)
37
39
  puts
38
40
  end
39
41
  end
@@ -77,7 +79,7 @@ module Workflow
77
79
  task = self.tasks[task_name]
78
80
  end
79
81
 
80
- dependencies = self.rec_dependencies(task_name).collect{|dep_name| Array === dep_name ? dep_name.first.tasks[dep_name.last.to_sym] : self.tasks[dep_name.to_sym]}
82
+ dependencies = self.rec_dependencies(task_name).collect{|dep_name| Array === dep_name ? dep_name.first.tasks[dep_name[1].to_sym] : self.tasks[dep_name.to_sym]}
81
83
 
82
84
  task.doc(dependencies)
83
85
 
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.14.4
4
+ version: 5.14.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: 2014-07-10 00:00:00.000000000 Z
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake