!!!---hivsim.nlogo

来自「NETLOGO」· NLOGO 代码 · 共 1,716 行 · 第 1/5 页

NLOGO
1,716
字号
                  ] 
                        [ 
                          set peptide HLA1/pep 
                          set epitope HLA1/pep 
                        ]
                        set lethal_load inf_lethal_load 
                        set rep_rate inf_rep_rate 
                        set lethality inf_lethality 
                ]
                die
        ]
        [
                set sinceInf (sinceInf + 1)
        ]
end</p><p>;; to maintain a relatively constant supply of naive lymphocytes, these cells are replenished by the bone marrow and thymus at the same rate
;; as they undergo apoptotic death      
to do-resupply
        locals [ diff tau ]
        set diff 0
        while [ diff < numTh ]
        [
          if(prob exp (- ((ln 2) <em> life_Th)))
          [
                  create-custom-thCell 1
                  [
                          initialize-turtle-vars
                  ]
          ]
          set diff (diff + 1)
        ]
        set diff 0
        while [ diff < numTc ]
        [
          if(prob exp (- ((ln 2) </em> life_Tc)))
          [
                  create-custom-tcCell 1
                  [
                          initialize-turtle-vars
                  ]
          ]
          set diff (diff + 1)
        ]
        set diff 0
        while [ diff < numB ]
        [
          if(prob exp (- ((ln 2) <em> life_B)))
          [
                  create-custom-bCell 1
                  [
                          initialize-turtle-vars
                  ]
          ]
          set diff (diff + 1)
        ]
        set diff 0
        while [ diff < numApc ]
        [
          if(prob exp (- ((ln 2) </em> life_Apc)))
          [
                  create-custom-apc 1
                  [
                          initialize-turtle-vars
                  ]
          ]
          set diff (diff + 1)
        ]
end</p><p>;; an alternate implementation of the resupply process
to do-resupply2
  locals [ tauB tauTc tauTh ]
  set tauB ((ln 2) <em> numB / life_B)
  set tauTh ((ln 2) </em> numTh / life_Th)
  set tauTc ((ln 2) * numTc / life_Tc)
        create-custom-bCell ceiling(tauB)
        [
          initialize-turtle-vars
          disperse
        ]  
        create-custom-thCell ceiling(tauTh)
        [
          initialize-turtle-vars
          disperse
        ]  
        create-custom-tcCell ceiling(tauTc)
        [
          initialize-turtle-vars
          disperse
        ]
end</p><p>to disperse
        setxy random screen-size-x random screen-size-y
end</p><p>;; the dissufion of entities is assumed to be driven by a chemotactic gradient. For example, naive Tc cells diffuse in the 
;; direction of greatest cytokine concentration, while effector Tc cells seek out sites with high numbers of infected cells.
to do-diffuse
  repeat 2
  [
          ifelse(breed = tcCell or breed = memTc or breed = bCell or breed = memB) 
          [ 
            set heading uphill cytos 
          ]
          [
            ifelse(breed = effTc) 
            [ 
              set heading uphill inf 
            ]
            [
              set heading random 360
            ]
          ]
          fd 1
          if (partner != nobody) 
          [ 
            set heading-of partner heading 
            ask partner [ fd 1 ] 
          ]
        ]
end</p><p>;; this procedure determines the probability of successful interaction (e.g., bond formation) between two entities
to-report success [ receptor1 receptor2 ]
        locals [ var ]
        ifelse((not is-number? receptor1) or (not is-number? receptor2)) 
        [ 
          report false
        ]
        [
          set var abs(receptor1 - receptor2)
          ifelse(prob exp (0 - var)) [ report true ] [ report false ]
        ]
end</p><p>;; this procedure determines the outcome of events (i.e. true or false) based on the probabilities of the events
to-report prob [ probability ]
        locals [ var ]
        if(probability = 0) [ report false ]
        set var (1 / probability)
        ifelse(random-float var < 1.0) [ report true ] [ report false ]
end</p><p>to do-plots
  set-current-plot "hiv/th/tc dynamics"
  set-current-plot-pen "hiv"
  plot count hiv with [  not neutralized? ]
  set-current-plot-pen "th"
  plot (count thCell + count memTh + count effTh)
  set-current-plot-pen "tc"
  plot (count tcCell + count memTc + count effTc)
  set-current-plot "Antibodies"
  plot (count ab)
  set-current-plot "Cytokines"
  plot (count cyto)
  set-current-plot "Bcells"
  plot (count bCell + count memB + count plasma)
end</p><p>@#$#@#$#@
GRAPHICS-WINDOW
379
13
717
372
20
20
8.0
1
10
1
1
1</p><p>CC-WINDOW
14
467
414
603
Command Center</p><p>PLOT
440
387
733
598
HIV/Th/Tc Dynamics
Time Step
NIL
0.0
100.0
0.0
100.0
true
false
PENS
"th" 1.0 0 -16777216 true
"hiv" 1.0 0 -65536 false
"tc" 1.0 0 -16776961 true</p><p>BUTTON
11
13
80
75
Setup
setup
NIL
1
T
OBSERVER
T</p><p>BUTTON
93
15
166
76
Run
start
T
1
T
OBSERVER
T</p><p>SLIDER
10
112
170
145
numB
numB
0
100
50
1
1
NIL</p><p>SLIDER
183
112
337
145
numTh
numTh
0
100
50
1
1
NIL</p><p>SLIDER
11
153
170
186
numTc
numTc
0
100
50
1
1
NIL</p><p>SLIDER
183
153
337
186
numApc
numApc
0
100
50
1
1
NIL</p><p>SLIDER
183
195
337
228
numHiv
numHiv
0
300
50
1
1
NIL</p><p>SLIDER
13
195
170
228
numEp
numEp
0
1000
500
1
1
NIL</p><p>SLIDER
13
235
168
268
ctlRate
ctlRate
0
1
0.85
0.0010
1
NIL</p><p>SLIDER
14
279
169
312
infectivity
infectivity
0
1
0.0070
0.0010
1
NIL</p><p>SLIDER
183
278
336
311
AICD
AICD
0
5
0.11
0.01
1
NIL</p><p>MONITOR
18
400
213
449
Epitope   |    No.       |     Prop.    |   Abs
dom-epitope
3
1</p><p>SLIDER
183
236

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?