Mendelian Inheritance in sunflowers

Mendelian Inheritance in sunflowers 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.0.4 • Viewed 91 times • Downloaded 2 times • Run 0 times
Download the 'Mendelian Inheritance in sunflowers' 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

globals [x y p1 p2 population-size]    ;p1=selected parent 1, p2=selected parent 2,
turtles-own [c1 c2 c3 c4 genotype phenotype f-color inflorescence disc-flower]

breed [gametes gamete]
breed [flowers flower]
breed [leaves a-leaf]
breed [crosses cross]

to setup
ca

  set-ground
  set-gametes
  fertilization-1
  set-leaves
  set-cross

reset-ticks
end 

to gamete-trait
    set size 0.1
    set color white
    set shape "dot"
    setxy random-xcor random-ycor
end 

to set-gametes        ;produce gametes

    create-gametes (50 + random 20) * 2
  [gamete-trait
    if cases = "Case 1" [                 ;monohybrid case 1--flower color
      set c1 item random 3 ["Y" "y" "y"]      ;produce two alleles for gene Y. Produce more y than Y to deviate from ratio of 3:1
      set c2 "s"
      set c3 "C"
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 2" [                 ;monohybrid case 2--Inflorescence
      set c1 "y"
      set c2 item random 3 ["S" "s" "s"]      ;produce two alleles for gene S. Produce more s than S to deviate from ratio of 3:1
      set c3 "C"
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 3" [                 ;monohybrid case 3--disc-flower
      set c1 "Y"
      set c2 "s"
      set c3 item random 3 ["C" "c" "c"]      ;produce two alleles for gene C. Produce more c than C to deviate from ratio of 3:1
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 4" [                 ;dihybrid--flower color and inflorescence
      set c1 item random 3 ["Y" "y" "y"]
      set c2 item random 3 ["S" "s" "s"]
      set c3 "C"
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 5" [                 ;dihybrid--disc-flower and inflorescence
      set c1 "y"
      set c2 item random 3 ["S" "s" "s"]
      set c3 item random 3 ["C" "c" "s"]
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 6" [                 ;dihybrid--flower color and disc-flower
      set c1 item random 3 ["Y" "y" "y"]
      set c2 "s"
      set c3 item random 3 ["C" "c" "c"]
      set genotype word c1 c2
      set genotype word genotype c3]

    if cases = "Case 7" [                 ;trihybrid--flower color, inflorescence and disc-flower
      set c1 item random 3 ["Y" "y" "y"]
      set c2 item random 3 ["S" "s" "s"]
      set c3 item random 3 ["C" "c" "s"]
      set genotype word c1 c2
      set genotype word genotype c3]
  ]
end 

to fertilization-1     ;self-cross procedure

  ask gametes [
    let mate one-of other gametes
    if mate != nobody
    [hatch-flowers 1
      [set genotype word genotype [genotype] of mate
       expression
       arrange-genotype
       set-position
        set size 0.9
       ]
    ]
    ask mate [die]
    die]

  ;ask-concurrent flowers [grow]
end 

to fertilization-2    ;test cross procedure

  ask gametes with [color = white] [
    let mate one-of gametes with [color = black]
    if mate != nobody
    [hatch-flowers 1
      [set genotype word genotype [genotype] of mate
        expression
        arrange-genotype
       set-position
        set size 0.9
       ]
    ]
    ask mate [die]
    die]

  ;ask-concurrent flowers [grow]
end 

to arrange-genotype
  set c1 item 0 genotype      ;read 1st allele
  set c2 item 3 genotype      ;read 4th allele
  set c1 word c1 c2           ;set the 1st pair of alleles
  if member? "yY" c1 [set c1 "Yy"]  ;rearrange alleles

  set c2 item 1 genotype      ;read 2nd allele
  set c3 item 4 genotype      ;read 5th allele
  set c2 word c2 c3           ;set the 2nd pair of alleles
  if member? "sS" c2 [set c2 "Ss"]  ;rearrange alleles


  set c3 item 2 genotype      ;read 3rd allele
  set c4 item 5 genotype      ;read 6th allele
  set c3 word c3 c4           ;set the 3rd pair of alleles
  if member? "cC" c3 [set c3 "Cc"]  ;rearrange alleles

  set genotype word c1 c2     ;connect the three pairs of alleles
  set genotype word genotype c3     ;connect the three pairs of alleles
end 

to expression

  ifelse member? "Y" genotype = true [set f-color "yellow" set color 45 + random-float 0.5 ]
                                     [set f-color "orange" set color 24.5 + random-float 0.5]
  ifelse member? "S" genotype = true [set inflorescence "chrysanthemum-type" ifelse member? "C" genotype = true [set shape "sunflower" set disc-flower "purple-disc"][set shape "sunflower-0" set disc-flower "yellow-disc"]]
                                     [set inflorescence "normal-type" ifelse member? "C" genotype = true [set shape "sunflower-2" set disc-flower "purple-disc" ][set shape "sunflower-1" set disc-flower "yellow-disc"]]
end 

to set-cross

  create-crosses 1
  [set size 1.2
    set color 49
    set shape "square-1"
    setxy max-pxcor - 0.5 max-pycor - .5]

  create-crosses 1
  [set size 0.5
    set color 49
    set shape "x"
    setxy max-pxcor - 0.5 max-pycor - 1.5]

  create-crosses 1
  [set size 1.2
    set color 49
    set shape "square-1"
    setxy max-pxcor - 0.5 max-pycor - 2.5]
end 

to set-ground
  ask patches [set pcolor 52.5 + random-float 0.5]
  ask patches with [pxcor >= max-pxcor - 1] [set pcolor 0]
end 

to grow
  wait 0.01
  if size < 0.9 [set size size + 0.03]
  if size < 0.9 [grow]
end 

to set-leaves

create-leaves 7 + random 4
  [
    set shape "stem-2"
    setxy max-pxcor - random-float 1.2 0.2 + min-pycor + random-float 2.5
    set size 1.5 - [ycor] of self * 0.2
    set color 55 - ([ycor] of self) * 0.75
  ]
end 

to set-position
  setxy random (max-pxcor - 1) random (max-pycor + 1)
  if any? other flowers-here [set-position]
end 

to pick

 clear-output
  if mouse-inside? [
    if mouse-down? [
      set x round mouse-xcor set y round mouse-ycor
      ask flowers with [xcor = x and ycor = y]
        [ifelse count flowers with [pxcor >= (max-pxcor - 1)] > 0 [setxy max-pxcor - 0.5 max-pycor - 2.5 set size 1.1][setxy max-pxcor - 0.5 max-pycor - 0.5 set size 1.1]
  ]]]


 if count flowers with [pxcor >= max-pxcor - 1] = 2 [     ;clean up the last generations when 2 parents are chosen

    let mom flowers with [ycor = max-pycor - 0.5]
    let dad flowers with [ycor = max-pycor - 2.5]

    set p1 [f-color] of mom    ;set phenotype color inflorescence disc-flower
    set p1 word p1 " "
    set p1 word p1 [inflorescence] of mom
    set p1 word p1 " "
    set p1 word p1 [disc-flower] of mom



    set p2 [f-color] of dad  ;set phenotype
    set p2 word p2 " "
    set p2 word p2 [inflorescence] of dad
    set p2 word p2 " "
    set p2 word p2 [disc-flower] of dad



    ask flowers with [pxcor < max-pxcor - 1 ] [die]
    ask gametes [die]

    stop
     ]
end 

to gametogenesis-1        ;self-cross

  set population-size (70 + random 21 ) * 2

    repeat population-size [
    ask flowers [
      ifelse member? "Y" genotype = true [ifelse member? "y" genotype = true [set c1 item random 2 ["Y" "y"]][set c1 "Y"]][set c1 "y"]
      ifelse member? "S" genotype = true [ifelse member? "s" genotype = true [set c2 item random 2 ["S" "s"]][set c2 "S"]][set c2 "s"]
      ifelse member? "C" genotype = true [ifelse member? "c" genotype = true [set c3 item random 2 ["C" "c"]][set c3 "C"]][set c3 "c"]

      hatch-gametes 1[
      set genotype word c1 c2
      set genotype word genotype c3
      gamete-trait
      ]
  ]]

  ask flowers [die]
end 

to gametogenesis-2         ;test cross

  set population-size 60 + random 31

  let mom flowers with [ycor = max-pycor - 0.5]
  let dad flowers with [ycor = max-pycor - 2.5]


    repeat population-size [
      ask mom [ifelse member? "Y" genotype = true [ifelse member? "y" genotype = true [set c1 item random 2 ["Y" "y"]][set c1 "Y"]][set c1 "y"]
      ifelse member? "S" genotype = true [ifelse member? "s" genotype = true [set c2 item random 2 ["S" "s"]][set c2 "S"]][set c2 "s"]
      ifelse member? "C" genotype = true [ifelse member? "c" genotype = true [set c3 item random 2 ["C" "c"]][set c3 "C"]][set c3 "c"]

      hatch-gametes 1 [
      set genotype word c1 c2
      set genotype word genotype c3
      gamete-trait

  ]]]

  repeat population-size [
      ask dad [
      ifelse member? "Y" genotype = true [ifelse member? "y" genotype = true [set c1 item random 2 ["Y" "y"]][set c1 "Y"]][set c1 "y"]
      ifelse member? "S" genotype = true [ifelse member? "s" genotype = true [set c2 item random 2 ["S" "s"]][set c2 "S"]][set c2 "s"]
      ifelse member? "C" genotype = true [ifelse member? "c" genotype = true [set c3 item random 2 ["C" "c"]][set c3 "C"]][set c3 "c"]

      hatch-gametes 1 [
      set genotype word c1 c2
      set genotype word genotype c3
      gamete-trait
      set color black
  ]]]

  ask mom [die]
  ask dad [die]
end 

There are 7 versions of this model.

Uploaded by When Description Download
lin xiang 5 months ago remove ask-concurrent Download this version
lin xiang 5 months ago The number of gametes are adjusted at the beginning of a case. Download this version
lin xiang 6 months ago fix self pollination error Download this version
lin xiang 6 months ago fix the cross pollination error Download this version
lin xiang 6 months ago Phenotype expression is updated. Download this version
lin xiang 6 months ago Ask-concurrent is removed from the online version. Download this version
lin xiang 6 months ago Initial upload Download this version

Attached files

File Type Description Last updated
Mendelian Inheritance in sunflowers.png preview Preview for 'Mendelian Inheritance in sunflowers' 6 months ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.