genetic code

genetic code 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 150 times • Downloaded 7 times • Run 0 times
Download the 'genetic code' 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 [ n  ;RNA PXCOR POSITION
          p1 ;PEPTISE PXCORPOSITION
          RNA ;RNA string
          first-base ; item position of 1st base in RNA
          codon ;codon variable
          s-base  ;starting base item position of a codon
          f-base  ;final base item position of a codon
          amino-acid ; translated amino acid
          amino-acid-result ; report the types of amino acids
          protein-length  ;peptide length
          base-cadidates  ;nucleotides input from users
          aa1 ; amino acid 1
          aa-num ; assign a number for shuffle AAs
          aa-num-list]

Patches-own [base]

breed [nucleotides nucleotide]
breed [units unit]
breed [peptides peptide]
breed [primes prime]

to setup

 ca

  set base-cadidates user-input "Nucleotides (Capital A C U or G only.No space)"

  if length base-cadidates = 0 [user-message "no nucleotide is tested" stop]

  set RNA "5'-"                                    ;create 5' end
  set-default-shape nucleotides "x"               ;set default shape as X in case having an invalid base
  set n 7                                         ;set the first base position in the world
  set first-base 3

  set s-base 3
  set f-base 6
  set p1 10
  set protein-length 0
  set amino-acid-result ""
  set aa-num-list 0
  set aa1 0

  ask patches [set pcolor 9.5 + random-float 0.4 ]
  ask patches with [pycor <= min-pycor + 2 ] [set pcolor 2]

 repeat 18
  [ set RNA word RNA item random (length base-cadidates) base-cadidates]      ;synthesize the RNA


  set RNA word RNA "-3'"                       ;attach 3' end


 repeat 18
    [ ask patches with [pxcor = n and pycor = 4]               ;assign base to patches
      [set base item first-base RNA]
      set n n + 1
      set first-base first-base + 1]

 ask patches with [base != 0]                                  ;let assigned patches produce bases
 [sprout-nucleotides 1
      [ if base = "A"  [set shape "nn-a"]
        if base = "C"  [set shape "nn-c"]
        if base = "G"  [set shape "nn-g"]
        if base = "U"  [set shape "nn-u"]
    ]]

  create-primes 1               ;MAKE 5' END
  [set shape "5'"
    set size 1.5
    set color 0
    setxy 6.3 4.5]



   create-primes 1               ;MAKE 3' END
  [set shape "3'"
    set size 1.5
    set color 0
    setxy 24.7 4.5]


  if any? nucleotides with [shape = "x"] [user-message "Please input correct nucleotide(s) using capital letter(s)" stop]

ribosome

reset-ticks
end 

to translate

  if f-base > 21 [user-message "Translation has been completed" stop]

   repeat 6 [
    ask units                           ;move ribosome one codon
      [set heading 90
        forward 4
        wait 0.3]


   set codon substring RNA s-base f-base                            ;detetmine the range (the codon)
   if codon = "AUG" [set amino-acid "Met" set aa-num 1]                         ;translate
   if codon = "UUU" or codon = "UUC" [set amino-acid "Phe" set aa-num 2]
   if codon = "UUA" or codon = "UUG" or codon = "CUU" or codon = "CUC" or codon = "CUA" or codon = "CUG"[set amino-acid "Leu" set aa-num 3]
   if codon = "AUU" or codon = "AUC" or codon = "AUA" [set amino-acid "Ile" set aa-num 4]
   if codon = "GUU" or codon = "GUC" or codon = "GUA" or codon = "GUG" [set amino-acid "Val" set aa-num 5]
   if codon = "UCU" or codon = "UCC" or codon = "UCA" or codon = "UCG" or codon = "AGU" or codon = "AGC" [set amino-acid "Ser" set aa-num 6]
   if codon = "CCU" or codon = "CCC" or codon = "CCA" or codon = "CCG" [set amino-acid "Pro" set aa-num 7]
   if codon = "ACU" or codon = "ACC" or codon = "ACA" or codon = "ACG" [set amino-acid "Thr" set aa-num 8]
   if codon = "GCU" or codon = "GCC" or codon = "GCA" or codon = "GCG" [set amino-acid "Ala" set aa-num 9]
   if codon = "UAU" or codon = "UAC"  [set amino-acid "Tyr" set aa-num 10]
   if codon = "CAU" or codon = "CAC"  [set amino-acid "His" set aa-num 11]
   if codon = "CAA" or codon = "CAG"  [set amino-acid "Gln" set aa-num 12]
   if codon = "AAU" or codon = "AAC"  [set amino-acid "Asn" set aa-num 13]
   if codon = "AAA" or codon = "AAG"  [set amino-acid "Lys" set aa-num 14]
   if codon = "GAU" or codon = "GAC"  [set amino-acid "Asp" set aa-num 15]
   if codon = "GAA" or codon = "GAG"  [set amino-acid "Glu" set aa-num 16]
   if codon = "UGU" or codon = "UGC"  [set amino-acid "Cys" set aa-num 17]
   if codon = "UGG" [set amino-acid "Trp" set aa-num 18]
   if codon = "CGU" or codon = "CGC" or codon = "CGA" or codon = "CGG" or codon = "AGA" or codon = "AGG" [set amino-acid "Arg" set aa-num 19]
   if codon = "GGU" or codon = "GGC" or codon = "GGA" or codon = "GGG" [set amino-acid "Gly" set aa-num 20 ]
    if codon = "UAA" or codon = "UAG" or codon = "UGA" [set amino-acid "" user-message "Translation is terminated" ask units [die]]

   set aa-num-list sentence aa-num-list aa-num    ;assign number to aa for removing duplication and shuffle
   set aa-num-list remove-duplicates aa-num-list


       ifelse amino-acid != ""                           ;if not encounter a stop codon,
        [
         create-peptides 1                            ; make amino acid
           [set size 2
            set shape "protein-unit"
            setxy p1  min-pycor + 1
            set color white]

         set p1 p1 + 2          ;set amino acids position

         set s-base s-base + 3    set f-base f-base + 3]

     [set aa-num-list remove 0 aa-num-list
      set aa-num-list shuffle aa-num-list
      show-aa
      stop]


  ]

  set aa-num-list remove 0 aa-num-list
  set aa-num-list shuffle aa-num-list

  show-aa
end 

to ribosome

 create-units 1
   [
    set shape "l-unit"
    set size 7
    set color 27
    setxy 3.5 3]
end 

to show-aa

  repeat length aa-num-list
   [set aa-num item aa1 aa-num-list
      num-to-aa
      set amino-acid-result word amino-acid-result " "
      set amino-acid-result word amino-acid-result amino-acid
      set aa1 aa1 + 1]
end 

to num-to-aa

  if aa-num = 1 [set amino-acid "Met"]
  if aa-num = 2 [set amino-acid "Phe"]
  if aa-num = 3 [set amino-acid "Leu"]
  if aa-num = 4 [set amino-acid "Ile"]
  if aa-num = 5 [set amino-acid "Val"]
  if aa-num = 6 [set amino-acid "Ser"]
  if aa-num = 7 [set amino-acid "Pro"]
  if aa-num = 8 [set amino-acid "Thr"]
  if aa-num = 9 [set amino-acid "Ala"]
  if aa-num = 10 [set amino-acid "Tyr"]
  if aa-num = 11 [set amino-acid "His"]
  if aa-num = 12 [set amino-acid "Gln"]
  if aa-num = 13 [set amino-acid "Asn"]
  if aa-num = 14 [set amino-acid "Lys"]
  if aa-num = 15 [set amino-acid "Asp"]
  if aa-num = 16 [set amino-acid "Glu"]
  if aa-num = 17 [set amino-acid "Cys"]
  if aa-num = 18 [set amino-acid "Trp"]
  if aa-num = 19 [set amino-acid "Arg"]
  if aa-num = 20 [set amino-acid "Gly"]
end 

There are 4 versions of this model.

Uploaded by When Description Download
lin xiang about 1 month ago fix bug Download this version
lin xiang 11 months ago REFINE Download this version
lin xiang 11 months ago REFINE Download this version
lin xiang 11 months ago Initial upload Download this version

Attached files

File Type Description Last updated
genetic code.png preview Preview for 'genetic code' 11 months ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.