Selection in Guppies

Selection in Guppies preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 226 times • Downloaded 19 times • Run 0 times
Download the 'Selection in Guppies' modelDownload this modelEmbed this model

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


WHTAT IS IT

In this model you will investigate guppy coloration patterns in various habitats and infer the underlying selection mechanisms.

CREDITS AND REFERENCES

This model is made by Dr. Lin Xiang at the University of Kentucky. If you mention this model in a publication, we ask that you include the citations below.

Xiang, L. (2015). Selection in Guppies. Department of STEM Education, University of Kentucky, Lexington, KY.

CC BY-NC-SA 4.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/.

Comments and Questions

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

Click to Run Model

globals [ ]

turtles-own [age]

breed [guppies guppy]
breed [weeds weed]
breed [pebbles pebble]
breed [predators predator]

to-report brightest-guppy
  report max [color] of guppies-here
end 

;;;;;;;;;;;;;;;;;;;;;;;;

to setup
 set-default-shape weeds "weed"
 set-default-shape pebbles "pebble"
 set-default-shape predators "predator"
 ca
  setup-bk
 setup-weed random 3
 setup-pebble 100
 set-guppies
 reset-ticks
end 

to set-guppies
  set-brightest-guppies
  set-bright-guppies
  set-drab-guppies
  set-drabbest-guppies
end 

to set-brightest-guppies
 create-guppies Initial-number-of-fish * ( 1 - bright-drab-ratio) * 0.5
  [set size 10
   set color 10.5 + random-float 2.25
   set-shape
   set age random 6
   set-position
    if any? other guppies-on patch-here [set-position] ]
end 

to set-bright-guppies
  create-guppies Initial-number-of-fish * ( 1 - bright-drab-ratio) * 0.5
  [set size 8
   set color 12.75 + random-float 2.25
   set-shape
   set age random 6
   set-position
    if any? other guppies-on patch-here [set-position] ]
end 

to set-drab-guppies
  create-guppies Initial-number-of-fish * bright-drab-ratio * 0.5
  [set size 8
   set color 15 + random-float 2.25
   set-shape
   set age random 6
   set-position
    if any? other guppies-on patch-here [set-position] ]
end 

to set-drabbest-guppies
 create-guppies Initial-number-of-fish * bright-drab-ratio * 0.5
  [set size 8
   set color 17.25 + random-float 2
   set-shape
   set age random 6
   set-position
    if any? other guppies-on patch-here [set-position] ]
end 

to set-shape
   if color >= 17.25 [set shape "guppy-drabbest"]
   if color < 17.25 and color >=  15 [set shape "guppy-drab"]
   if color < 15 and color >=  12.75 [set shape "guppy-bright"]
   if color < 12.75 [set shape "guppy-brightest"]
end 

to set-position
  setxy random-xcor random-ycor
end 

to setup-pebble [number]
create-pebbles number
 [set color 32 + random-float 6
    set size 4
    setxy min-pxcor + random (abs min-pxcor * 2) min-pycor + random 5]
end 

to setup-weed [number]
 create-weeds 1 + number
  [set color 61.5 + random-float 2
    if color = pcolor [ifelse random 2 = 0 [set color pcolor + 0.5][set color pcolor - 0.5]]
    set size 30
    setxy random-xcor  min-pxcor + 20 + random 3]
end 

to setup-bk
  ask patches
  [set pcolor 74.75]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go

 if ticks >= months * 10 [user-message "The trial has reached the defined time. Click 'setup' to restart the experiment or incease the time to extend the trial." stop]
 if count guppies = 0 [user-message "All guppies die." stop]

    swim
  grow
    Habitation
    death
    over-population

   tick
end 

to grow
  ask guppies
  [set age age + 0.5
  if size < 8 [set size size + 0.5]]
end 

to swim
  ask guppies [ifelse any? other guppies-on patch-ahead 1 [rt random 360]
                            [ifelse random 10 = 0 [rt random 30 lt random 30 ifelse any? other guppies-on patch-ahead 1 [swim][fd 2 ]]
                                                    [fd 0.5 ]]]
end 

to habitation
  if Habitat = "Habitat 1"
  [
    survive-H
    reproduce
    ]

  if Habitat = "Habitat 2"
  [
    reproduce]

  if Habitat = "Habitat 3"
  [
    survive-L
    reproduce
    ]
end 

to survive-H
  ask guppies [
    if random-float 2750 < abs (color - 19.5) ^ 2 [die]
  ]
end 

to survive-L
  ask guppies [
    if random-float 500 < abs (color - 19.5) ^ 2 [die]
  ]
end 

to preying
  rt random 30 lt random 30 fd 1
  if random 500 = 0[
  let prey one-of guppies with-max [color]
  if prey != nobody
   [ask prey [die]]]
end 

to reproduce
 ask guppies with [age >= 4 and size >=  8]
 [ if color >= 17.25 [if random 60 < abs (color - 20) [hatch-baby 1]]
   if color < 17.25 and color >=  15 [if random 72 < abs (color - 20) [hatch-baby 1]]
   if color < 15 and color >=  12.75 [if random 90 < abs (color - 20) [hatch-baby 1]]
   if color < 12.75 [if random 100 < abs (color - 20) [hatch-baby 1]]
 ]
end 

to hatch-baby [number]
  hatch-guppies number [
                   set age 0
                   set size 4
                   set-position
    ifelse random-float 100 < 5
        [ifelse random 2 = 0 [set color color + random-float mutate-range][set color color - random-float mutate-range]]
                                [set color color]
                                if color > 19.5 [set color 19]
                                if color < 10.5 [set color 11]
                                set-shape
  ]
end 

to death
  ask guppies [if age >= 20 [die]]
end 

to over-population
ask guppies[  if count guppies > Habitat_Capacity [if random 2 = 0 [die]]]
end 

There are 4 versions of this model.

Uploaded by When Description Download
lin xiang almost 3 years ago Refine the time parameter Download this version
lin xiang almost 3 years ago clean up the unnecessary procedure Download this version
lin xiang almost 3 years ago update license Download this version
lin xiang about 7 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Selection in Guppies.png preview Preview for 'Selection in Guppies' about 7 years ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.