Bacterial competition influenced by phage-encoded lysin

No preview image

3 collaborators

Default-person Cameron Crandall (Author)
Steve Krone (Author)
Anna Rodriguez (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 477 times • Downloaded 29 times • Run 0 times
Download the 'Bacterial competition influenced by phage-encoded lysin' modelDownload this modelEmbed this model

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


## WHAT IS IT?

A spatial model of competition between two bacterial species (green and red) in the presence of a phage (virus) that infects green cells. Infected green cells die after a specified time, releasing phage progeny and lysin (toxin) molecules. The lysin can kill red cells.

## Color Coding

Color Coding:

Phage: Blue- normal phage that can move and attach

Red- Phage that have attached to a cell and can no longer move

Lysins: Magenta- normal lysin that can move and attach

Pink- lysins that have attached to cell and can no longer move

Patches: Shades of Green and Red- normal bacterial cells, lighter shades represent more cells at a location,

Yellow- a patch that only contains nutrient agar can be consumed for energy

Brown- a dead bacterial cell, can be consumed for energy

Grey- a green bacterial cell that has been infected with phage

Black- an empty patch

## HOW BACTERIA WORK

Each patch begins with some allocation of nutrient and can be occupied by up to 3 cells. Reproduction occurs at a specified rate, which depends on cell type, as long as the cell has acquired sufficient energy by consuming nutrient. A unit of nutrient that is consumed confers a specified amount of energy. Each reproduction event costs the reproducing cell energy. A cell that does not have sufficient energy to reproduce will attempt to consume nutrient from its `nutrient neighborhood’ (patches that are within a Moore neighborhood with radius three). This is an efficient method for simulating the effects of nutrient diffusion without excessive computational cost. The offspring cell is placed at the patch of the parent or at one of the 8 neighboring patches, with pre-specified probabilities, as long as there is space available and the other species is not present at that patch. Reproduction is suppressed whenever all these local patches are at their carrying capacity. A red cell that is killed by toxin releases a specified amount of nutrient to that patch.

## HOW PHAGE WORK

Phage are the small blue turtles. They diffuse and attach to green bacterial cells; they do not infect red cells. After a latent period they cause the cell to burst, releasing phage progeny and lysin molecules.

## HOW LYSINS WORK

Lysin molecules are represented by magenta turtles. They diffuse and can attach to red bacterial cells. Lysins kill red cells when a sufficient number have attached. Lysin molecules degrade after a specified time; they do not attach to or kill green cells.

Comments and Questions

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

Click to Run Model

globals [red-nearby green-nearby red-toxin-area green-toxin-area lysin-area setup-size target feeding-radius radius nearby]
breed [lysins lysin] ;; creates a breed of turtles called "lysins" pluaral and "lysin" singular
lysins-own [age] ;; lysin specific variable used to calculate how old the molecule is
patches-own [ cells energy dormant time nutrient] ; variables for the patches
turtles-own [phage-time] ; a variable for phage used to track age

; Color Coding:
;Phage: Blue- normal phage that can move and attach 
;       Red- Phage that have attached to a cell and can no longer move 
;Lysins: Magenta- normal lysin that can move and attach 
;       Pink- lysins that have attached to cell and can no longer move
;Patches: Shades of Green and Red- normal bacterial cells, lighter shades represent more cells at a location, 
;         Yellow- a patch that only contains nutrient agar can be consumed for energy
;         Brown- a dead bacterial cell, can be consumed for energy
;         Grey- a green bacterial cell that has been infected with phage
;         Black- an empty patch
;
;
;

to setup
  clear-all
  reset-ticks
  set red-nearby circle-neighborhood red-radius
  set green-nearby circle-neighborhood green-radius
  set red-toxin-area circle-neighborhood red-toxin-radius 
  set green-toxin-area circle-neighborhood green-toxin-radius 
  set setup-size circle-neighborhood initial-size
  set feeding-radius circle-neighborhood 3
  ; sets up the model using the different modes
  if mode = "1 colony" ; 1 colony mode sets up a single green colony in the middle
  [
    ask patches [set pcolor 48] 
    ask patch (0) (0)
    [
      ask patches at-points setup-size [
        set pcolor 57
        set energy 0
        set cells 3
      ]
    ]
  ]
  if mode = "random positions" ; this mode spreads a specified number of green and red cells randomly across the grid
  [
    ask patches 
    [
      set pcolor 48
      set cells 0
      set nutrient initial-nutrient
    ] 
    while [count patches with [pcolor = 55] < number-of-green] [ask patch random-xcor random-ycor 
      [
        if pcolor = 48  
        [
          set pcolor 55
          set cells 1
          set nutrient initial-nutrient
        ]
      ]
    ]
    while [count patches with [pcolor = 15] < number-of-red] [ask patch random-xcor random-ycor [
      if pcolor = 48  
      [
        set pcolor 15
        set cells 1
        
        set nutrient initial-nutrient]
    ]
    ]
    
    
  ]
  if mode = "even spacing"
  [
    ask patches 
    [
      set pcolor 48
      set cells 0
      set nutrient initial-nutrient
    ] 
    while [count patches with [pcolor = 55] < number-of-green] [ask patch random-xcor random-ycor 
      [
        if pcolor = 48  
        [
          set pcolor 55
          set cells 1
          set nutrient initial-nutrient
        ]
      ]
    ]
    while [count patches with [pcolor = 15] < number-of-red] [ask patch random-xcor random-ycor [
      if pcolor = 48  
      [
        set pcolor 15
        set cells 1
        
        set nutrient initial-nutrient]
    ]
    ]
  ]
  if mode = "2 colonies" ; this mode makes a green colony and a red colony a specified distance apart
  [
    ;distance-apart is the distance between two colonies
    ask patches [set pcolor 48] 
    ask patch ((distance-apart / 2)) (0)
    [
      ask patches at-points setup-size 
      [
        set pcolor 57
        set energy 0
        set cells 3
      ]
    ]
    ask patch ((distance-apart / -2)) (0)
    [
      ask patches at-points setup-size 
      [
        set pcolor 17
        set energy 0
        set cells 3
        
      ]
    ]
  ]
  if mode = "central phage" ; a high density of green cells with phage in the center that has a delayed start
  [
    ask patches 
    [
      set pcolor one-of [48 57]
      if pcolor = 57
      [
        set energy 1
        set cells 3 
        set time random 10
      ]
    ]
  ]
  if phage?
  [
    setup-phage
  ]
end 

to go
  ;;  asksthe bacteria to eat and grow when possible, and asks the phage and lysins to move.
  ;if growth is disabled the bacteria will not grow.
  if growth? [
    ask patches with [ (pcolor = 55) or (pcolor = 56) or (pcolor = 57)]  
    [
      eat grow-green  
      set time time + 1
    ]
    ask patches with [(pcolor = 15) or (pcolor = 16) or (pcolor = 17)]  
    [
       eat grow-red  
      set time time + 1
    ]
  ]
  ask turtles ;; asks the phage to run their commands
  [
    move attach reproduce
    if mode = "2 colonies" ;; this command delays the phage from doing anything until after 200 ticks. This give the bacteria time to grow first
    [
     if ticks = 200
     [
      
      
       if color = orange
       [
        set color blue 
       ] 
      
     ] 
    ]
  ]
  ask lysins ; asks the lysins to run their commands
  [
   lysin-move lysin-attach grow-up
  ]
  ifelse hide-turtles? ;; hides all the phage if the switch is on
  [ ask turtles
    [
      hide-turtle
    ]
  ] 
  [
   ask turtles
   [
    show-turtle 
   ] 
  ]
  if mouse-down?  ; clicking the mouse on the grid will create a phage at that location
  [
    create-turtles 1 
    [ 
      set color blue
      setxy mouse-xcor mouse-ycor
    ]
  ]
  ifelse energy-label?  ;; will show how much energy each patch has, used only for trouble shooting
  [
    ask patches
    [ 
      set plabel energy
    ]
  ]
  [
    ask patches
    [ 
      set plabel ""
    ]
  ]
  ifelse show-lysin? ; this will show all the lysins if the switch is turned on
  [
    ask lysins
    [
      show-turtle 
    ]
  ]
  [
   ask lysins
   [
    hide-turtle 
   ] 
  ]
  
  tick
end 

to grow-green
  ;; 
  ;; the grow command works by asking a patch if its energy is less than 1. If the cell's "time" variable is hgih enough and has enough energy it will reproduce. The add-to-parent site variable is the probability it will preferentially
  ;; add the new cell to its own location rather than an adjacent one. After succesfully reproducing it will reduce its own energy and reset its time.  
  ;; The cell will ask one-of neighbors with cells < 2 (if it can't find a cell with cells < 2 it will return "nobody" and stop the reproduction event) after finding a cell with cells < 2 that's the right color
  ;; it will add a new cell to that location and change cell number and color accordingly.
 if time > 10
 [ 
  if energy >= 1
    [
      
        ifelse cells < 3
        [
          ifelse add-to-parent-site > random 100
          [
            set cells cells + 1
            set energy energy - 1
            if cells = 2 
            [
              set pcolor 56
            ]
            if cells = 3
            [
              set pcolor 57
            ]
          ]
          [ set target one-of neighbors with [cells < 3]
            
            if target != nobody
            [ 
              ask target
              [
                if ( pcolor = 55) or ( pcolor = 56) or ( pcolor = 57) or ( pcolor = black) or ( pcolor = 48) or (pcolor = brown)
                [
                  if cells = 0 
                  [ 
                    
                    set energy 0
                    set cells 1
                    set pcolor green
                    set time 0
                    ask myself [set energy energy - 1]
                    stop
                  ]
                  if cells = 1
                  [
                    set cells cells + 1
                    set pcolor 56
                    ask myself [set energy energy - 1]
                    stop
                  ]
                  if cells = 2
                  [
                    set cells cells + 1
                    set pcolor 57
                    ask myself [set energy energy - 1]
                    stop
                  ]
                ]
              ]
            ]
          ]
        ]
        [
          set target one-of neighbors with [cells < 3]
          
          if target != nobody 
          [
            ask target
            [
              if (pcolor = 55) or (pcolor = 56) or (pcolor = 57) or (pcolor = black) or (pcolor = 48) or (pcolor = brown)
              [
                if cells = 0 
                [ 
                  set energy 0
                  set cells 1
                  set time 0
                  set pcolor green
                  ask myself [set energy energy - 1]
                  stop
                ]
                if cells = 1
                [
                  set cells cells + 1
                  set pcolor 56
                  ask myself [set energy energy - 1]]
                stop
                if cells = 2
                [
                  set cells cells + 1
                  set pcolor 57
                  ask myself [set energy energy - 1]
                  stop
                ]
              ]
            ]
          ]
        ]
        set time 0
      ]
    ]
end 

to grow-red
  ;; same as green command but with colors switched
  if time > 10
  [ 
    if energy >= 1
    [
     
        ifelse cells < 3
        [
          ifelse add-to-parent-site > random 100
          [
            set cells cells + 1
            set energy energy - 1
            if cells = 2 
            [
              set pcolor 16
            ]
            if cells = 3
            [
              set pcolor 17
            ]
          ]
          [ set target one-of neighbors with [cells < 3]
            
            if target != nobody
            [ 
              ask target
              [
                if ( pcolor = 15) or ( pcolor = 16) or ( pcolor = 17) or ( pcolor = black) or ( pcolor = 48) or (pcolor = brown)
                [
                  if cells = 0 
                  [ 
                    
                    set energy 0
                    set cells 1
                    set pcolor red
                    set time 0
                    ask myself [set energy energy - 1]
                    stop
                  ]
                  if cells = 1
                  [
                    set cells cells + 1
                    set pcolor 16
                    ask myself [set energy energy - 1]
                    stop
                  ]
                  if cells = 2
                  [
                    set cells cells + 1
                    set pcolor 17
                    ask myself [set energy energy - 1]
                    stop
                  ]
                ]
              ]
            ]
          ]
        ]
        [
          set target one-of neighbors with [cells < 3]
          
          if target != nobody 
          [
            ask target
            [
              if (pcolor = 15) or (pcolor = 16) or (pcolor = 17) or (pcolor = black) or (pcolor = 48) or (pcolor = brown)
              [
                if cells = 0 
                [ 
                  set energy 0
                  set cells 1
                  set time 0
                  set pcolor red
                  ask myself [set energy energy - 1]
                  stop
                ]
                if cells = 1
                [
                  set cells cells + 1
                  set pcolor 16
                  ask myself [set energy energy - 1]]
                stop
                if cells = 2
                [
                  set cells cells + 1
                  set pcolor 17
                  ask myself [set energy energy - 1]
                  stop
                ]
              ]
            ]
          ]
        ]
        set time 0
      ]
    ]
end 

;; this is the reporter used to take a radius number (n) and create a list of all the cells in the neighborhood of the radius n and can store the list as a variable (ex. "red-nearby")

to-report circle-neighborhood [n]
  let result [list pxcor pycor] of patches with [(abs pxcor) ^ 2 + (abs pycor) ^ 2 <= n ^ 2]
  report result 
end 

to eat
  ;;a cell can eat a yellow patch for a set amount of energy or a dead brown patch for a set amount of energy.
  ;; this command works by looking for a patch to eat within its feeding radius.
  
 
    if energy < 1
    [
      
      ask one-of patches at-points feeding-radius
      [
        if nutrient > 0
        [
          set nutrient nutrient - 1
          ask myself 
          [
            set energy energy + 1 
          ] 
        ] 
      ] 
    ]
end 

to setup-phage  ;; different ways to start the phage
  ifelse mode = "central phage" ; this creates phage right on the origin of the grid
    [
      create-turtles initial-number
      ask turtles [setxy 0 0]
      ask turtles [set color blue]
    ]
    [
      ifelse mode = "2 colonies" ; starts phage in the center of the green colony
      [
        create-turtles initial-number    
      ask turtles [ setxy (distance-apart / 2) 0 ]
      ask turtles [ set color orange ]
      ]
      [ 
        ifelse mode = "even spacing"
        [
           create-turtles 1 [ setxy -15 15]
           create-turtles 1 [ setxy 0 15]
           create-turtles 1 [ setxy 15 15]
           create-turtles 1 [ setxy -15 -15]
           create-turtles 1 [ setxy 0 -15]
           create-turtles 1 [ setxy 15 -15]
           ask turtles [set color blue]
           
        ]
        [
          create-turtles initial-number    ; for all other modes the phage are given random starting locations
          ask turtles [ setxy random-xcor random-ycor ]
          ask turtles [ set color blue ]
        ]
      ]
    ]
end 

to move ;; the phage moves if it is blue
  if color = blue [
    right random 360
    forward .25
  ] 
  if color = red
  [
    set phage-time phage-time + 1
  ]
end 

to attach  ; blue phage can attach and turn red, and turn the patch grey. Red phage do not move.
  if color = blue
    [ if (pcolor = 55) or (pcolor = 56) or (pcolor = 57) or (pcolor = grey)
      [ if random 100 < attachment-chance
        [
          set color red
          set pcolor grey
          set phage-time 0
        ]
      ]
    ]
end 

to reproduce ; after being attached for the amount of time specified by phage-reproduction-time, the phage lyses the cell, produces offspring and reduces the cell count on a patch by 1, if the cell count equals zero the patch turns brown
  if color = red
  [
    if phage-time = phage-reproduction-time
    [ 
      
      hatch burst-size [ set color blue] 
      set color black
      ask patch-here
      [
        set cells cells - 1
        set nutrient nutrient + corpse-energy
        if lysin?
        [
          lyse
        ]
        if cells = 0
        [
          set pcolor brown
          ask turtles-here 
          [
            if color = red
            [
              set color black 
            ] 
          ]
        ] 
      ]
      
    ] 
  ]
end    

to lyse ;; a command for a patch to lyse and burst out lysin molecules
 
    sprout-lysins lysin-production
    [
      set color magenta
      set size 1
      set age 0
    ]
end 

to lysin-move  ; command to let the lysins move, only magenta lysins can move
  if color = magenta
  [
    right random 360
    forward lysin-speed
  ]
end 

to lysin-attach ; lysin can attach and turn pink, once the number of lysin attached is equal to the lethal-amount the cell dies and clears all attached lysin molecules
  if (pcolor = 15) or (pcolor = 16) or (pcolor = 17) 
  [
    if random 100 < lysin-attachment-chance
    [
      
      set color pink
      ask patch-here
        [
          if count lysins-here with [color = pink] = lethal-amount
            [
              
              set cells cells - 1
              set nutrient nutrient + corpse-energy
              if cells = 0
              [
                set pcolor brown
              ]
              ask lysins-here
              [
                if color = pink
                [
                  die 
                ] 
              ]
            ] 
        ]
    ]
  ]
end 

to grow-up ; lysins grow older each tick once they reach degradation-time they die
  
  ifelse age = degradation-time
  [
   die 
  ]
  [
  set age age + 1
  ]
end 

There is only one version of this model, created almost 10 years ago by Cameron Crandall.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.