Genetic Drift and Natural Selection
Model was written in NetLogo 6.2.0
•
Viewed 154 times
•
Downloaded 25 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [x y num-ones allele-num fs fn fv fb] turtles-own [allele genotype phynotype p-name erg] breed [gamates gamate] Breed [ones one] breed [birds bird] to-report allele-s report count gamates with [genotype = "cs"] end to-report allele-n report count gamates with [genotype = "cn"] end to-report allele-b report count gamates with [genotype = "cb"] end to-report allele-v report count gamates with [genotype = "cv"] end to-report sum-allele report allele-s + allele-n + allele-b + allele-v end to set-allele if Involved-alleles? = "2 alleles" [set allele-num 2] if Involved-alleles? = "3 alleles" [set allele-num 3] if Involved-alleles? = "4 alleles" [set allele-num 4] end to start-gamates create-gamates population-size * 2 [ gamate-trait set genotype item random allele-num ["cs" "cn" "cb" "cv"] if genotype = "cb" [set color 0] if genotype = "cn" [set color red] if genotype = "cv" [set color sky]] update-allele end to gamate-trait set shape "dot" set color 52 set size 0.1 setxy random-xcor random-ycor end to set-tray ask patches [ set pcolor 52 + random-float 0.25] end ;================== to setup ca set-tray set-allele start-gamates fertilize reset-ticks end to go tick ifelse birds? [ if count birds < 1 [set-bird] move move-1 gametogenesis fertilize eat ] [ if any? birds [ask birds [ die]] move gametogenesis fertilize] if fs = population-size * 2 or fn = population-size * 2 or fb = population-size * 2 or fv = population-size * 2 [stop] end ;================= to gametogenesis ask ones [ if genotype = "cscs" [ hatch-gamates 2 [gamate-trait set genotype "cs"]] if genotype = "cscn" or genotype = "cncs" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cs"][set genotype "cn"]]] if genotype = "cscb" or genotype = "cbcs" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cs"][set genotype "cb"]]] if genotype = "cncn" [ hatch-gamates 2 [gamate-trait set genotype "cn"]] if genotype = "cncb" or genotype = "cbcn" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cn"][set genotype "cb"]]] if genotype = "cbcb" [ hatch-gamates 2 [gamate-trait set genotype "cb"]] if genotype = "cvcv" [ hatch-gamates 2 [gamate-trait set genotype "cv"]] if genotype = "cvcb" or genotype = "cbcv" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cv"][set genotype "cb"]]] if genotype = "cvcn" or genotype = "cncv" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cv"][set genotype "cn"]]] if genotype = "cvcs" or genotype = "cscv" [ hatch-gamates 2 [gamate-trait ifelse random 2 = 0 [ set genotype "cs"][set genotype "cv"]]] die ] update-allele if (fs + fn + fb + fv) < population-size * 2 [proportion] end to update-allele set fs allele-s set fn allele-n set fb allele-b set fv allele-v end to proportion create-gamates (population-size * 2 - (fs + fn + fb + fv)) * (fs / (fs + fn + fb + fv)) [set genotype "cs" gamate-trait] create-gamates (population-size * 2 - (fs + fn + fb + fv)) * (fn / (fs + fn + fb + fv)) [set genotype "cn" gamate-trait] create-gamates (population-size * 2 - (fs + fn + fb + fv)) * (fb / (fs + fn + fb + fv)) [set genotype "cb" gamate-trait] create-gamates (population-size * 2 - (fs + fn + fb + fv)) * (fv / (fs + fn + fb + fv)) [set genotype "cv" gamate-trait] end to fertilize ask gamates [ let mate one-of other gamates if mate != nobody [ hatch-ones 1 [ set size 0.35 ;set-position set genotype word genotype [genotype] of mate if genotype = "cscs" or genotype = "cscn" or genotype = "cncs" or genotype = "cscb" or genotype = "cbcs" [set shape "ladybug-9 spotted" set color 25 set phynotype 1 set p-name "9-spotted"] if genotype = "cncn" or genotype = "cncb" or genotype = "cbcn" [set shape "ladybug-normal" set color 15 set phynotype 2 set p-name "normal"] if genotype = "cbcb" [set shape "ladybug-black" set phynotype 3 set color 30 set p-name "black"] if genotype = "cvcv" or genotype = "cvcb" or genotype = "cbcv" [set shape "ladybug-elongated stripe" set color 36 set phynotype 4 set p-name "elongated-stripe"] if genotype = "cvcn" or genotype = "cncv" [set shape "ladybug-broken strip" set phynotype 5 set color 36 set p-name "broken-stripe"] if genotype = "cvcs" or genotype = "cscv" [set shape "ladybug-5 spotted" set color 24 set phynotype 6 set p-name "5-spotted"] ] ask mate [die]] die ] end to move ask ones [rt random-float 5 lt random-float 5 fd 0.01] end to overpopulation if count ones > 150 [ask ones [if random 2 = 0 [die]]] end to set-bird create-birds 20 [ set color 51.5 set shape "bird" set size 1.25 setxy random-xcor random-ycor] end to move-1 ask birds [ rt random-float 15 lt random-float 15 fd 0.25] end to eat ask birds [let prey one-of ones if prey != nobody [if random-float 100 < abs ([color] of prey - 15) * 2 [ ask prey [die]]]] end
There are 3 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.