Inheritance-Linkage

Inheritance-Linkage 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.2 • Viewed 159 times • Downloaded 44 times • Run 0 times
Download the 'Inheritance-Linkage' modelDownload this modelEmbed this model

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

globals [x y p1 p2 population-size]    ;p1=selected parent 1, p2=selected parent 2,
turtles-own [c1 c2 genotype phenotype gender eye-color wing-shape body-color body-color-1]

breed [sperms sperm]
breed [eggs egg]
breed [flies a-fly]
breed [crosses cross]

to setup
  ca
  set-gametes
  fertilization
  set-tray
  output-results
  reset-ticks
end 

to set-gametes

set population-size 15 + random 16

if Cases = "Case 1" [              ;sex-linked eye color character. In this case, the linkage between eye color and sex can be explored.
  create-sperms population-size
  [gamete-trait
    set c1 item random 3 ["XA" "Xa" "Y"]     ;given the three possoibilities, the gender ratio does not start with 1:1 at the beginning but brias to female
    set c2 "BV"                              ;all flies are long-winged with a light body color
    set genotype word c1 c2                  ;form  genotype of gamete
    ]

  create-eggs population-size
  [gamete-trait
    set c1 item random 2 ["XA" "Xa"]
    set c2 "BV"
    set genotype word c1 c2
    ]
  ]

   if Cases = "Case 2" [             ;dihybrid cross  eye color vs body color
   create-sperms population-size
  [gamete-trait
    set c1 item random 3 ["XA" "Xa" "Y"]         ; A and a are  red-eyed and white-eyed alleles.
    set c2 item random 2 ["BV" "Bv"]        ; V and v are wing shape color alleles.
    set genotype word c1 c2
    ]

  create-eggs population-size
  [gamete-trait
    set c1 item random 2 ["XA" "Xa"]
    set c2 item random 2 ["BV" "Bv"]
    set genotype word c1 c2
    ]
  ]



 if Cases = "Case 3" [             ;non-sex-linked wing character & linkage characters. This case is more complicated. Students can explore the linkage between wing shape and body color, and the relatinship between the two chracters and the sex ratio.
   create-sperms population-size
  [gamete-trait
    set c1 item random 2 ["XA" "Y"]         ; All flies are red-eyed.
    set c2 item random 2 ["BV" "bv"]        ; genes B and V are linked, not cross-over in this case
    set genotype word c1 c2
    ]

  create-eggs population-size
  [gamete-trait
    set c1 "XA"
    set c2 item random 2 ["BV" "bv"]
    set genotype word c1 c2
    ]
  ]



  if Cases = "Case 4" [             ;sex- and non-sex linkage characters.  White-eyed allele is added in.
   create-sperms population-size
  [gamete-trait
    set c1 item random 3 ["XA" "Xa" "Y"]
    set c2 item random 2 ["BV" "bv"]
    set genotype word c1 c2
    ]

  create-eggs population-size
  [gamete-trait
    set c1 item random 2 ["XA" "Xa"]
    set c2 item random 2 ["BV" "bv"]
    set genotype word c1 c2
    ]
  ]
end 

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

to express

  ;;Determine phenotypes based on the allele, then code the phenotypes
  ifelse member? "Y" genotype = true [set gender "male" set size 0.7 set phenotype "m-" ][set gender "female" set size 0.8 set phenotype "f-"]
  ifelse member? "XA" genotype = true [set eye-color "Red-eyed" set phenotype word phenotype "r-"][set eye-color "White-eyed" set phenotype word phenotype "w-"]
  ifelse member? "V" genotype = true [set wing-shape "Long-winged" set phenotype word phenotype "lw-"][set wing-shape "Vestigial-winged" set phenotype word phenotype "vw-"]
  ifelse member? "B" genotype = true [set body-color "Light body" set phenotype word phenotype "lb"][set body-color "Black body" set phenotype word phenotype "bb"]


  ;;Determine the shape and color using phenotype codes
  if phenotype = "m-r-lw-lb" [set shape "fly-m-r-lw"]
  if phenotype = "m-r-lw-bb" [set shape "fly-m-r-lw" set color 20.5]
  if phenotype = "m-r-vw-lb" [set shape "fly-m-r-vw"]
  if phenotype = "m-r-vw-bb" [set shape "fly-m-r-vw" set color 20.5]
  if phenotype = "m-w-lw-lb" [set shape "fly-m-w-lw"]
  if phenotype = "m-w-lw-bb" [set shape "fly-m-w-lw" set color 20.5]
  if phenotype = "m-w-vw-lb" [set shape "fly-m-w-vw"]
  if phenotype = "m-w-vw-bb" [set shape "fly-m-w-vw" set color 20.5]

  if phenotype = "f-r-lw-lb" [set shape "fly-f-r-lw"]
  if phenotype = "f-r-lw-bb" [set shape "fly-f-r-lw" set color 20.5]
  if phenotype = "f-r-vw-lb" [set shape "fly-f-r-vw"]
  if phenotype = "f-r-vw-bb" [set shape "fly-f-r-vw" set color 20.5]
  if phenotype = "f-w-lw-lb" [set shape "fly-f-w-lw"]
  if phenotype = "f-w-lw-bb" [set shape "fly-f-w-lw" set color 20.5]
  if phenotype = "f-w-vw-lb" [set shape "fly-f-w-vw"]
  if phenotype = "f-w-vw-bb" [set shape "fly-f-w-vw" set color 20.5]
end 

to fertilization

  ask eggs
  [let mate one-of sperms
    if mate != nobody
    [hatch-flies 1
     [set color 28
       set heading 0
       set genotype word genotype [genotype] of mate
       express
       set-position
      ]
      ask mate [die]
      die
  ]]

  ask sperms [die]
  ask eggs [die]
end 

to set-tray
  ask patches [set pcolor 113 + random-float 0.5]
  ask patches with [pxcor >= max-pxcor - 1] [set pcolor 87]

  create-crosses 1
   [set shape "x"
    setxy max-pxcor - 0.5 max-pycor / 2
    set size 0.5
    set color 35]

  create-crosses 1 [
    set shape "female"
    set heading 45
    setxy max-pxcor + 0.25 5
    set size 0.75
    set color 0]

 create-crosses 1 [
    set shape "male"
    set heading 45
    setxy max-pxcor + 0.25 min-pycor + 0.25
    set size 0.75
    set color 0]
end 

to set-position
  setxy random 10 random 7
  if any? other flies-here [set-position]
end 

;====================================================================================

to go

  ifelse count flies != 2
[user-message "Please choose parent flies at first."]
[
    gametogenesis
    fertilization
]
end 

to pick

 clear-output
  if mouse-inside? [
    if mouse-down? [
      set x round mouse-xcor set y round mouse-ycor
      ask flies with [xcor = x and ycor = y]
        [ if gender = "male"
            [ifelse count flies with [gender = "male" and pxcor >  max-pxcor - 1] > 0
                [user-message "You have chosen a male"][set size 1.25 setxy max-pxcor - 0.5 1.5]
                ]
          if gender = "female"
            [
              ifelse count flies with [pxcor > max-pxcor - 1 and gender = "female"] > 0
                [user-message "You have chosen a female"][set size 1.25 setxy max-pxcor - 0.5 4.5]
                ]
  ]]]


 if count flies with [pxcor >= max-pxcor - 1] = 2 [

  let mom flies with [pxcor >= max-pxcor - 1 and gender = "female"]
  let dad flies with [pxcor >= max-pxcor - 1 and gender = "male"]

    set p1 [eye-color] of mom
    set p1 word p1 " "
    set p1 word p1 [wing-shape] of mom
    set p1 word p1 " "
    set p1 word p1 [body-color] of mom



    set p2 [eye-color] of dad
    set p2 word p2 " "
    set p2 word p2 [wing-shape] of dad
    set p2 word p2 " "
    set p2 word p2 [body-color] of dad



  ask flies with [pxcor < max-pxcor - 1 ] [die]
  ask eggs [die]
  ask sperms [die]
  stop
  ]
end 

to gametogenesis

set population-size 60 + random 11

  repeat population-size [                                                                                 ;form the defined amount of eggs
    ask flies with [gender = "female"] [
    if member? "XA" genotype = true and member? "Xa" genotype = true [set c1 item random 2 ["XA" "Xa"]]    ;if heterozygous, pick 1 of 2 alleles as c1
    if member? "XA" genotype = true and member? "Xa" genotype = false [set c1 "XA"]                        ;if homozygous, pick present allele as c1
    if member? "XA" genotype = false and member? "Xa" genotype = true [set c1 "Xa"]

    if member? "B" genotype = true and member? "V" genotype = true [
        if member? "b" genotype = false and member? "v" genotype = false [set c2 "BV"]         ;BVBV
        if member? "b" genotype = false and member? "v" genotype = true  [set c2 item random 2 ["BV" "Bv"]]   ;BVBv
        if member? "b" genotype = true and member? "v" genotype = false  [set c2 item random 2 ["BV" "bV"]]   ;BVbV
        if member? "b" genotype = true and member? "v" genotype = true
             [if member? "BV" genotype = true [
                        ifelse random 100 > 5 [set c2 item random 2 ["BV" "bv"]] [set c2 item random 2 ["Bv" "bV"]]] ;BVbv cross over
              if member? "Bv" genotype = true [
                  ifelse random 100 > 5 [set c2 item random 2 ["Bv" "bV"]] [set c2 item random 2 ["BV" "bv"]]]]] ;Bvbv cross over


    if member? "B" genotype = true and member? "V" genotype = false [ifelse member? "bv" genotype = true [set c2 item random 2 ["Bv" "bv"]][set c2 "Bv"]]  ;B_vv
    if member? "B" genotype = false and member? "V" genotype = true [ifelse member? "bv" genotype = true [set c2 item random 2 ["bV" "bv"]][set c2 "bV"]]  ;bbV_
    if member? "B" genotype = false and member? "V" genotype = false [ set c2 "bv"]                                                                       ;bbvv

      hatch-eggs 1 [set genotype word c1 c2 gamete-trait]                                                    ;form genotype of the egg
  ]]

  repeat population-size [
    ask flies with [gender = "male"] [
    if member? "XA" genotype = true [set c1 item random 2 ["XA" "Y"]]
    if member? "Xa" genotype = true [set c1 item random 2 ["Xa" "Y"]]

    if member? "B" genotype = true and member? "V" genotype = true [
        if member? "b" genotype = false and member? "v" genotype = false [set c2 "BV"]         ;BVBV
        if member? "b" genotype = false and member? "v" genotype = true  [set c2 item random 2 ["BV" "Bv"]]   ;BVBv
        if member? "b" genotype = true and member? "v" genotype = false  [set c2 item random 2 ["BV" "bV"]]   ;BVbV
        if member? "b" genotype = true and member? "v" genotype = true
             [if member? "BV" genotype = true [
                        ifelse random 100 > 5 [set c2 item random 2 ["BV" "bv"]] [set c2 item random 2 ["Bv" "bV"]]] ;BVbv cross over
              if member? "Bv" genotype = true [
                  ifelse random 100 > 5 [set c2 item random 2 ["Bv" "bV"]] [set c2 item random 2 ["BV" "bv"]]]]] ;Bvbv cross over


    if member? "B" genotype = true and member? "V" genotype = false [ifelse member? "bv" genotype = true [set c2 item random 2 ["Bv" "bv"]][set c2 "Bv"]]  ;B_vv
    if member? "B" genotype = false and member? "V" genotype = true [ifelse member? "bv" genotype = true [set c2 item random 2 ["bV" "bv"]][set c2 "bV"]]  ;bbV_
    if member? "B" genotype = false and member? "V" genotype = false [ set c2 "bv"]                                                                       ;bbvv
    hatch-sperms 1 [set genotype word c1 c2 gamete-trait]
  ]]

  ask flies [die]
end 

to output-results

 if cases = "Case 1" [
  output-type "Use case 1 to explore the inheritance patterns between eye color and gender."
  ]

 if cases = "Case 2" [
  output-type "Use case 2 to explore the inheritance patterns between eye color and wing shape."
  ]

  if cases = "Case 3" [
  output-type "Use case 3 to explore the inheritance patterns between wing shape and body color."
  ]

  if cases = "Case 4" [
  output-type "Use case 4 to explore the inheritance patterns among eye color, gender, wing shape and body color."
  ]
end 

There are 3 versions of this model.

Uploaded by When Description Download
lin xiang 6 months ago fix bug Download this version
lin xiang 6 months ago fix bugs Download this version
lin xiang 6 months ago Initial upload Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.