DNA Protein Synthesis

DNA Protein Synthesis preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

ccl 

Tagged by Uri Wilensky over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 439 times • Downloaded 44 times • Run 0 times
Download the 'DNA Protein Synthesis' 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

Click to Run Model

;;;;;;;;;;;;; DNA molecules  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
breed [genes gene]                          ;; keeps a list of the dna code for a given gene
breed [nucleotides nucleotide]              ;; the pieces that are inside the dna chain
breed [promoters promoter]                  ;; a visualization agent (similar to a promoter protein) that attaches to every start codon location in a DNA chain
breed [terminators terminator]              ;; a visualization agent that attaches to every stop codon location in a DNA chain

;;;;;;;;;;;;; mRNA molecules  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
breed [mRNA-nucleotides mRNA-nucleotide]    ;; the pieces that are inside the mRNA chain
breed [mRNAs mRNA]                          ;; the tail ends of the mRNA chain   

;;;;;;;;;;;;; trna molecules  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;      
breed [tRNAs tRNA]                          ;; the center piece of the tRNA complex
breed [tRNA-nucleotides tRNA-nucleotide]    ;; the pieces that are inside the tRNA complex
breed [amino-acids amino-acid]              ;; the top part of the tRNA complex

;;;;;;;;;;;;; protein molecules  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     
breed [proteins protein]                    ;; holds proteins information

;;;;;;;;;;;;; tags for supporting a fine tuned placement of labels ;;;;;;;;;;;;;
breed [tags tag]                 

;;;;;;;;;;;;; links ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
undirected-link-breed [taglines tagline]    ;; the link between an agent and where its label agent is.  This allows fine tuned placement of visualizing of labels
directed-link-breed   [backbones backbone]  ;; the link between adjacent amino acids in a protein.  Tt will allows the entire protein to be folded up (not currently implemented)

;;;;;;;;;;;;;;;;;;;turtle variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
genes-own            [gene-number strand code start-position end-position]
mRNAs-own            [gene-number strand code cap-type traveling? released?]
promoters-own        [gene-number strand]
terminators-own      [gene-number strand]
tRNAs-own            [gene-number strand]
proteins-own         [gene-number strand value]
amino-acids-own      [gene-number strand value place]
nucleotides-own      [gene-number strand value place]                                  
mRNA-nucleotides-own [gene-number strand value place] 
tRNA-nucleotides-own [gene-number strand value place] 
tags-own             [value]                               ; the value for the label of the agent it is linked to when visualized.  



;;;;;;;;;;;;;globals ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

globals [

  current-instruction               ;; holds counter value for which instruction is being displayed
  codon-to-amino-acid-key           ;; holds lookup table for codon triplet to amino acid
  original-dna-string               ;; holds a string of the original DNA
  duplicate-dna-string              ;; holds a string of the duplicate DNA.  This changes every time the replicate DNA button is pressed

  ;; position values for visualization
  duplicate-ribosome-ycor 
  original-ribosome-ycor
  duplicate-dna-ycor 
  original-dna-ycor 
  nucleotide-spacing
  
  ;; colors for various agents and states of agents
  nucleo-tag-color
  terminator-color
  gene-color-counter
  
  ;; counters for the number of genes
  original-strand-gene-counter       
  duplicate-strand-gene-counter
  original-display-mrna-counter
  duplicate-display-mrna-counter
 
  mRNAs-traveling                    ;; list of mRNAs traveling
  mRNAs-released                     ;; list of mRNAs released
   
  ;; for keeping track of user initiated events 
  replicate-dna-event?
  show-genes-event?
  event-1-triggered?
  event-2-triggered?
  event-3-triggered?
  event-4-triggered?
  event-6-triggered?
  event-7-triggered?
  event-8-triggered?
  event-9-triggered?
  event-1-completed?
  event-2-completed?
  event-3-completed?
  event-4-completed?
  event-6-completed?
  event-7-completed?
  event-8-completed?
  event-9-completed?
]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;setup procedures;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to setup
  clear-all
  set replicate-dna-event? false
  set show-genes-event? false
  
  set event-1-triggered? false
  set event-2-triggered? false
  set event-3-triggered? false
  set event-4-triggered? false
  set event-6-triggered? false
  set event-7-triggered? false
  set event-8-triggered? false
  set event-9-triggered? false
  set event-1-completed? false
  set event-2-completed? false
  set event-3-completed? false
  set event-4-completed? false
  set event-6-completed? false
  set event-7-completed? false
  set event-8-completed? false
  set event-9-completed? false
 
  
  set mRNAs-traveling []                             
  set mRNAs-released  [] 
  set codon-to-amino-acid-key []
  set original-dna-string ""
  set duplicate-dna-string ""
  
  set duplicate-ribosome-ycor -7
  set original-ribosome-ycor 4
  set duplicate-dna-ycor -2
  set original-dna-ycor 1
  set gene-color-counter 1
  set nucleotide-spacing .45 
  
  set original-strand-gene-counter 0
  set duplicate-strand-gene-counter 0
  set original-display-mrna-counter 0
  set duplicate-display-mrna-counter 0
  
  set-default-shape promoters "start"
  set-default-shape terminators "end"
  set-default-shape tags "empty"
  
  set terminator-color      [255 0 0 150]
  set nucleo-tag-color      [255 255 255 120]

  initialize-codon-to-amino-acid-key
  setup-starting-dna
  visualize-all-genes
  ask patches [set pcolor blue - 4]
  ask patches with [pycor > 2]  [set pcolor blue - 3.5]
  ask patches with [pycor < 0]  [set pcolor green - 4]
  ask patches with [pycor < -3] [set pcolor green - 3.5]
  show-instruction 1
  reset-ticks
end 

to setup-starting-dna
  setup-dna-string
  build-genes-from-dna "original" original-dna-string
  make-a-nucleotide-chain-for-dna-string "original" original-dna-string
  place-dna "original"
  build-mrna-for-each-gene "original" 
  build-protein-from-mrna  "original"
  place-trnas "original"
  hide-mrna   "original"
  hide-trna   "original"
  hide-genes  "original"
end 



;; original-dna-string

to setup-dna-string
  if initial-dna-string = "from user-created-code" [set original-dna-string dna-string-with-non-nucleotide-characters-replaced user-created-code]  
  if initial-dna-string = "random (short strand)" [ 
    let initial-length-dna 12
    repeat initial-length-dna [set original-dna-string (word original-dna-string random-base-letter-DNA)]
  ]
  if initial-dna-string = "random (long strand)"  [
    let initial-length-dna 56
    repeat initial-length-dna [set original-dna-string (word original-dna-string random-base-letter-DNA)]
  ]
  if initial-dna-string = "no genes (short strand)" [set original-dna-string "ATTATATCGTAG"] 
  if initial-dna-string = "no genes (long strand)"  [set original-dna-string "GATATTTGGTAGCCCGAGAAGTGGTTTTTCAGATAACAGAGGTGGAGCAGCTTTTAG"]   
  if initial-dna-string = "1 short gene"            [set original-dna-string "ATTATGTGGTAG"]      
  if initial-dna-string = "1 long gene"             [set original-dna-string "GGGATGGACACCTTATCATTTGCTACTAGCGACCAGTTTGAGTAGCTTCGTCGGTGA"]
  if initial-dna-string = "2 sequential genes"      [set original-dna-string "AGTATGAAAACCCACGAGTGGTAGCCCGAGATTGAGATGTGGTTTTTCAGATAACAG"]  
  if initial-dna-string = "2 nested genes"          [set original-dna-string "GTTATGAGGGGGACCCGAGATGTGGTTTTTGAAATAGACAAGTAGACCCTAATAGAC"] 
  if initial-dna-string = "3 sequential genes"      [set original-dna-string "GATATGTGGTAGCCCGAGATGTGGTTTTTCAGATAACAGATGTGGAGCAGCTTTTAG"]   
end 

to place-dna [strand-type]
  let dna (turtle-set genes nucleotides promoters terminators)
  ask dna with [strand = strand-type][
    if strand-type = "original"  [set ycor original-dna-ycor]
    if strand-type = "duplicate" [set ycor duplicate-dna-ycor]
  ]
end 

to place-trnas [strand-type]
  ask trnas with [strand = strand-type] [
    if strand-type = "original"   [set ycor original-ribosome-ycor + 1]
    if strand-type = "duplicate"  [set ycor duplicate-ribosome-ycor + 1]
  ]
end 

to make-a-nucleotide-chain-for-dna-string [strand-type dna-string]
  let previous-nucleotide nobody
  let place-counter 0
  create-turtles 1 [
    set heading 90 
    fd 1 
    repeat (length dna-string) [
        hatch 1 [
          set breed nucleotides 
          set strand strand-type
          set value item place-counter dna-string
          set shape (word "nucleotide-" value) 
          set heading 0          
          set place place-counter
          attach-tag 5 0.5 value nucleo-tag-color
          set place-counter place-counter + 1
          ]
       fd nucleotide-spacing   
       ]
   die ;; remove the chromosome builder (a temporary construction turtle)
  ]
end 

to build-genes-from-dna [strand-type dna-string]
  let remaining-dna dna-string
  let this-item ""
  let last-item ""
  let last-last-item ""
  let triplet ""
  let item-position 0
  let last-item-kept length dna-string
  repeat (length dna-string) [
    let first-item item 0 remaining-dna
    set remaining-dna remove-item 0 remaining-dna
    set last-last-item last-item
    set last-item this-item
    set this-item first-item
    set triplet (word last-last-item last-item this-item)
    if triplet = "ATG" [
      create-genes 1 [
        set hidden? true   
        set strand strand-type
        if strand = "original"  [
          set original-strand-gene-counter original-strand-gene-counter + 1 
          set gene-number original-strand-gene-counter
        ]
        if strand = "duplicate" [
          set duplicate-strand-gene-counter duplicate-strand-gene-counter + 1 
          set gene-number duplicate-strand-gene-counter
        ]
        set start-position item-position
        set end-position ((length original-dna-string))
        set code (word triplet substring dna-string (item-position + 1) ((length dna-string) ) )        
        ]
     ]
     set item-position item-position + 1
  ]     
  ask genes [ 
    let end-of-gene? false
    let triplet-counter 0
    let new-code code
    repeat floor (length code / 3)  [
      let this-triplet (word  (item (0 + (triplet-counter * 3)) code)  (item (1 + (triplet-counter * 3)) code)  (item (2 + (triplet-counter * 3)) code) )
      if (this-triplet =  "TAG" or this-triplet = "TGA"  or this-triplet = "TAA") and not end-of-gene? [
        set end-position triplet-counter * 3 
        set new-code substring code 0 end-position
        set end-of-gene? true
      ]  
      set triplet-counter triplet-counter + 1  
    ]
    set triplet-counter 0
    set end-of-gene? false
    set code new-code
  ]
end 

to build-mRNA-for-each-gene [strand-type] 
  ask genes with [strand = strand-type] [
    let this-code code
    let this-gene self
    
    set heading 90
    fd .1
    repeat start-position [fd .45] ;; move over to correct nucleotide location on dna
   
    let gene-color next-gene-color
    let gene-color-with-transparency (sentence (extract-rgb gene-color) 110)
    let gene-color-label (sentence (extract-rgb gene-color) 250)
    ;; make promoter for start codon
    hatch 1 [
      set breed promoters
      set color gene-color-with-transparency 
      set size 3
      set hidden? false
      attach-tag 142 1.7 (word "start:" gene-number) gene-color-label
      create-backbone-from this-gene [set hidden? true set tie-mode "fixed" tie] 
      ;; make terminator for end codon
      hatch 1 [
        set breed terminators
        fd ((length this-code) * 0.45)
        attach-tag 142 1.7 (word "end:" gene-number) gene-color-label
        create-backbone-from this-gene [set hidden? true set tie-mode "fixed" tie] 
      ]
    ] 
     ;; make start cap for mRNA molecule
    hatch 1 [
      let this-mRNA self
      set breed mRNAs 
      set traveling? false
      set released? false
      set code mrna-string-from-dna-string code
      set cap-type "start"
      set shape "mrna-start"
      set hidden? false
      ;; associate the mRNA molecule with the parent gene
      create-backbone-from this-gene [set hidden? true set tie-mode "fixed" tie]   
      ;; build a stop cap for the mRNA molecule
      hatch 1 [
        set cap-type "stop" 
        set shape "mrna-stop"
        let nucleotide-counter 0 
        ;; associate the mRNA stop cap with the start cap
        create-backbone-from this-mRNA  [set hidden? true set tie-mode "fixed" tie] 
        ;; use the stop cap turtle to construct the mRNA nucleotides
        let code-to-transcribe code
        repeat length code [
          hatch 1 [
            set breed mRNA-nucleotides 
            set value first code-to-transcribe  
            set shape (word "mrna-" value) 
            set heading 180       
            attach-tag 175 0.9 value nucleo-tag-color  
            create-backbone-from this-mRNA  [set hidden? true set tie-mode "fixed" tie] 
          ]
          set code-to-transcribe remove-item 0 code-to-transcribe
          fd nucleotide-spacing           
        ] 
      ]
    ]
  ]   
end 

to build-protein-from-mrna [strand-type]
  ask mrnas with [cap-type = "start" and strand = strand-type] [
    let number-of-triplets-in-list floor ((length code) / 3) 
    let this-triplet ""
    let triplet-counter 0
    repeat number-of-triplets-in-list   [
      set this-triplet (word 
        complementary-mRNA-base  (item (0 + (triplet-counter * 3)) code) 
        complementary-mRNA-base  (item (1 + (triplet-counter * 3)) code) 
        complementary-mRNA-base  (item (2 + (triplet-counter * 3)) code)
        )
      build-tRNA-for-this-triplet  this-triplet triplet-counter
      set triplet-counter triplet-counter + 1
    ]
  ]
end 

to build-tRNA-for-this-triplet [this-triplet triplet-counter]
  let this-tRNA nobody  
  hatch 1 [
    set breed tRNAs 
    set this-tRNA self
    set shape "tRNA-core"
    set size 1.2
    set heading 0
    hatch 1 [
      set breed amino-acids 
      set value  (which-protein-for-this-codon this-triplet)
      set shape (word "amino-" value)
      set heading 0
      set size 2
      fd 1
      create-backbone-from this-tRNA  [set hidden? true set tie-mode "free" tie] 
      attach-tag 20 .8 value nucleo-tag-color  
    ]
    hatch 1 [
      set breed tRNA-nucleotides
      set shape (word "trna-" (item 0 this-triplet)) 
      set heading -155
      fd 1.1
      set heading 0  
      create-backbone-from this-tRNA  [set hidden? true set tie-mode "fixed" tie]       
      hatch 1 [
        set breed tRNA-nucleotides
        set shape (word "trna-" (item 1 this-triplet)) 
        set heading 90
        fd .45
        set heading 0 
        create-backbone-from this-tRNA  [set hidden? true set tie-mode "fixed" tie] 
      ]
      hatch 1 [
        set breed tRNA-nucleotides
        set shape (word "trna-" (item 2 this-triplet)) 
        set heading 90
        fd .90
        set heading 0   
        create-backbone-from this-tRNA  [set hidden? true set tie-mode "fixed" tie]          
      ]
    ]
    fd 1
    set heading 90
    fd nucleotide-spacing + ( nucleotide-spacing * 3 * triplet-counter )
    set heading 0
  ]
end 


;; fine tuned placement of the location of a label for a nucleoside or nucleotide

to attach-tag [direction displacement label-value color-value]  
  hatch 1 [
    set heading direction
    fd displacement
    set breed tags
    set label label-value
    set size 0.1
    set label-color color-value
    create-tagline-with myself [set tie-mode "fixed" set hidden? true tie]
  ]
end 



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;; visibility procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to visualize-all-genes
   ask (turtle-set promoters terminators)[ask link-neighbors [set hidden? not show-genes?] set hidden? not show-genes?]
end 

to hide-genes  [strand-type]
   ask (turtle-set promoters terminators)  with [strand = strand-type] [ask link-neighbors [set hidden? true] set hidden? true]
end 

to hide-mrna  [strand-type]
   ask (turtle-set mrnas mrna-nucleotides) with [strand = strand-type] [ask tagline-neighbors [set hidden? true] set hidden? true]   
end 

to hide-trna  [strand-type]
   ask (turtle-set trnas trna-nucleotides amino-acids) with [strand = strand-type] [ask tagline-neighbors [set hidden? true] set hidden? true]   
end 

to show-next-mrna  [strand-type]
  let these-genes genes with [strand = strand-type]
  if count these-genes = 0 [display-user-message-no-genes]
  if strand-type = "original" [   
    set original-display-mrna-counter original-display-mrna-counter + 1
    if (original-display-mrna-counter > count these-genes) [set original-display-mrna-counter 1]
    ask mrnas with [strand = strand-type and cap-type = "start"] [
      ifelse gene-number != original-display-mrna-counter 
        [ask out-backbone-neighbors [set hidden? true ask tagline-neighbors [set hidden? true] ] set hidden? true] 
        [ask out-backbone-neighbors [set hidden? false ask tagline-neighbors [set hidden? false] ] set hidden? false]
      set traveling? false set released? false set ycor original-dna-ycor
    ]    
  ]
  if strand-type = "duplicate" [  
    set duplicate-display-mrna-counter duplicate-display-mrna-counter + 1
    if (duplicate-display-mrna-counter > count these-genes) [set duplicate-display-mrna-counter 1]
    ask mrnas with [strand = strand-type and cap-type = "start"] [
      ifelse gene-number != duplicate-display-mrna-counter
        [ask out-backbone-neighbors [set hidden? true ask tagline-neighbors [set hidden? true] ] set hidden? true] 
        [ask out-backbone-neighbors [set hidden? false ask tagline-neighbors [set hidden? false]] set hidden? false]
      set traveling? false set released? false set ycor duplicate-dna-ycor
    ]    
  ]
end 

to show-next-trna  [strand-type]
  let this-gene-number gene-number-for-this-strand strand-type
  ask mrnas with [strand = strand-type and cap-type = "start" and released? and gene-number = this-gene-number ] [
    ask trnas with [strand = strand-type] [ 
      ifelse gene-number = this-gene-number 
        [ask out-backbone-neighbors [set hidden? false ask tagline-neighbors [set hidden? false] ] set hidden? false]
        [ask out-backbone-neighbors [set hidden? true ask tagline-neighbors [set hidden? true] ] set hidden? true] 
      ]
  ]
end 

to display-user-message-no-genes
  user-message "There are no genes in this strand of DNA. A specific sequence of 3 nucleotides is required for a gene"
end 

to release-next-protein  [strand-type]
  let make-protein? false
  let this-gene-number gene-number-for-this-strand strand-type
  ask mrnas with [strand = strand-type and cap-type = "start" and released?  and gene-number = this-gene-number ] [
    
    ask trnas with [strand = strand-type] [
      ifelse gene-number = this-gene-number
        [ask out-backbone-neighbors [
         set make-protein? true
         set hidden? true
           ifelse breed = amino-acids 
             [set hidden? false ask tagline-neighbors [set hidden? false] ] 
             [set hidden? true ask tagline-neighbors [set hidden? true] ] 
           ] 
         ]
         [ask out-backbone-neighbors [set hidden? true ask tagline-neighbors [set hidden? true] ] set hidden? true]
         set hidden? true
    ]
    if make-protein? [make-protein strand-type ]
  ]
end 

to make-protein [strand-type]
  let this-gene-number gene-number-for-this-strand strand-type
  let this-protein-value ""
  let these-amino-acids amino-acids with [breed = amino-acids and strand-type = strand and gene-number = this-gene-number]
  let ordered-amino-acids sort-on [who] these-amino-acids
  foreach ordered-amino-acids [set this-protein-value (word   this-protein-value "-" ([value] of ?))]
  if not any? proteins with [strand = strand-type and value = this-protein-value] [
      hatch 1 [set breed proteins set value this-protein-value set hidden? true setxy 0 0]
  ]
end 

to release-next-mRNA-from-nucleus [strand-type]
  ask mRNAs with [strand = strand-type][set traveling? true set released? false]    
end 

   

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; runtime procedures ;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  visualize-all-genes
  ;; these ? variables keep track of button press events being cued by the user
  if event-1-triggered?  [ show-next-mrna "original"                  set event-1-triggered? false  set event-1-completed? true set event-2-completed? false set event-3-completed? false set event-4-completed? false]
  if event-2-triggered? and event-1-completed?  [ release-next-mRNA-from-nucleus "original"  set event-2-triggered? false set event-3-completed? false set event-4-completed? false]
  if event-3-triggered? and event-2-completed?  [ show-next-trna "original"                  set event-3-triggered? false  set event-3-completed? true set event-4-completed? false]
  if event-4-triggered? and event-3-completed?  [ release-next-protein "original"            set event-4-triggered? false  set event-4-completed? true]

  if event-6-triggered?                        [ show-next-mrna "duplicate"                  set event-6-triggered? false set event-6-completed? true set event-7-completed? false set event-8-completed? false set event-9-completed? false]
  if event-7-triggered? and event-6-completed? [ release-next-mRNA-from-nucleus "duplicate"  set event-7-triggered? false set event-8-completed? false set event-9-completed? false]
  if event-8-triggered? and event-7-completed? [ show-next-trna "duplicate"                  set event-8-triggered? false set event-8-completed? true  set event-9-completed? false]
  if event-9-triggered? and event-8-completed? [ release-next-protein "duplicate"            set event-9-triggered? false set event-9-completed? true ]
  move-mRNA-molecules-out-of-nucleus 
  tick
end 

to move-mRNA-molecules-out-of-nucleus 
  ask mRNAs with [traveling? and cap-type = "start"] [
    if strand = "original" [
      if ycor < original-ribosome-ycor [ set ycor ycor + .1 ] 
      if ycor >= original-ribosome-ycor [ set traveling? false set released? true set event-2-completed? true]
    ]
    if strand = "duplicate" [
      if ycor > duplicate-ribosome-ycor [ set ycor ycor - .1] 
      if ycor <= duplicate-ribosome-ycor [ set traveling? false set released? true set event-6-completed? true]
    ]
  ]
end 

to show-protein-production
  clear-output
  let original-proteins proteins with [strand = "original"]
  output-print "Proteins Produced"
  output-print (word "from original DNA  = " count original-proteins)
  output-print "::::::::::::::::::"
  ask original-proteins [
    output-print (word "Orig.Gene #" gene-number " > Protein:")
    output-print value
    output-print ""
  ]
  output-print "=================="
  let duplicate-proteins  proteins with [strand = "duplicate"]
  output-print "Proteins Produced"
  output-print (word "from copy of DNA = " count duplicate-proteins)
  output-print "::::::::::::::::::"  
  ask duplicate-proteins [
    output-print (word "Copy.Gene #" gene-number " > Protein:")
    output-print value
    output-print ""
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;; make duplicate dna procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to make-duplicate-dna-string 
  let position-counter 0
  set duplicate-strand-gene-counter 0
  let clean-duplicate-dna-string original-dna-string
  let mutating-copy-of-dna-string original-dna-string

    let target-loci random ((length mutating-copy-of-dna-string) - #-nucleotides-affected)
    let dna-at-target item target-loci mutating-copy-of-dna-string
    let dna-before-target substring mutating-copy-of-dna-string 0 target-loci
    let loci-counter 0 
    let dna-at-and-after-target substring mutating-copy-of-dna-string target-loci length mutating-copy-of-dna-string
    
    if mutation-type = "deletion"     
      [repeat #-nucleotides-affected  [set  mutating-copy-of-dna-string remove-item target-loci mutating-copy-of-dna-string]]
    if mutation-type  = "substitution" 
      [repeat #-nucleotides-affected  [set  mutating-copy-of-dna-string (replace-item (target-loci + loci-counter) mutating-copy-of-dna-string random-base-letter-DNA) set loci-counter loci-counter + 1] ]
    if mutation-type  = "insertion"     
      [repeat #-nucleotides-affected [set  dna-at-and-after-target (word random-base-letter-DNA  dna-at-and-after-target) ] set mutating-copy-of-dna-string (word dna-before-target dna-at-and-after-target)]

 set duplicate-dna-string mutating-copy-of-dna-string
end 

to replicate-dna
  let turtles-to-remove (turtle-set nucleotides mrnas trnas genes promoters terminators amino-acids mrna-nucleotides)
  ;; (re)build the everything for the duplicate dna
  ask turtles-to-remove with [strand = "duplicate" ][ask tagline-neighbors [die] die]            ;; wipe out old nucleotides
  make-duplicate-dna-string  
  build-genes-from-dna "duplicate" duplicate-dna-string
  make-a-nucleotide-chain-for-dna-string "duplicate" duplicate-dna-string
  place-dna "duplicate"
  build-mrna-for-each-gene "duplicate" 
  build-protein-from-mrna "duplicate"
  place-trnas "duplicate"  
  hide-mrna   "duplicate"
  hide-trna   "duplicate"
  hide-genes  "duplicate"
end 



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;; initializing lists and strings ;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to initialize-codon-to-amino-acid-key
   set codon-to-amino-acid-key [
     ;;all triplets where the 2nd base is U
     ["UUU" "Phe"] ["UUC" "Phe"] ["UUA" "Leu"] ["UUG" "Leu"]
     ["CUU" "Leu"] ["CUC" "Leu"] ["CUA" "Leu"] ["CUG" "Leu"]
     ["AUU" "Ile"] ["AUC" "Ile"] ["AUA" "Ile"] ["AUG" "Met"] 
     ["GUU" "Val"] ["GUC" "Val"] ["GUA" "Val"] ["GUG" "Val"] 
     ;;all triplets where the 2nd base is C
     ["UCU" "Ser"] ["UCC" "Ser"] ["UCA" "Ser"] ["UCG" "Ser"]
     ["CCU" "Pro"] ["CCC" "Pro"] ["CCA" "Pro"] ["CCG" "Pro"]
     ["ACU" "Thr"] ["ACC" "Thr"] ["ACA" "Thr"] ["ACG" "Thr"] 
     ["GCU" "Ala"] ["GCC" "Ala"] ["GCA" "Ala"] ["GCG" "Ala"] 
     ;;all triplets where the 3rd base is A
     ["UAU" "Tyr"] ["UAC" "Tyr"] ["UAA" "Stop"] ["UAG" "Stop"]
     ["CAU" "His"] ["CAC" "His"] ["CAA" "Gln"] ["CAG" "Gln"]
     ["AAU" "Asn"] ["AAC" "Asn"] ["AAA" "Lys"] ["AAG" "Lys"] 
     ["GAU" "Asp"] ["GAC" "Asp"] ["GAA" "Glu"] ["GAG" "Glu"]    
     ;;all triplets where the 4th base is G
     ["UGU" "Cys"] ["UGC" "Cys"] ["UGA" "Stop"] ["UGG" "Trp"]
     ["CGU" "Arg"] ["CGC" "Arg"] ["CGA" "Arg"] ["CGG" "Arg"]
     ["AGU" "Ser"] ["AGC" "Ser"] ["AGA" "Arg"] ["AGG" "Arg"] 
     ["GGU" "Gly"] ["GGC" "Gly"] ["GGA" "Gly"] ["GGG" "Gly"]      
     ]
end 



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;; reporters ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;; returns values such as "Gly" for "GGA" or "Tyr" for "UAC" using the codon-to-amino-acid-key

to-report which-protein-for-this-codon [this-codon]
 report item 1 (item 0 filter [first ? = this-codon] codon-to-amino-acid-key )
end 

;;; reports a random base for a nucleotide in DNA 

to-report random-base-letter-DNA
  let r random 4
  let letter-to-report "" 
  if r = 0 [set letter-to-report "A"]
  if r = 1 [set letter-to-report "G"]
  if r = 2 [set letter-to-report "T"]
  if r = 3 [set letter-to-report "C"]
  report letter-to-report
end 

;;; reports a complementary base for a base pairing given the nucleotide from DNA or mRNA

to-report complementary-mRNA-base [base]
  let base-to-report ""
  if base = "A" [set base-to-report "U"]
  if base = "T" [set base-to-report "A"]
  if base = "U" [set base-to-report "A"]
  if base = "G" [set base-to-report "C"]
  if base = "C" [set base-to-report "G"]
  report base-to-report 
end 


;; cycles through next color in base-color list to assign to the next gene

to-report next-gene-color
  ifelse gene-color-counter >= (length base-colors) - 1
   [set gene-color-counter 0]
   [set gene-color-counter gene-color-counter + 1 ]
  report (item gene-color-counter base-colors)
end 

to-report gene-number-for-this-strand [strand-type]
  let this-gene-number 0
  if strand-type = "original"  [set this-gene-number original-display-mrna-counter]
  if strand-type = "duplicate" [set this-gene-number duplicate-display-mrna-counter]
  report this-gene-number
end 


;; reports the mrna code that gets transcribed from the dna

to-report mrna-string-from-dna-string [dna-string]
  let new-string dna-string
  let next-item 0 
  repeat length dna-string [
    set new-string (replace-item next-item new-string (complementary-mRNA-base (item next-item new-string))  )
    set next-item next-item + 1  
  ]
  report new-string
end 

;; reports a string of dna where any A, G, C, T letter is replaced with a random one of these, and any length beyond
;; characters is deprecated

to-report dna-string-with-non-nucleotide-characters-replaced [dna-string]
  let new-string dna-string
  let next-item 0 
  repeat length dna-string [
    set new-string (replace-item next-item new-string (replace-non-nucleotide-character (item next-item new-string))  )
    set next-item next-item + 1  
  ]
  if length dna-string > 64 [set new-string substring new-string 0 64]
  report new-string
end 

;; replaces any A, G, C, T letter is replaced with a random one of these

to-report replace-non-nucleotide-character [nucleotide-character]
   let character-to-return nucleotide-character
   if nucleotide-character != "A" and nucleotide-character != "T" and nucleotide-character != "C" and nucleotide-character != "G"
     [set character-to-return random-base-letter-DNA]
   report character-to-return
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;; instructions for players ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report current-instruction-label
  report ifelse-value (current-instruction = 0)
    [ "press setup" ]
    [ (word current-instruction " of " length instructions) ]
end 

to next-instruction
  show-instruction current-instruction + 1
end 

to previous-instruction
  show-instruction current-instruction - 1
end 

to show-instruction [ i ]
  if i >= 1 and i <= length instructions [
    set current-instruction i
    clear-output
    foreach item (current-instruction - 1) instructions output-print
  ]
end 

to-report instructions
  report [
    [
     "You will be simulating the process"
     "of protein synthesis from DNA that"
     "occurs in every cell.  And you will"
     "explore the effects of mutations"
     "on the proteins that are produced."
    ]
    [
     "When you press SETUP, a single"
     "strand of an unwound DNA molecule"
     "appears. This represents the state" 
      "of DNA in the cell nucleus during"
     "transcription."
    ]
    [
     "To produce proteins, each gene in"
     "the original DNA strand must be"
     "transcribed  into an mRNA molecule."  
     "Do this by pressing GO/STOP and"
     "then the 1-TRANSCRIBE button."
    ]
    [
     "For each mRNA molecule that was"
     "transcribed, press the 2-RELEASE"
     "button.  This releases the mRNA"
     "from the nucleus  into the ribosome" 
     "of the cell."
    ]
    [
     "For each mRNA molecule in the"
     "ribosome, press the 3-TRANSLATE"
     "button.  This pairs up molecules"
     "of tRNA with each set of three"
     "nucleotides in the mRNA molecule."
    ]
    [
      "For each tRNA chain built, press"
      "the 4-RELEASE button.  This"
      "releases the amino acid chain"
      "from the rest of the tRNA chain,"
      "leaving behind the protein"
      "molecule that is produced."
    ]
    [
      "Each time the 1-TRANSCRIBE"
      "button is pressed, the next gene"
      "in the original strand of DNA "
      "will be transcribed.  Press the 1-,"
      "2-, 3-, 4- buttons and repeat to"
      "translate each subsequent gene."
    ]
    [
      "When you press the 5-REPLICATE"
      "THE ORIGINAL DNA button a copy"
      "of the original DNA will be "
      "generated for a new cell"
      "(as in mitosis or meiosis) and"
      "it will appear in the green."
    ]
    [
      "The replicated DNA will have a"
      "# of random mutations, set by"
      "#-NUCLEOTIDES-AFFECTED, each"
      "mutation of the type set by"
      "MUTATION-TYPE. Press button 5)"
      "again to explore possible outcomes."
    ]
    [
      "Now repeat the same transcription,"
      "release, translation, and release"
      "process for the DNA in this new"
      "cell by pressing 6-, 7-, 8-, 9-."
      "Repeat that sequence again to"
      "cycle through to the next gene."
    ]
    [
      "If you want to test the outcomes"
      "for your own DNA code, type any"
      "sequence of A, G, T, C in the"
      "USER-CREATED-CODE box and set"
      "the INITIAL-DNA-STRING to"
      "“from-user-code”.  Then press"
      "SETUP and start over again."
    ]
  ]
end 

to reset-completed-events
  
  if event-1-triggered? or  event-2-triggered? or event-3-triggered? or event-4-triggered? [
    set event-4-completed? false
    if event-1-triggered? or  event-2-triggered? or event-3-triggered? [
      set event-3-completed? false
      if event-1-triggered? or  event-2-triggered?  [
        set event-2-completed? false
        if event-1-triggered?  [ set event-1-completed? false ]
      ]
    ]
  ]
  if event-6-triggered? or event-7-triggered? or event-8-triggered? or event-9-triggered? [
    set event-9-completed? false
    if event-6-triggered? or  event-7-triggered? or event-8-triggered? [
      set event-8-completed? false
      if event-6-triggered? or  event-7-triggered?  [
        set event-7-completed? false
        if event-6-triggered?  [ set event-6-completed? false ]
      ]
    ]
    
  ]
end 


; Copyright 2012 Uri Wilensky.
; See Info tab for full copyright and license.

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky over 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version

Attached files

File Type Description Last updated
DNA Protein Synthesis.png preview Preview for 'DNA Protein Synthesis' almost 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.