Class: CycleController
- Inherits:
-
Object
- Object
- CycleController
- Defined in:
- lib/starter.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ CycleController
constructor
A new instance of CycleController.
- #parsimonator_requirements ⇒ Object
- #raxmllight_requirements ⇒ Object
- #run_as_batch(script, logpath) ⇒ Object
Constructor Details
#initialize(opts) ⇒ CycleController
Returns a new instance of CycleController.
9 10 11 12 13 |
# File 'lib/starter.rb', line 9 def initialize(opts) @opts = opts @opts[:num_ptrees] ||= @opts[:num_parsi_trees] @numtaxa, @seqlen = File.open(@opts[:phy]).readlines.first.split.map{|w| w.to_i} end |
Instance Method Details
#parsimonator_requirements ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/starter.rb', line 14 def parsimonator_requirements bytes_inner = @numtaxa.to_f * @seqlen.to_f security_factor = 3.0 required_MB = bytes_inner * security_factor * 1E-6 required_MB = 16 unless required_MB > 16 puts required_MB required_MB.to_i.to_s end |
#raxmllight_requirements ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/starter.rb', line 22 def raxmllight_requirements #(n-2) * m * ( 8 * 4 ) bytes_inner = @numtaxa.to_f * @seqlen.to_f * 8 * 4 security_factor = 1.3 required_MB = bytes_inner * security_factor * 1E-6 required_MB = 16 unless required_MB > 16 puts required_MB required_MB.to_i.to_s end |
#run_as_batch(script, logpath) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/starter.rb', line 31 def run_as_batch(script, logpath) raise "#{script} missing" unless File.exist?(script) #raise "#{logpath} missing" unless File.exist?(logpath) raise "User Number of parsimony trees not set" unless @opts[:num_parsi_trees] > 0 raise "Total Number of parsimony trees not set" unless @opts[:num_ptrees] > 0 opts = @opts[:iter].to_s opts += " " + File.(@opts[:phy]) opts += " " + parsimonator_requirements opts += " " + raxmllight_requirements opts += " " + @opts[:num_parsi_trees].to_s # -N parameter -p for suer opts += " " + @opts[:num_ptrees].to_s # total number of parsimony trees opts += " " + @opts[:num_bestML_trees].to_s opts += " " + @opts[:exp_name].to_s opts += " " + @opts[:base_dir].to_s puts "./#{script} #{opts}" system "./#{script} #{opts} >> #{logpath}" end |