CUSTOM_EVENTS = "create_pop_events.cfg" AVIDA_DIR = path.join(os.pardir, 'avida') # Relative location of the avida directory verify_file_locs(CUSTOM_EVNS+[CUSTOM_EVENTS], AVIDA_DIR) seed = input("Please enter the seed number (digits of UT EID): ") username = raw_input("Please enter your first name: ").lower() moved_cfgs = move_files("temp", EVN, EVENTS) # If there already exists an environment.cfg or evemts.cfg file, move it out of the way try: os.rename(CUSTOM_EVENTS, EVENTS) for cfg in CUSTOM_EVNS: os.rename(cfg, EVN) run = 1 run_avida(seed) display_msg("Run "+str(run) +" of avida completed.") run += 1 os.rename(ENV, cfg) data_src = path.join('data','detail-100000.spop') data_dest = path.join(os.pardir, 'saved_data', username) dest = move_files(data_dest, data_src) if run == 1: os.rename(dest[0],path.join(path.dirname(dest[0]), "native-detail-100000.spop")) if run == 2: #it shouldn't run more than twice, but I don't want it to fail if it does os.rename(dest[0],path.join(path.dirname(dest[0]), "invasive-detail-100000.spop")) finally: os.rename(EVENTS, CUSTOM_EVENTS) move_files(os.curdir, *moved_cfgs) display_msg("Script has finished.")
username = raw_input("Please enter your first name or the name of the directory\nin the 'saved_data' directory: ").lower() user_pops_dir = path.join(os.pardir, 'saved_data', username) user_pop_files = [] for pop in POPULATION_FILES: user_pop_files.append(path.join(user_pops_dir,pop)) required_files = [CUSTOM_EVENTS] + CUSTOM_EVNS + [CUSTOM_ANALYZE] + user_pop_files verify_file_locs(required_files, AVIDA_DIR) moved_cfgs = move_files("temp", EVN, ANALYZE) # If there already exists configuration files, move them out of the way moved_pop_files = move_files(os.curdir, *user_pop_files) try: os.rename(CUSTOM_EVNS[0], EVN) os.rename(CUSTOM_ANALYZE, ANALYZE) # find the dominant sequence run_avida(-1) display_msg("Analysis complete") moved_cfgs += move_files("temp", EVENTS) os.rename(ANALYZE, CUSTOM_ANALYZE) with open("data/dom_genotype.dat") as fp: for line in fp: if re.match(r'[^#]\w+', line): dom_genotype = line.strip() break # edit the events.cfg file with open(CUSTOM_EVENTS) as fp: detail_line = re.compile(r"(.*InjectSequence\s)(\w+)") fo = open("events.cfg", "w") for line in fp:
'avida') # Relative location of the avida directory verify_file_locs(CUSTOM_EVNS + [CUSTOM_EVENTS], AVIDA_DIR) seed = input("Please enter the seed number (digits of UT EID): ") username = raw_input("Please enter your first name: ").lower() moved_cfgs = move_files( "temp", EVN, EVENTS ) # If there already exists an environment.cfg or evemts.cfg file, move it out of the way try: os.rename(CUSTOM_EVENTS, EVENTS) for cfg in CUSTOM_EVNS: os.rename(cfg, EVN) run = 1 run_avida(seed) display_msg("Run " + str(run) + " of avida completed.") run += 1 os.rename(ENV, cfg) data_src = path.join('data', 'detail-100000.spop') data_dest = path.join(os.pardir, 'saved_data', username) dest = move_files(data_dest, data_src) if run == 1: os.rename( dest[0], path.join(path.dirname(dest[0]), "native-detail-100000.spop")) if run == 2: #it shouldn't run more than twice, but I don't want it to fail if it does os.rename( dest[0], path.join(path.dirname(dest[0]),
for pop in POPULATION_FILES: user_pop_files.append(path.join(user_pops_dir, pop)) required_files = [CUSTOM_EVENTS] + CUSTOM_EVNS + [CUSTOM_ANALYZE ] + user_pop_files verify_file_locs(required_files, AVIDA_DIR) moved_cfgs = move_files( "temp", EVN, ANALYZE ) # If there already exists configuration files, move them out of the way moved_pop_files = move_files(os.curdir, *user_pop_files) try: os.rename(CUSTOM_EVNS[0], EVN) os.rename(CUSTOM_ANALYZE, ANALYZE) # find the dominant sequence run_avida(-1) display_msg("Analysis complete") moved_cfgs += move_files("temp", EVENTS) os.rename(ANALYZE, CUSTOM_ANALYZE) with open("data/dom_genotype.dat") as fp: for line in fp: if re.match(r'[^#]\w+', line): dom_genotype = line.strip() break # edit the events.cfg file with open(CUSTOM_EVENTS) as fp: detail_line = re.compile(r"(.*InjectSequence\s)(\w+)") fo = open("events.cfg", "w") for line in fp: