SCAv6.4

No preview image

1 collaborator

My_photo_2 Sugat Dabholkar (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0-M5 • Viewed 359 times • Downloaded 69 times • Run 0 times
Download the 'SCAv6.4' modelDownload this modelEmbed this model

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

extensions [profiler]

breed [ humans human ]
breed [ mosquitos mosquito ]

humans-own [
  mat-chrom
  pat-chrom
  age
  phenotype
]

mosquitos-own [
  age
]

globals [
  max-percent  ;; percent of the total population that is in the
  population-to-cull ;; global population size for culling procedure
  deaths scd-total born-carrier born-normal tally
]

to setup
  clear-all
  ask patches [set pcolor 121 ]
  setup-humans
  setup-mosquitos
  setup-my-plots
  update-my-plots
  set tally tally + population-size
  reset-ticks
end 

to setup-humans
  create-humans population-size [
    ifelse random 100 < (proportion-HbA-allele * 100)
    [ set mat-chrom 1 ]
    [ set mat-chrom 2 ]
    ifelse random 100 < (proportion-HbA-allele * 100)
    [ set pat-chrom 1 ]
    [ set pat-chrom 2 ]
    if (mat-chrom = 1 and pat-chrom = 1) [
      set color blue
      set phenotype "normal"
      set born-normal born-normal + 1
    ]
    if (mat-chrom = 2 and pat-chrom = 2)  [
      set color red
      set phenotype "anemic"
      set scd-total scd-total + 1 ]
    if (mat-chrom = 1 and pat-chrom = 2) or (mat-chrom = 2 and pat-chrom = 1) [
      set color green
      set phenotype "carrier"
      set born-carrier born-carrier + 1
    ]
    set age 1
    setxy random-xcor random-ycor
    set shape "person"
  ]
end 

to setup-mosquitos ;; these mosquitos are only hear for the visualization factor they do not actually interact with model
   create-mosquitos selection-against-normal * 3 ;; selection against the normal humans would represent selective pressure due to malaria
   [ set shape "mosquito"
     set size 1
     set color yellow
     setxy random-xcor random-ycor
   ]
end 

to go
  if ((max-generations > 0 and ticks = max-generations) or ( not any? humans))
    [ stop ]
  move-age-die
  set population-to-cull count humans
  ask humans [
    mutate
    mate
    cull
  ]
  setup-mosquitos
  update-my-plots
  tick
end 

to introduce-scd
  create-humans number-mutated [ set mat-chrom 1 set pat-chrom 2 set color green setxy random-xcor random-ycor set shape "person" ]
end 

to move-age-die
  ask humans [
    rt random 50 - random 50
    fd dispersal-rate
    set age age + 1
  ]
  ask mosquitos [
    set age age + 1
    rt random 50 - random 50
    fd .5
    if random 5 < age [ die ]
  ]
end 

to mate ;; human procedure - when two humans are adjacent, reproduce (but no self-fertilization!)  ;; SD - this procedure needs to be revisited and discussed
 let mom self
  let partner nobody
  set partner one-of other humans in-radius 1
  if partner != nobody and age > reproductive-age [          ;;;human reproduction can be limited by age
    hatch 1 [ set age 1 fd 1
      ifelse random 100 < 50
        [ set mat-chrom [mat-chrom] of mom ]
        [ set mat-chrom [pat-chrom] of mom ]
      ifelse random 100 < 50
        [ set pat-chrom [mat-chrom] of partner ]
        [ set pat-chrom [pat-chrom] of partner ]
      if (mat-chrom = 1 and pat-chrom = 1) [
        set color blue
        set phenotype "normal"
        set born-normal born-normal + 1
      ]
      if (mat-chrom = 2 and pat-chrom = 2)  [
        set color red
        set phenotype "anemic"
        set scd-total scd-total + 1
      ]
      if (mat-chrom = 1 and pat-chrom = 2) or (mat-chrom = 2 and pat-chrom = 1)  [
        set color green
        set phenotype "carrier"
        set born-carrier born-carrier + 1
      ]
      set tally tally + 1
      set shape "person"
    ]
  ]
end 

to cull

  let death-chance ((population-to-cull - population-size) / population-to-cull) * 100
    if (selection-against-normal > 0 and phenotype = "normal") [
      set death-chance death-chance + ((100 - death-chance) * selection-against-normal * .01)
    ]
    if (selection-against-normal > 0 and phenotype = "carrier") [
      set death-chance death-chance + ((100 - death-chance) * selection-against-carrier * .01)
    ]
    if (selection-against-SCD > 0 and phenotype = "anemic") [
      set death-chance death-chance + ((100 - death-chance) * selection-against-SCD * .01)
    ]
  if random 200 < death-chance [ set deaths deaths + 1 die ]
end 

to mutate
  ifelse mat-chrom = 1
    [ if random-float 100000 < HbA-to-HbS-mutation-rate  [ set mat-chrom 2] ]
    [ if random-float 100000 < HbS-to-HbA-mutation-rate  [ set mat-chrom 1] ]
  ifelse pat-chrom = 1
    [ if random-float 100000 < HbA-to-HbS-mutation-rate [ set pat-chrom 2] ]
    [ if random-float 100000 < HbS-to-HbA-mutation-rate [ set pat-chrom 1] ]
end 

;;Code for setting up the graphs

to setup-my-plots
  set-current-plot "Phenotypic Percentage"
  set-plot-y-range 0 100

  set-current-plot "Allele Percentage"
  set-plot-y-range 0 100
end 

to update-my-plots
  set-current-plot "Phenotypic Percentage"
  set-current-plot-pen "Normal"
  ifelse count humans = 0
  [ plot 0 ]
  [ plot (count humans with [phenotype = "normal"] / count humans) * 100 ]
  set-current-plot-pen "SCD"
  ifelse count humans = 0
  [ plot 0 ]
  [ plot (count humans with [phenotype = "anemic"] / count humans ) * 100 ]
  set-current-plot-pen "Carrier"
   ifelse count humans = 0
  [ plot 0 ]
  [ plot (count humans with [phenotype = "carrier"] / count humans) * 100 ]


  set-current-plot "Allele Percentage"
  set-current-plot-pen "HbA"
  ifelse count humans = 0
  [ plot 0 ]
   [ plot   ((count humans with [mat-chrom = 1] + count humans with [pat-chrom = 1]) / (count humans * 2)) * 100 ]
  set-current-plot-pen "HbS"
  ifelse count humans = 0
  [ plot 0 ]
  [ plot ((count humans with [mat-chrom = 2] + count humans with [pat-chrom = 2]) / (count humans * 2 )) * 100 ]
end 

There are 12 versions of this model.

Uploaded by When Description Download
Sugat Dabholkar almost 8 years ago Design changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago deign Download this version
Sugat Dabholkar almost 8 years ago design and code changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago design changes Download this version
Sugat Dabholkar almost 8 years ago Design optimization Download this version
Sugat Dabholkar almost 8 years ago Code optimization Download this version
Sugat Dabholkar almost 8 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

Children:

Graph of models related to 'SCAv6.4'