class CycleController

Public Class Methods

new(opts) click to toggle source
# 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

Public Instance Methods

parsimonator_requirements() click to toggle source
# 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() click to toggle source
# 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) click to toggle source
# 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.expand_path(@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