Microbial Community Assembly

Microbial Community Assembly preview image

1 collaborator

Default-person Nino Zhuzhunadze (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.3.0 • Viewed 26 times • Downloaded 2 times • Run 0 times
Download the 'Microbial Community Assembly' 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

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

Click to Run Model

turtles-own [hatch-count]

to setup
  clear-all
  ;; create 10 early arrival turtles on the left side of the substrate (Green Species)
  species-arrival 10 -15 0 56

  ; Add any additional setup code here
  reset-ticks
end 

to go
  ;; add late arrival species if time has reached the desired number of ticks
  if ticks = late-arrival-interval [

    ;; create 10 late arrivals on the right side of the substrate (Blue species)
    species-arrival 10 0 15 84

    ;; create 10 late arrivals on the upper side of the substrate (Yellow species)
    species-arrival 10 15 0 44

    ;; create 10 late arrivals on the upper side of the substrate (Pink species)
    species-arrival 10 0 -15 16
  ]


 fight-or-not

 ;; Replicate all species
 replicate 84 0.5
 replicate 44 0.9
 replicate 16 0.5
 replicate 56 replication-rate-green


  let irreproducible-turtles turtles with [hatch-count = 4]
  ask irreproducible-turtles [
    set color gray
  ]


 tick
end 

;; Replicates turtles based on the replication rate. It stops hatching once a turtle has hatched 2 generations

to replicate [color-code replication-rate]
  ;; Calculate the number of replicating turtles based on the replication rate
  let replicating-turtles turtles with [color = color-code and hatch-count < 4 ]
  let replicating-turtle-count floor (count replicating-turtles * replication-rate)
  let selected-turtles n-of replicating-turtle-count replicating-turtles
  ask selected-turtles [
    fd 1
    hatch 1 [
      ; amplification
      rt random-float 360
      fd 1
    ]
    set hatch-count hatch-count + 1
  ]
end 


;; Function initializes 10 turtles in a circular shape with varying color and position

to species-arrival [num-turtles xposition yposition color-code]

  create-turtles num-turtles [
    let radius 0.5 ; Adjust the radius of the circle
    let angle (360 / num-turtles * who) ; Calculate the angle for each turtle

    ; Calculate the x and y coordinates based on the angle and radius
    let new-xcor radius * cos(angle)
    let new-ycor radius * sin(angle)

    setxy (xposition + new-xcor) (yposition + new-ycor)

    ;; Appearance of the species
    set color color-code
    set shape "circle"
    set size 0.5
    set hatch-count 0
  ]
end 

;; Kills an opponent bacteria if it enters a space dominanted by one of the species

to fight-or-not
  ask turtles [
    let neighborhood turtles in-radius 0.5
    let yellow-neighbors count neighborhood with [color = 44]
    let green-neighbors count neighborhood with [color = 56]
    let blue-neighbors count neighborhood with [color = 84]
    let pink-neighbors count neighborhood with [color = 16]

    ;; Check for blue neighborhood
    if color != 84 and blue-neighbors > 0 and (blue-neighbors / count neighborhood) > 0.5 [
      let death? random-float 1 < 0.9

      if death? [
        set color white
        die
      ]
    ]

    ;; Check for green neighborhood
    if color != 56 and green-neighbors > 0 and (green-neighbors / count neighborhood) > 0.5 [
      let death? random-float 1 < antagonistic-behavior

      if death? [
        set color white
        die
      ]
    ]

    ;; Check for yellow neighborhood
    if color != 44 and yellow-neighbors > 0 and (yellow-neighbors / count neighborhood) > 0.5 [
      let death? random-float 1 < 0.5

      if death? [
        set color white
        die
      ]
    ]

    ;; Check for pink neighborhood
    if color != 16 and pink-neighbors > 0 and (pink-neighbors / count neighborhood) > 0.5 [
      let death? random-float 1 < 0.5

      if death? [
        set color white
        die
      ]
    ]
  ]
end 

There is only one version of this model, created about 1 month ago by Nino Zhuzhunadze.

Attached files

File Type Description Last updated
Microbial Community Assembly.png preview Preview about 1 month ago, by Nino Zhuzhunadze Download

This model does not have any ancestors.

This model does not have any descendants.