Skip to content

Commit

Permalink
setting up long runs with and without parasites and spatial structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Anya E. Vostinar committed May 2, 2023
1 parent 6ad07ee commit b9fd9f7
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 0 deletions.
106 changes: 106 additions & 0 deletions Data/05-02-23-ParasitesLongSpatial/SymSettings.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
### MAIN ###
# Global Settings

set SEED 10 # What value should the random seed be? If seed <= 0, then it is randomly re-chosen.
set DATA_INT 500 # How frequently, in updates, should data print?
set SYNERGY 5 # Amount symbiont's returned resources should be multiplied by
set VERTICAL_TRANSMISSION 0.0 # Value 0 to 1 of probability of symbiont vertically transmitting when host reproduces
set HOST_INT -2 # Interaction value from -1 to 1 that hosts should have initially, -2 for random
set SYM_INT -2 # Interaction value from -1 to 1 that symbionts should have initially, -2 for random
set GRID_X 100 # Width of the world, just multiplied by the height to get total size
set GRID_Y 100 # Height of world, just multiplied by width to get total size
set POP_SIZE -1 # Starting size of the host population, -1 for full starting population
set SYM_LIMIT 1 # Number of symbiont allowed to infect a single host
set START_MOI 1 # Ratio of symbionts to hosts that experiment should start with
set UPDATES 120001 # Number of updates to run before quitting
set RES_DISTRIBUTE 100 # Number of resources to give to each host each update if they are available
set LIMITED_RES_TOTAL 10 # Starting number of total resources available over the entire run, -1 for unlimited
set LIMITED_RES_INFLOW 500 # Number of resources to add to the total every update, only used if LIMITED_RES_TOTAL is not -1
set HORIZ_TRANS 1 # Should non-lytic horizontal transmission occur? 0 for no, 1 for yes
set HOST_REPRO_RES 100 # How many resources required for host reproduction
set SYM_HORIZ_TRANS_RES 10 # How many resources required for symbiont non-lytic horizontal transmission
set SYM_VERT_TRANS_RES 0 # How many resources required for symbiont vertical transmission
set GRID 0 # Do offspring get placed immediately next to parents on grid, same for symbiont spreading
set SYM_INFECTION_CHANCE 1 # The chance (between 0 and 1) that a sym will infect a parallel host on process
set SYM_INFECTION_FAILURE_RATE 0 # The chance (between 0 and 1) that a sym will be killed by the world while trying to infect a host
set HOST_AGE_MAX -1 # The maximum number of updates hosts are allowed to live, -1 for infinite
set SYM_AGE_MAX -1 # The maximum updates symbionts are allowed to live, -1 for infinite
set PHYLOGENY 0 # Should the world keep track of host and symbiont phylogenies? (0 for no, 1 for yes)
set NUM_PHYLO_BINS 5 # How many bins should organisms be sepeated into if phylogeny is on?
set NO_MUT_UPDATES 0 # How many updates should be run after the end of UPDATES with all mutation turned off?
set FILE_PATH # Output file path
set FILE_NAME _data # Root output file name
set DOMINANT_COUNT 10 # Number of dominant hosts to select

### MUTATION ###
# Mutation

set MUTATION_SIZE 0.002 # Standard deviation of the distribution to mutate by
set HOST_MUTATION_SIZE -1 # Standard deviation of the distribution to mutate by for hosts, if -1 MUTATION_SIZE used
set MUTATION_RATE 1 # Value 0 to 1 of probability of mutation
set HOST_MUTATION_RATE -1 # Value 0 to 1 of probability of mutation for hosts, if -1 MUTATION_RATE used
set MUTATE_LYSIS_CHANCE 0 # Should the chance of lysis mutate? 0 for no, 1 for yes
set MUTATE_INDUCTION_CHANCE 0 # Should the chance of Induction mutate? 0 for no, 1 for yes
set MUTATE_INC_VAL 0 # Whether the incorporation vals mutate or not, 0 or 1
set EFFICIENCY_MUT_RATE -1 # The overall mutation rate of the efficiency trait in symbionts, -1 makes it same as mutation rate as determined by transmission mode
set INT_VAL_MUT_RATE -1 # The overall mutation rate of the interaction value trait in symbionts, -1 makes it same as mutation rate as determined by tranmission mode
set HORIZ_MUTATION_SIZE -1 # Standard deviation of the distribution to mutate by for horizontal transmission, if -1 MUTATION_SIZE used
set HORIZ_MUTATION_RATE -1 # Value 0 to 1 of probability of mutation for horizontal transmission, if -1 MUTATION_RATE used

### ECTOSYMBIOSIS ###
# Settings for ectosymbiosis and free-living symbionts

set FREE_LIVING_SYMS 0 # Are symbionts able to live outside of the host?
set MOVE_FREE_SYMS 0 # Should the free living syms move around in the world? 0 for no, 1 for yes
set ECTOSYMBIOSIS 0 # Do free-living syms and parallel hosts interact? (0 for no, 1 for yes)
set ECTOSYMBIOTIC_IMMUNITY 0 # Does a hosted sym confer immunity to ectosymbiosis? (0 for no, 1 for yes)
set FREE_SYM_RES_DISTRIBUTE 0 # Number of resources to give to each free-living symbiont each update if they are available
set FREE_SYM_REPRO_RES -1 # How many resources required for free living symbiont reproduction. If -1, use the horizontal transmission required point value.

### LYSIS ###
# Lysis Settings, coming soon to the GUI!

set LYSIS_CHANCE -1 # Chance of lysis vs. lysogeny for starting population of phage, -1 for random distribution
set CHANCE_OF_INDUCTION 0 # Chance of induction for starting lysogenic phage, -1 for random distribution
set LYSIS 0 # Should lysis occur? 0 for no, 1 for yes
set BURST_SIZE 10 # If there is lysis, this is how many symbionts should be produced during lysis. This will be divided by burst_time and that many symbionts will be produced every update
set BURST_TIME 10 # If lysis enabled, this is how many updates will pass before lysis occurs
set PROPHAGE_LOSS_RATE 0 # Rate at which infected lysogens become re-susceptible to new phage
set BENEFIT_TO_HOST 0 # Should lysogenic phage give a benefit to their hosts? 0 for no, 1 for yes
set PHAGE_INC_VAL 0 # The compatibility of the prophage to its placement within the bacterium's genome, from 0 to 1, -1 for random distribution
set HOST_INC_VAL 0 # The compatibility of the bacterium for the phage's placement in its genome, from 0 to 1, -1 for random distribution
set SYM_LYSIS_RES 1 # How many resources required for symbiont to create offspring for lysis each update
set PHAGE_EXCLUDE 0 # Do phage have a decreased chance of getting into the host if there is already a lytic phage?

### PGG ###
# Public Goods Game Settings

set PGG_DONATE 0 # Ratio of symbionts‘ energy to PGG pool that experiment should start with
set PGG 0 # whether have social goods game among syms
set PGG_SYNERGY 1.1 # Amount symbiont's returned resources should be multiplied by when doing PGG
set PGG_DONATE_RANDOM 0 # Make the ratio of symbionts' energy to PGG pool be random for each organism at the start of the experiment
set PGG_DONATE_MIN 0 # The minimum value of the symbionts' donation rate, if randomly selected, at initialization
set PGG_DONATE_MAX 1 # The maximum value of the symbionts' donation rate, if randomly selected, at initialization
set PGG_DONATE_NORMAL 0 # Make the random initialization of the symbionts' donation rate be initialized using a normal distribution
set PGG_DONATE_NORMAL_MEAN 0.5 # The mean of the normal distribution of the initialization of the symbionts' donation rate
set PGG_DONATE_NORMAL_STD 0.167 # The standard deviation of the normal distribution of the initialization of the symbionts' donation rate

### DTH ###
# Settings for the Dirty Transmission Hypothesis

set EFFICIENT_SYM 0 # Do you want symbionts that also have an efficiency value that evolves
set COMPETITION_MODE 0 # Should a competition between two types be conducted? (Which is specified in the code)

### SGP ###
# Complex Genomes Settings

set CYCLES_PER_UPDATE 4 # Number of CPU cycles that organisms run every update
set THREAD_COUNT 1 # Number of threads used to process organisms in parallel
set RANDOM_ANCESTOR 0 # Randomize ancestor genomes instead of using the blank genome with just NOT and reproduction
set TASK_TYPE 1 # 0 for squaring tasks, 1 for logic tasks
set DONATION_STEAL_INST 0 # 1 if you want donate and steal instructions in the instruction set, 0 if not
set RANDOM_IO_INPUT 1 # 1 to give organisms random input when they IO, 0 to give them only ones
set LIMITED_TASK_RESET_INTERVAL 20 # Number of updates before an org is allowed to complete a non-unlimited task again
set STEAL_PENALTY 0.1 # Proportion of resources that are lost when stealing from a host
set DONATE_PENALTY 0.1 # Proportion of resources that are lost when donating to a host

54 changes: 54 additions & 0 deletions Data/05-02-23-ParasitesLongSpatial/simple_repeat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#a script to run several replicates of several treatments locally
#You should create a directory for your result files and run this script from within that directory
# usage: python3 simple_repeat.py <start_seed> <end_seed>
# Assumes that symbulation executable and SymSettings.cfg already in the folder

import subprocess
import sys

spatial = [0,1]
MOI = [0.0,1.0]

def cmd(command):
'''This wait causes all executions to run in sieries.
For parralelization, remove .wait() and instead delay the
R script calls unitl all neccesary data is created.'''
return subprocess.Popen(command, shell=True).wait()

def silent_cmd(command):
'''This wait causes all executions to run in sieries.
For parralelization, remove .wait() and instead delay the
R script calls unitl all neccesary data is created.'''
return subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).wait()

start_range = 10
end_range = 21

#collect optional command line arguments
if(len(sys.argv) > 1):
#first argument is the starting range for seeds
start_range = int(sys.argv[1])
if(len(sys.argv) > 2):
#if the user provides a second argument, use it
#as the inclusive end of the seed range
end_range = int(sys.argv[2]) + 1
else:
#if the user does not provide a second argument,
#set the seed range as just the single seed
#indicated by the first argument
end_range = start_range + 1

seeds = range(start_range, end_range)

#Tell the user the inclusive range of seeds
print("Using seeds", start_range, "through", end_range-1)

for a in seeds:
for b in spatial:
for c in MOI:
command_str = './symbulation_parasite -SEED '+str(a)+ ' -GRID ' +str(b)+ ' -START_MOI ' +str(c) + ' -FILE_NAME _Grid'+str(b)+'_MOI'+str(c)
settings_filename = "Output_Grid"+str(b)+'_MOI'+str(c)+"_SEED"+str(a)+".data"

print(command_str)
print(settings_filename)
#cmd(command_str+" > "+settings_filename)
Binary file not shown.

0 comments on commit b9fd9f7

Please sign in to comment.