Skip to content

Commit dc31ea7

Browse files
Merge branch 'main' into main
2 parents b389c29 + 8d9e247 commit dc31ea7

99 files changed

Lines changed: 9718 additions & 6656 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CI.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,22 @@ jobs:
1818
- name: Checkout Symbulation
1919
uses: actions/checkout@v4
2020
with:
21-
path: SymbulationEmp
2221
submodules: "recursive"
2322

2423
- name: run symbulation
25-
run: cd SymbulationEmp && make debug-default && ./symbulation_default -GRID_X 5 -GRID_Y 5
24+
run: make debug-default && ./symbulation_default -WORLD_WIDTH 5 -WORLD_HEIGHT 5
2625

2726
# Runs a single command using the runners shell
2827
- name: Make tests
29-
run: sudo apt-get update && sudo apt-get install gdb && cd SymbulationEmp && make coverage
28+
run: sudo apt-get update && sudo apt-get install gdb && make coverage
3029

3130
- name: Generate coverage
32-
run: cd SymbulationEmp && gcov -abcfu symbulation.test-main.cc
31+
run: gcov -abcfu symbulation.test-main.cc
3332

3433
- name: Upload coverage
3534
uses: codecov/codecov-action@v5
36-
with:
37-
root_dir: SymbulationEmp
38-
override_branch: ${{ github.ref_name }}
39-
slug: anyaevostinar/SymbulationEmp
40-
#Codecov is being frustrating and not reading in the updates to codecov.yml, so trying this to get the desired behavior
41-
exclude: SymbulationEmp/source/catch,SymbulationEmp/stats_scripts,SymbulationEmp/web,SymbulationEmp/Empirical,SymbulationEmp/coverage_source,SymbulationEmp/source/test,SymbulationEmp/signalgp-lite
4235
env:
4336
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44-
37+
4538
#- name: test web build
4639
# run: cd SymbulationEmp/emsdk && ./emsdk install 3.1.18 && ./emsdk activate 3.1.18 && source ./emsdk_env.sh && cd .. && make web
47-

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
TEST_DIR := source/catch
33
EMP_DIR := Empirical/include
44
SGP_DIR := signalgp-lite/include
5+
TAG_NUM_BITS = 32
56

67
# Flags to use regardless of compiler
78
VENDORIZE_EMP_FLAGS := -DUIT_VENDORIZE_EMP -DUIT_SUPPRESS_MACRO_INSEEP_WARNINGS
8-
CFLAGS_all := -Wall -Wno-unused-function -std=c++20 -I$(EMP_DIR)/ -I$(SGP_DIR)/ ${VENDORIZE_EMP_FLAGS}
9+
COMPILE_TIME_ARGS := -DTAG_NUM_BITS=$(TAG_NUM_BITS)
10+
CFLAGS_all := -Wall -Wno-unused-function -std=c++20 $(COMPILE_TIME_ARGS) -I$(EMP_DIR)/ -I$(SGP_DIR)/ ${VENDORIZE_EMP_FLAGS}
911

1012
# Native compiler information
1113
CXX_nat := g++
@@ -158,6 +160,10 @@ test-debug-sgp:
158160
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
159161
./symbulation.test [sgp] || { gdb ./$@.out --ex="catch throw" --ex="set confirm off" --ex="run" --ex="backtrace" --ex="quit"; exit 1; }
160162

163+
test-debug-events:
164+
$(CXX_nat) $(CFLAGS_nat_debug) $(TEST_DIR)/main.cc -o symbulation.test
165+
./symbulation.test [events] || { gdb ./$@.out --ex="catch throw" --ex="set confirm off" --ex="run" --ex="backtrace" --ex="quit"; exit 1; }
166+
161167
test-executable:
162168
$(CXX_nat) $(CFLAGS_nat) $(TEST_DIR)/main.cc -o symbulation.test
163169

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Interested in starting a new project with Symbulation? We have a cookiecutter te
1616
Symbulation is built with the [Empirical platform](https://github.com/devosoft/Empirical) and the cookiecutter includes our recommended directory layout and example analysis files.
1717

1818
## Usage
19+
(Note, you'll need a Python virtual environment to use cookiecutter)
1920
Install the latest Cookiecutter:
2021

2122
```

codecov.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
codecov:
2-
strict_yaml_branch: main
3-
41
ignore:
5-
- "SymbulationEmp/source/catch/**/*"
6-
- "SymbulationEmp/stats_scripts/**/*"
7-
- "SymbulationEmp/web/**/*"
8-
- "SymbulationEmp/source/Organism.h"
9-
- "SymbulationEmp/source/*.test.cc"
10-
- "SymbulationEmp/Empirical/**/*"
11-
- "SymbulationEmp/coverage_source/**/*"
12-
- "SymbulationEmp/source/test/**/*"
13-
- "SymbulationEmp/signalgp-lite/**/*"
2+
- "source/catch/**/*"
3+
- "stats_scripts/**/*"
4+
- "web/**/*"
5+
- "source/Organism.h"
6+
- "source/*.test.cc"
7+
- "Empirical/**/*"
8+
- "coverage_source/**/*"
9+
- "source/test/**/*"
10+
- "signalgp-lite/**/*"

source/ConfigSetup.h

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#ifndef CONFIG_H
22
#define CONFIG_H
3-
#include <limits>
3+
44
#include "../Empirical/include/emp/config/config.hpp"
55

6-
const int TAG_LENGTH = 32;
6+
#include <limits>
7+
#include <string>
8+
9+
// Allow for compile-time tag size configuration
10+
#ifndef TAG_NUM_BITS
11+
#define TAG_NUM_BITS 32
12+
#endif
13+
constexpr size_t TAG_LENGTH = TAG_NUM_BITS;
714

815
EMP_BUILD_CONFIG(SymConfigBase,
916
GROUP(MAIN, "Global Settings"),
@@ -13,9 +20,7 @@ EMP_BUILD_CONFIG(SymConfigBase,
1320
VALUE(VERTICAL_TRANSMISSION, double, 0.7, "Value 0 to 1 of probability of symbiont vertically transmitting when host reproduces"),
1421
VALUE(HOST_INT, double, -2, "Interaction value from -1 to 1 that hosts should have initially, -2 for random"),
1522
VALUE(SYM_INT, double, -2, "Interaction value from -1 to 1 that symbionts should have initially, -2 for random"),
16-
VALUE(GRID_X, int, 100, "Width of the world, just multiplied by the height to get total size"),
17-
VALUE(GRID_Y, int, 100, "Height of world, just multiplied by width to get total size"),
18-
VALUE(POP_SIZE, int, -1, "Starting size of the host population, -1 for full starting population"),
23+
VALUE(INIT_POP_SIZE, int, -1, "Starting size of the host population, -1 for full starting population"),
1924
VALUE(SYM_LIMIT, int, 1, "Number of symbiont allowed to infect a single host"),
2025
VALUE(START_MOI, double, 1, "Ratio of symbionts to hosts that experiment should start with"),
2126
VALUE(UPDATES, int, 1001, "Number of updates to run before quitting"),
@@ -26,7 +31,6 @@ EMP_BUILD_CONFIG(SymConfigBase,
2631
VALUE(HOST_REPRO_RES, double, 1000, "How many resources required for host reproduction"),
2732
VALUE(SYM_HORIZ_TRANS_RES, double, 100, "How many resources required for symbiont non-lytic horizontal transmission"),
2833
VALUE(SYM_VERT_TRANS_RES, double, 0, "How many resources required for symbiont vertical transmission"),
29-
VALUE(GRID, bool, 0, "Do offspring get placed immediately next to parents on grid, same for symbiont spreading"),
3034
VALUE(SYM_INFECTION_CHANCE, double, 1, "The chance (between 0 and 1) that a sym will infect a parallel host on process"),
3135
VALUE(SYM_INFECTION_FAILURE_RATE, double, 0, "The chance (between 0 and 1) that a sym will be killed by the world while trying to infect a host"),
3236
VALUE(HOST_AGE_MAX, int, -1, "The maximum number of updates hosts are allowed to live, -1 for infinite"),
@@ -40,18 +44,24 @@ EMP_BUILD_CONFIG(SymConfigBase,
4044
VALUE(FILE_PATH, std::string, "Data", "Output file path"),
4145
VALUE(FILE_NAME, std::string, "_data", "Root output file name"),
4246
VALUE(CURE, bool, 0, "Should all symbionts die (0 for no, 1 for yes)"),
43-
VALUE(CURE_UPDATES, int, 0, "How many updates should run before all symbionts die, will take the next update for effect"),
44-
47+
VALUE(CURE_UPDATES, size_t, 0, "How many updates should run before all symbionts die, will take the next update for effect"),
48+
49+
GROUP(SPATIAL_STRUCTURE, "Spatial structure settings"),
50+
VALUE(SPATIAL_STRUCT_MODE, std::string, "well-mixed", "Options: well-mixed, grid, load (requires filepath in LoadFile param)"),
51+
VALUE(SPATIAL_STRUCT_CFG_PATH, std::string, "spatial-struct.mat", "Path to the file containing the spatial structure"),
52+
VALUE(SPATIAL_STRUCT_LOAD_MODE, std::string, "matrix", "Expected file format for loaded spatial structure. Options: matrix, edges"),
53+
VALUE(WORLD_WIDTH, size_t, 100, "Used for grid and well-mixed modes. Width of the world, just multiplied by the height to get total size"),
54+
VALUE(WORLD_HEIGHT, size_t, 100, "Used for grid and well-mixed modes. Height of world, just multiplied by width to get total size"),
55+
4556
GROUP(PHYLOGENY, "PHYLOGENY"),
4657
VALUE(PHYLOGENY, bool, 0, "Should the world keep track of host and symbiont phylogenies? (0 for no, 1 for yes)"),
4758
VALUE(TRACK_PHYLOGENY_INTERACTIONS, bool, 0, "Should the world keep track of interactions between hosts and symbionts, then write the count of all (including historical) interactions committed by tracked taxa? (0 for no, 1 for yes)?"),
4859
VALUE(WRITE_CURRENT_INTERACTION_COUNTS, bool, 0, "Should the world write the count of only-currently-present interactions? (0 for no, 1 for yes)"),
4960
VALUE(PHYLOGENY_SNAPSHOT_INTERVAL, int, 10001, "How often to output phylogeny snapshots"),
5061
VALUE(NUM_PHYLO_BINS, size_t, 5, "How many bins should organisms be separated into if phylogeny is on?"),
51-
VALUE(PHYLOGENY_TAXON_TYPE, size_t, 0, "What are phylogeny taxa based on? 0 = binned genotypes values, 1 = exact phenotype values, 2 = bitset tag (for tag matching condition), 3 = individual-level"),
62+
VALUE(PHYLOGENY_TAXON_TYPE, std::string, "interaction-value-binned", "What are phylogeny taxa based on? Options: interaction-value-binned, interaction-value-exact, tag, individual"),
5263
VALUE(STORE_EXTINCT, bool, 0, "Should extinct taxa be stored? (0 for no, 1 for yes)"),
5364

54-
5565
GROUP(MUTATION, "Mutation"),
5666
VALUE(MUTATION_SIZE, double, 0.002, "Standard deviation of the distribution to mutate by"),
5767
VALUE(HOST_MUTATION_SIZE, double, -1, "Standard deviation of the distribution to mutate by for hosts, if -1 MUTATION_SIZE used"),
@@ -76,7 +86,7 @@ EMP_BUILD_CONFIG(SymConfigBase,
7686

7787
GROUP(TAG_MATCHING, "Settings for tag matching"),
7888
VALUE(TAG_MATCHING, bool, 0, "Should organisms have tags that they use to decide whether symbionts can infect hosts?"),
79-
VALUE(TAG_METRIC, int, 0, "Which tag matching metric should be used to compute distances between tags? (0 for hamming [proportion of bits mismatching], 1 for streak [ratio of continuously matching/mismatching bits], or 2 for hash [arbitrary but consistent difference])"),
89+
VALUE(TAG_METRIC, std::string, "hamming", "Which tag matching metric should be used to compute distances between tags? hamming [proportion of bits mismatching], streak [ratio of continuously matching/mismatching bits], or hash [arbitrary but consistent difference]"),
8090
VALUE(NORMALIZE_TAG_DISTANCES, bool, 0, "Should distances between pairs of tags be uniformicated? (0 for no, 1 for yes)"),
8191
VALUE(TAG_PERMISSIVENESS, double, 0.125, "What is the Poisson mean for divergence allowed between tags for a successful infection? (1 = perfect mismatch, 0 = perfect match)"),
8292
VALUE(HOST_TAG_PERMISSIVENESS_EVOLVES, bool, 0, "Should each host have a tag permissiveness that evolves as hosts reproduce? If yes, starting tag permissiveness values will be set to the TAG_PERMISSIVENESS config option. (0 for no, 1 for yes)"),
@@ -86,6 +96,6 @@ EMP_BUILD_CONFIG(SymConfigBase,
8696
VALUE(VT_TAG_MATCH, bool, 1, "Should tag matching be required for vertical transmission (0 for no, 1 for yes)?"),
8797
VALUE(WRITE_TAG_MATRIX, bool, 0, "At the end of the experiment, should a similarity matrix of all persisting tags be generated?"),
8898
VALUE(TAG_MATRIX_SAMPLE_PROPORTION, double, 0.1, "What proportion of positions in the world should be sampled to produce the tag matrix from?"),
89-
VALUE(STARTING_TAGS_ONE_PROB, double, 0, "What probability should initializing bits in tags have of being 1s? Hosted symbionts will be assigned their host's tag. (0 for basic, all-0 only tags)")
99+
VALUE(HOST_STARTING_TAGS_ONE_PROB, double, 0, "What probability should initializing bits in tags have of being 1s? Hosted symbionts will be assigned their host's tag. (0 for basic, all-0 only tags)")
90100
)
91101
#endif

0 commit comments

Comments
 (0)