# HardyWeinbergHeterozyAdvantage

No preview image

Model was written in NetLogo 5.0.4
•
Viewed 459 times
•
Downloaded 49 times
•
Run 0 times

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## Comments and Questions

Please start the discussion about this model!
(You'll first need to log in.)

Click to Run Model

;[malesHMZDom maleHMZDom]; three genotypes of males homozyg dominant, heterzy, homozyg recessive ;[malesHETZ maleHETZ]; AA, Aa, aa ;[malesHMZRec maleHMZRec] ; different types of turtles and should be put with plural followed by singular ;[femalesHMZDom femaleHMZDom]; 3 genotypes of females (AA, Aa, aa) ;[femalesHETZ femaleHETZ] ;[femalesHMZRec] breed [people person] breed [mosquitos mosquito] ; mosquito vector ; example. [wolves wolf] ; this way you can call all wolves or one specific wolf breed [forest] people-own [ allele1 allele2 gender generation ] ; allows people and person to own attributes of genotype and gender to setup ca ;short for clear-all reset-ticks ; sets ticks back to zero when pushing the setup button ask patches with [ pxcor >= 0 ] ; set up the color of the green right side [ set pcolor 56 ] ask patches with [ pxcor < 0 ] ; set up the color of the highlands [ set pcolor 36 ] create-people HomozygousDominantMales [ set generation 1 set allele1 1; means there two versions of each allele 0=a 1=A set allele2 1 set gender 1; means there are 2 different genders 0= female 1= males ] create-people HeterozygousMales [ set generation 1 ifelse random 2 = 0 [set allele1 0 set allele2 1][set allele1 1 set allele2 0]; means there two versions of each allele 0=a 1=A set gender 1; means there are 2 different genders 0= female 1= males ] create-people HomozygousRecessiveMales [ set generation 1 set allele1 0; means there two versions of each allele 0=a 1=A set allele2 0 set gender 1; means there are 2 different genders 0= female 1= males ] create-people HomozygousDominantFemales [ set generation 1 set allele1 1; means there two versions of each allele 0=a 1=A set allele2 1 set gender 0; means there are 2 different genders 0= female 1= males ] create-people HeterozygousFemales [ set generation 1 ifelse random 2 = 0 [set allele1 0 set allele2 1][set allele1 1 set allele2 0] set gender 0; means there are 2 different genders 0= female 1= males ] create-people HomozygousRecessiveFemales [ set generation 1 set allele1 1; means there two versions of each allele 0=a 1=A set allele2 1 set gender 0; means there are 2 different genders 0= female 1= males ] express create-mosquitos Number_of_mosquitos ; create a turtle good guys variable number of goodguys for slider [set shape "mosquitos"; make a person shape set size 2; make person size 1 ;set color blue; make the person blue setxy (random max-pxcor) (random-ycor)]; just put the person in a random place create-forest Number_of_forest [set shape "trees"; make trees set size 4; make the tree size 4 setxy -9 -6 pen-down] ask forest [fd 2] ask patch 8 8 [ask patches in-radius 4 [set pcolor brown]] end to go ask turtles with [breed != forest] ; ask all breeds to move between 1 and 29 spaces (!= bang equals means not equal to so exclude forest) [ rt (random 20) lt (random 20) ; with helps you make exceptions if patch-ahead 1 = nobody ; makes sure they haven't gone off the edge (end) [rt 180]; right turn 180 degrees fd 1 ask people [ if any? mosquitos in-radius 1 [ ifelse allele1 = 1 and allele2 = 1 [ifelse (random 100) > (HomozygousDominantSurvivalChance - 1) [show "I'm dead, argh" die][show "I survived Malaria"]] [ifelse allele1 = 1 and allele2 = 0 or allele1 = 0 [ifelse (random 100) > (HeterozygousSurvivalChance - 1) [show "I'm dead, argh" die][show "I survived Malaria"]] [if allele1 = 0 and allele2 = 0 [ ifelse (random 100) > (HomozygousRecessiveSurvivalChance - 1) [show "I'm dead, argh" die][show "I survived Malaria"]] ] ] ] ] ] wait .3 ask people [people_breed] tick end ;SUBROUTINES FOLLOW BELOW to people_breed ; subroutine to let males and females find each other let TEMP1 0 let TEMP2 0 ask people with [gender = 0] [ifelse any? people with [gender = 1 and generation = [generation] of myself ] in-radius 2 [ repeat 2 [ ifelse random 2 = 0 [set TEMP1 allele1][set TEMP1 allele2] ; flipping the coin ask one-of people with [gender = 0] in-radius 2 [ ifelse random 2 = 0 [set TEMP2 allele1][set TEMP2 allele2] hatch-people 1 [ set generation generation + 1 set allele1 TEMP1 set allele2 TEMP2 express fd random 6 - 3 ] ] ] ask one-of people with [gender = 0] in-radius 2 [ die ] die ] [ setxy random xcor random ycor] ] ask people ;ask goodguys [if any? badguys in-radius 1 [di [ if (Recessive_lethals = true) [ ;show "I'm checking" if ((allele1 = 0) and (allele2 = 0)) [show" I'm dead, argh" die ] ] ] end to express ask people [ if gender = 0 and allele1 = 0 and allele2 = 0 [ set shape "femalesHMZRec"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor); just put the person in a random place ] if gender = 1 and allele1 = 0 and allele2 = 0 [ set shape "malesHMZRec"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor); just put the person in a random place ] if gender = 0 and ( allele1 = 1 and allele2 = 0 ) OR ( allele1 = 0 and allele2 = 1) [ set shape "femalesHETZ"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor); just put the person in a random place ] if gender = 1 and ( allele1 = 1 and allele2 = 0 ) OR ( allele1 = 0 and allele2 = 1) [ set shape "malesHETZ"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor) ; just put the person in a random place ] if gender = 0 and allele1 = 1 and allele2 = 1 [ set shape "femalesHMZDOM"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor) ; just put the person in a random place ] if gender = 1 and allele1 = 1 and allele2 = 1 [ set shape "malesHMZDom"; make female homozygous recessive aa set size 3 setxy (random-xcor) (random-ycor); just put the person in a random place ] ] end to bounce if patch-ahead 1 = nobody; makes sure they haven't gone off the edge (end) [ rt 180; right turn 180 degrees ] end

There are 2 versions of this model.

## Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.