Class: Bio::Conduit::Process
- Inherits:
-
Object
- Object
- Bio::Conduit::Process
- Defined in:
- lib/bio/conduit/process.rb
Instance Attribute Summary collapse
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add_running_step(stepname) ⇒ Object
-
#initialize(filename) ⇒ Process
constructor
A new instance of Process.
- #run_steps(steps) ⇒ Object
Constructor Details
#initialize(filename) ⇒ Process
Returns a new instance of Process.
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/bio/conduit/process.rb', line 103 def initialize(filename) yaml = YAML::load(File.open(filename)) @steps = {} @name = yaml['pipeline'] @resources = yaml['resources'] @runninglist = [] yaml['steps'].each_pair do |name, detail| @resources[name] = "../#{name}" @steps[name] = Bio::Conduit::Step.new(name, detail, @resources) end end |
Instance Attribute Details
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
101 102 103 |
# File 'lib/bio/conduit/process.rb', line 101 def steps @steps end |
Instance Method Details
#[](name) ⇒ Object
115 116 117 |
# File 'lib/bio/conduit/process.rb', line 115 def [](name) @steps[name] end |
#add_running_step(stepname) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/bio/conduit/process.rb', line 119 def add_running_step(stepname) step = self[stepname] self.add_running_step(step.dependency) if step.dependence? if !@runninglist.include?(stepname) @runninglist.push(stepname) end end |
#run_steps(steps) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/bio/conduit/process.rb', line 127 def run_steps(steps) @steps.keys.each do |name| self.add_running_step(name) if steps == nil || steps.include?(name) end combinestep = nil @runninglist.each do |stepname| if combinestep combinestep = combinestep + self[stepname] else combinestep = self[stepname] end end return combinestep end |