Skip to content

Commit

Permalink
Update selection exercises
Browse files Browse the repository at this point in the history
Fixed parameters to match updated script parameters
  • Loading branch information
trvrb committed Jul 20, 2021
1 parent 6a5c02d commit d8e321f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions selection/mutation-drift-exercise.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Exercise: effects of population size and mutation rate on population dynamics

We'll go into this further in the next section, but a very important parameter is *&theta;*, which is equal to 2<i>N&mu;</i>, where *N* is equal to the population size and *&mu;* is equal to mutations per generation. If there are 100 sites and a per-site per-gen mutation rate of 0.0001, then *&mu;* = 0.01. If there are 50 individuals in the population, then *&theta;* = 2<i>N&mu;</i> = 1.
We'll go into this further in the next section, but a very important parameter is *&theta;*, which is equal to 2<i>N&mu;</i>, where *N* is equal to the population size and *&mu;* is equal to mutations per generation. If there are 100 sites and a per-site per-gen mutation rate of 0.000025, then *&mu;* = 0.0025. If there are 200 individuals in the population, then *&theta;* = 2<i>N&mu;</i> = 1.

This exercise can be completed by running the supplied Python script [`mutation-drift.py`](mutation-drift.py). To run the script with population size of 50, per-site per-gen mutation rate of 0.0001, 100 sites and 500 generations, input:
This exercise can be completed by running the supplied Python script [`mutation-drift.py`](mutation-drift.py). To run the script with population size of 200, per-site per-gen mutation rate of 0.000025, 100 sites and 1000 generations, input:

```
python mutation-drift.py --pop_size 50 --mutation_rate 0.0001 --seq_length 100 --generations 500
python mutation-drift.py --pop_size 200 --mutation_rate 0.000025
```

Again, these parameters give *&theta;* = 1.
Expand All @@ -16,10 +16,10 @@ Again, these parameters give *&theta;* = 1.
> (3) Adjust *N* and *&mu;* up and down, while keeping *&theta;* = 1, to explore high *N* / low *&mu;* and low *N* / high *&mu;* scenarios. What happens to diversity, divergence and haplotype dynamics?
You might try increasing `generations` to something greater than 500 to get a better feel for equilibrium divergence and diversity, say `--generations 2500`. In this case, it may be easier to not plot the haplotype trajectories. This can be done with `--summary`, like so:
You might try increasing `generations` to something greater than 1000 to get a better feel for equilibrium divergence and diversity, say `--generations 2500`. In this case, it may be easier to not plot the haplotype trajectories. This can be done with `--summary`, like so:

```
python mutation-drift.py --pop_size 50 --mutation_rate 0.0001 --seq_length 100 --generations 2500 --summary
python mutation-drift.py --pop_size 200 --mutation_rate 0.000025 --generations 2500 --summary
```

--------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions selection/mutation-drift-selection-exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

Here, we'll keep *N* and *&mu;* fixed and keep *&theta;* = 1, but include a small fraction of selectively advantageous mutations.

This exercise can be completed by running the supplied Python script [`mutation-drift-selection.py`](mutation-drift-selection.py). To run the script with default population size of 100, per-site per-gen mutation rate of 0.0001, 100 sites and 500 generations, but with a chance of 0.002 for a mutation to have a fitness effect of 1.1:
This exercise can be completed by running the supplied Python script [`mutation-drift-selection.py`](mutation-drift-selection.py). To run the script with default population size of 200, per-site per-gen mutation rate of 0.000025, 100 sites and 1000 generations, but with a chance of 0.01 for a mutation to have a fitness effect of 1.5:

```
python mutation-drift-selection.py
```

Again, you might try increasing `generations` to something greater than 500 to get a better feel for equilibrium divergence and diversity, say `--generations 2500`. In this case, it may be easier to not plot the haplotype trajectories, using `--summary`, like so:
Again, you might try increasing `generations` to something greater than 1000 to get a better feel for equilibrium divergence and diversity, say `--generations 2500`. In this case, it may be easier to not plot the haplotype trajectories, using `--summary`, like so:

```
python mutation-drift-selection.py --generations 2500 --summary
Expand Down
2 changes: 1 addition & 1 deletion selection/mutation-drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def snp_trajectory_plot(xlabel="generation"):

if __name__=="__main__":
parser = argparse.ArgumentParser(description = "run wright-fisher simulation with mutation and genetic drift")
parser.add_argument('--pop_size', type = int, default = 200.0, help = "population size")
parser.add_argument('--pop_size', type = int, default = 200, help = "population size")
parser.add_argument('--mutation_rate', type = float, default = 0.000025, help = "mutation rate")
parser.add_argument('--seq_length', type = int, default = 100, help = "sequence length")
parser.add_argument('--generations', type = int, default = 1000, help = "generations")
Expand Down

0 comments on commit d8e321f

Please sign in to comment.