A Trojan horse approach to medical intervention strategies

A Trojan horse approach to medical intervention strategies preview image

1 collaborator

Hobbes286x286 Rik Blok (Author)

Tags

agent-based model 

Tagged by Rik Blok over 4 years ago

bacteria 

Tagged by Rik Blok over 4 years ago

evolution 

Tagged by Rik Blok over 4 years ago

infection 

Tagged by Rik Blok over 4 years ago

output-wrap.nls 

Tagged by Rik Blok over 4 years ago

per-capita-tau-leaping.nls 

Tagged by Rik Blok over 4 years ago

sigfigs.nls 

Tagged by Rik Blok over 4 years ago

spatial 

Tagged by Rik Blok over 4 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 710 times • Downloaded 71 times • Run 0 times
Download the 'A Trojan horse approach to medical intervention strategies' modelDownload this modelEmbed this model

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


A Trojan horse approach to medical intervention strategies

A [NetLogo] model by Rik Blok.

http://www.zoology.ubc.ca/~rikblok/wiki/doku.php?id=science:popmod:brown2009:start

This agent-based model represents a bacterial infection as described in [[Brown2009]]. It is assumed the wild type (W) produces a public good (F) which benefits all. To combat the infection the population is innoculated with a "cheater" strain (C). Changes are simply represented as elementary reactions between (local) agents:

  • N → 2 N @ rate 1 (growth)
  • W + N → N @ rate 1 (competition)
    C + N → N @ rate 1
  • W → W + F @ rate b (public good)
    W + F → 2 W @ rate β
  • W → ∅ @ rate x (wild cost)
  • C → ∅ @ rate q (cheater cost)

where N indicates an individual of either type and ∅ indicates an absence of products.

Additionally, the cheater strain has one or more of the following traits:

  • It consumes but does not produce the public good (F),
    C + F → 2 C @ rate β
  • It produces a toxin (T) that harms all,
    C → C + T @ rate a
    N + T → ∅ @ rate δ
  • It produces a bacteriocinogen (B) it is immune to but harms the wild type,
    C → C + B @ rate e
    C + B → C @ rate γ
    W + B → ∅ @ rate γ.

The target and infected cells are fixed whereas the virions move randomly with diffusion constant diff-const. If 'well-mixed' is on then they are shuffled randomly in space with each timestep.

Finally, it is assumed that the wild type is more "virulent" (harmful to the host) than the cheater strain.

How it works

The simulation approximates a Poisson process for each of the above events. The best known technique would be the Gillespie algorithm [[Gibson2000]] but it isn't well suited to NetLogo's strengths. Instead, time proceeds in steps with multiple events occurring in each timestep.

The step size is adaptive, chosen to achieve a desired error tolerance, compared with the Gillespie algorithm. When the error tolerance is near zero the likelihood of each event is small and we may expect just a few events to occur per timestep. Then we're accurately -- but inefficiently -- mimicking the Gillespie algorithm. As the tolerance increases we have more simultaneous events, lowering accuracy but increasing performance.

References

[[Brown2009]] Brown, Sam P., West, Stuart A., Diggle, Stephen P., and Griffin, Ashleigh S. Social evolution in micro-organisms and a Trojan horse approach to medical intervention strategies. Philosophical Transactions of the Royal Society B: Biological Sciences, 364: 3157-3168. doi:10.1098/rstb.2009.0055. 2009.

[[Gibson2000]] Gibson, Michael A. and Bruck, Jehoshua. Efficient Exact Stochastic Simulation of Chemical Systems with Many Species and Many Channels. J. Phys. Chem. A, 104(9): 1876-1889. doi:10.1021/jp993732q. 2000.

[[NetLogo]] Wilensky, U. NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL. 1999.

Comments and Questions

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

Click to Run Model

; Revisions:
; 2013-08-02
;   - accuracy now reports ( 100% - per-capita-mean-error )
;   - diffuse-individual moved into .nls file
;   - output-wrap moved into .nls file
;   - sigfigs moved into .nls file
; 2013-07-29
;   - line-breaking procedure to replace output-prints
;   - moved some generic code into includes file
;   - events are defined at beginning and applied behind the scenes (in included file)

; design choices:
; * the (full) model is agent-based
; * bacteria (wilds and cheaters) are mobile (Brownian)
; * their products (food, toxin, and bacteriocide) are stationary
; * interactions are local (per patch)
; * time steps forward in increments large enough for multiple events to occur
; * the full model fixes the fast (food, toxin, & bacteriocide) production rates
; * the System Dynamics Modeler contains a numeric approximation
; * the numeric model applies the QSSA to reduce the system, removing the products
; * the numeric model approximates the equations in Brown et al., 2009

__includes [
  "diffuse-individual.nls"
  "output-wrap.nls"
  "per-capita-tau-leaping.nls"
  "sigfigs.nls"
]


; the possible "breeds" of turtles
breed [wilds wild]
breed [cheaters cheater]


; turtles own event rates
patches-own [
  food
  toxin
  bacteriocide
]


globals [ 
  count-patches  ; assign to variable to improve speed; used in setup and plots
  beta-food
  delta-toxin
  gamma-bacteriocide
  fast-rate      ; = beta = delta = gamma (fast consumption rates for food, toxin, & bacteriocide)
  wild-virulence
]

to startup
  setup
end 

to setup
  clear-all
  set fast-rate 5 ; TO DO: how big does this need to be to satisfy QSSA?
  set wild-virulence 2 ; assume wild type twice as virulent as cheaters (as per Brown et al.)
  set beta-food fast-rate
  set delta-toxin fast-rate
  set gamma-bacteriocide fast-rate
  set count-patches count patches
  system-dynamics-setup ; setup system-dynamics-modeler for numeric comparison
  ; set breed shapes
  set-default-shape turtles "circle"
  ; create numbers of each breed to get the desired average density (per patch)
  create-wilds       ( W-num * count-patches ) [ set color green ]
  create-cheaters    ( C-num * count-patches ) [ set color red   ]
  ; shuffle them 
  ask turtles [ setxy random-xcor random-ycor ]
  ask patches [
    ; start with QSSA densities of food, toxin, & bacteriocide
    let count-turtles-here  count turtles-here
    let count-cheaters-here count cheaters-here
    if ( count-turtles-here > 0 ) [
      ; Poisson-distributed random variates
      set food random-poisson ( b-shared-benefit * count wilds-here / ( beta-food * count-turtles-here ) )
      set toxin random-poisson ( a-toxin-production * count-cheaters-here / ( delta-toxin * count-turtles-here ) )
      set bacteriocide random-poisson ( e-bacteriocinogen * count-cheaters-here / ( gamma-bacteriocide * count-turtles-here ) )
    ]
  ]
  reset-ticks
  ; hint
  output-wrap 26 ; set wrapping column
  output-wrap "An agent-based model of 'Social evolution in micro-organisms and a Trojan horse approach to medical intervention strategies' by Brown et al. (2009)."
  output-wrap "Press go to get started.\n"
  
  ; merge all events into one master list [2013-07-29]
  add-per-capita-event turtles                  ; N -> 2 N @ rate 1
    task [ 1 ] 
    task [ hatch 1 ]
  add-per-capita-event turtles                  ; N + N -> N @ rate 1
    task [ count other turtles-here ] 
    task [ die ]
  add-per-capita-event turtles                  ; N + F -> 2 N @ rate beta
    task [ beta-food * food ]
    task [ set food food - 1
           hatch 1           ]
  add-per-capita-event turtles                  ; N + T -> 0 @ rate delta
    task [ delta-toxin * toxin ]
    task [ set toxin toxin - 1    
           die                 ]
  add-per-capita-event wilds                    ; W -> 0 @ rate x
    task [ x-wild-cost ]
    task [ die ]
  add-per-capita-event wilds                    ; W -> W + F @ rate b
    task [ b-shared-benefit ]
    task [ set food food + 1 ]
  add-per-capita-event wilds                    ; W + B -> 0 @ rate gamma
    task [ gamma-bacteriocide * bacteriocide ]
    task [ set bacteriocide bacteriocide - 1    
           die                               ]
  add-per-capita-event cheaters                 ; C -> 0 @ rate q
    task [ q-cheater-cost ]
    task [ die ]
  add-per-capita-event cheaters                 ; C -> C + T @ rate a
    task [ a-toxin-production ]
    task [ set toxin toxin + 1 ]
  add-per-capita-event cheaters                 ; C -> C + B @ rate e
    task [ e-bacteriocinogen ]
    task [ set bacteriocide bacteriocide + 1 ]
  add-per-capita-event cheaters                 ; C + B -> C @ rate gamma
    task [ gamma-bacteriocide * bacteriocide ]
    task [ set bacteriocide bacteriocide - 1 ]
end 

to go
  if ticks = 0 [ 
    reset-timer 
    output-wrap "You may adjust all parameters while the simulation runs."
    output-wrap "Compare the numeric, non-spatial (faint) vs. agent-based (bold) dynamics in the graphs."
    output-wrap ( word "It is assumed that the wild type is " wild-virulence " times as virulent as the cheater.\n" )
  ]
  system-dynamics-go ; numeric model
  set dt per-capita-tau-leap inaccuracy dt
  diffuse-individual turtles diffusion-const dt
  do-plots
  if (dt = 0) [  ; simulation over
    output-wrap (word "Finished in " timer " seconds.")
    stop 
  ]
end 

to do-plots
  set-current-plot "dynamics"
  system-dynamics-do-plot
  update-plots ; update other plots ("Edit" the plots to see code)
end 

to-report diffusion-const
  report ifelse-value well-mixed [ 0 ][ 10 ^ log-diffusion ]
end 

to-report inaccuracy
; complement of accuracy, depends on err-tolerance
  report 10 ^ ( err-tolerance )
end 

There are 4 versions of this model.

Uploaded by When Description Download
Rik Blok over 4 years ago includes working Download this version
Rik Blok over 4 years ago Reverted to older version Download this version
Rik Blok over 4 years ago applet doesn't support __includes so files are attached Download this version
Rik Blok over 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
A Trojan horse approach to medical intervention strategies.png preview Preview for 'A Trojan horse approach to medical intervention strategies' over 4 years ago, by Rik Blok Download
diffuse-individual.nls extension Random walk for individuals. over 4 years ago, by Rik Blok Download
output-wrap.nls extension Same as output-print but wraps printed output. over 4 years ago, by Rik Blok Download
per-capita-tau-leaping.nls extension A variant tau-leaping algorithm to approximate ; Gillespie's Stochastic Simulation Algorithm (SSA). over 4 years ago, by Rik Blok Download
sigfigs.nls extension Like precision but specifies number of significant figures. over 4 years ago, by Rik Blok Download

This model does not have any ancestors.

This model does not have any descendants.