2 # = lib/soft/fastme - FastMe class
4 # Copyright:: Copyright (C) 2009 Christian M. Zmasek
5 # License:: GNU Lesser General Public License (LGPL)
7 # $Id: fastme.rb,v 1.3 2009/10/08 22:44:54 cmzmasek Exp $
9 # last modified: 2009/10/06
11 require 'lib/evo/soft/resource_locations'
12 require 'lib/evo/util/util'
20 OUTTREE = 'output.tre'
25 @fast_me_home = Util.get_env_variable_value( ResourceLocations::FASTME_HOME_ENV_VARIABLE )
26 Util.check_file_for_readability( @fast_me_home )
29 def run( pwd_file, bootstrap_number, initial_tree )
30 Util.check_file_for_readability( pwd_file )
31 if bootstrap_number == nil || bootstrap_number < 0
32 error_msg = "illegal bootstrap number: " + bootstrap_number
33 raise ArgumentError, error_msg
35 init_tree_option = determine_initial_tree( initial_tree )
37 if bootstrap_number > 1
38 input = "-b #{init_tree_option} -i #{pwd_file} -n #{bootstrap_number} -s b"
40 input = "-b #{init_tree_option} -i #{pwd_file} -s b"
43 puts @fast_me_home + " " + input
45 IO.popen( @fast_me_home + " " + input, 'r+' ) do |io|
53 def determine_initial_tree( initial_tree )
55 if ( initial_tree == :BME )
57 elsif ( initial_tree == :GME )
59 elsif ( initial_tree == :NJ )
62 error_msg = "unknown initial tree"
63 raise ArgumentError, error_msg