Example #1
0
from os import path
# Module is scripts/helper_functions.py
from helper_functions import verify_file_locs, move_files, display_msg, run_avida

EVN = "environment.cfg" 
CUSTOM_EVNS = ["native_environment.cfg", "invasive_environment.cfg"]  # Required configuration files for this script
EVENTS = "events.cfg"
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:
Example #2
0
CUSTOM_ANALYZE = "invasive_analyze.cfg"
POPULATION_FILES = ["native-detail-100000.spop", "invasive-detail-100000.spop"]
NUM_OF_TRIALS = 5
NUM_OF_INVADERS = 5


# move the population files
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()
Example #3
0
from helper_functions import verify_file_locs, move_files, display_msg, run_avida

EVN = "environment.cfg"
CUSTOM_EVNS = ["native_environment.cfg", "invasive_environment.cfg"
               ]  # Required configuration files for this script
EVENTS = "events.cfg"
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)
Example #4
0
NUM_OF_INVADERS = 5

# move the population files
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):