Malaria Agent 2020
Author
David Gurarie
Title
Malaria Agent 2020
Description
Supplemental notebook for "Competition, cooperation and immune selection of multi-strain Plasmodium falciparum malaria"
Category
Academic Articles & Supplements
Keywords
competition, cooperation, immune selection, Plasmodium falciparum malaria
URL
http://www.notebookarchive.org/2020-02-bz8e8mv/
DOI
https://notebookarchive.org/2020-02-bz8e8mv
Date Added
2020-02-26
Date Last Modified
2020-02-26
File Size
1.04 megabytes
Supplements
Rights
Redistribution rights reserved



Multi-strain malaria agent
Multi-strain malaria agent
Copyright:
David Gurarie
CWRU, Cleveland
dxg5@case.edu
Modeling details: https://www.biorxiv.org/content/10.1101/539676v3
CWRU, Cleveland
dxg5@case.edu
Modeling details: https://www.biorxiv.org/content/10.1101/539676v3
Codes
Codes
In-host (parasite-immune) model for multi-strain Pf malaria based on var-gene makeup
In-host (parasite-immune) model for multi-strain Pf malaria based on var-gene makeup
Initializations
Initializations
Outputs, mosquito transmission
Outputs, mosquito transmission
Parameters, inputs
Parameters, inputs
Diagnostics and plot codes
Diagnostics and plot codes
Dynamic MT-like histories
Dynamic MT-like histories
Case 1: crowded 5-variant
Case 1: crowded 5-variant
In[]:=
(*Var-generangeandReplicationf-n*)RaG=Range[0,nV=20];RepF=4+#&;
4.
nV
In[]:=
(*Tight5Vsystem:permutations*)(*5-strainsystem*)vss={{8,11,6,7,4},{8,4,6,11,7},{4,8,11,6,7},{6,4,8,11,7},{11,7,4,8,6}};TableForm[vss,TableHeadings{Range@Length@vss}]
Out[]//TableForm=
1 | 8 | 11 | 6 | 7 | 4 |
2 | 8 | 4 | 6 | 11 | 7 |
3 | 4 | 8 | 11 | 6 | 7 |
4 | 6 | 4 | 8 | 11 | 7 |
5 | 11 | 7 | 4 | 8 | 6 |
In[]:=
(*Loose5Vsystem:random*)vsL=(SeedRandom[124];RandomChoice[RaG,{5,5}]);TableForm[vsL,TableHeadings{Range@Length@vss}]
Out[]//TableForm=
1 | 3 | 6 | 12 | 3 | 19 |
2 | 14 | 13 | 20 | 0 | 5 |
3 | 0 | 2 | 8 | 13 | 3 |
4 | 17 | 19 | 16 | 16 | 1 |
5 | 9 | 20 | 4 | 2 | 11 |
Run
Run
In[]:=
(*Initialy-statewithinoculum*)InS0={1,InC@vsL,<||>};
In[]:=
(*Runin-hosthistory*){(*RBC*)hix,(*iRBC*)hiy,(*IE*)hiu}=Thread@NestList[RPIM[#,(*hostimmune*)ip1,(*Affinity*)1,yF1,(*SymmetricAV*)avS[5,(*switchingrate*)Swr,AVS]]&,InS0,(*cycles*)70];(*Totalparasitemiabystrain*)hyy=YGH[hiy][[1]];(*gametocytemia*)hgg=YGH[hiy][[2]];
In[]:=
(*PlotRBC-depletion*)PRB[hix,.5,GridLinesAutomatic,Asp@.5,Filling->Bottom]
Out[]=
In[]:=
(*PlotiRBCbystrain*)PGE[yCut+Values@hyy,-11,0,GridLines{Automatic,{yMS}},(PlotLegendsPlaced[ssL={S1,S2,S3,S4,S5},{Right,Top}]),Asp@.5]
Out[]=
In[]:=
(*PlotIEbyvar-gene*)huu=Merge[hiu,Identity];With[{kk=Keys@Select[huu,Max[#]>ui0&]},PGE[huu/@kk,-2,2,PlotLegendskk,Asp@.5,PlotTheme->"Detailed"]]
Out[]=
|
In[]:=
(*Gametocytemia*)PGE[yCut+Values@hgg,-11,0,GridLines{Automatic,{(*probability=.2cutoff*)7*^-6}},(PlotLegendsPlaced[ssL,{Right,Top}]),Asp@.5]
Out[]=
In[]:=
(*Infectivity=TP,transmisionprobability*)GtP=Chop/@(miP[(*>20%maturegametocytes*).2Nrb#,8]&/@hgg);PRB[1-Values@GtP,1.2,GridLinesAutomatic,Asp@.5,PlotLegendsPlaced[ssL,{Right,Top}]]
Out[]=
Test distributed inoculum source
Test distributed inoculum source
In[]:=
(*NaiveIS*)Ins0={1,<||>,<||>};(*Soursetimingsteps*)so4=With[{tt={4,1,13,6,8}},EIS[tt,vsL,70]];
In[]:=
(*History*){hix,hiy,hiu}=Thread@FoldList[RPIM[#,ip1,1,yF1,avS[5,Swr,AVC],#2]&,Ins0,Normal@so4];
In[]:=
(*RBCdepletion*)PRB[hix,.5,GridLinesAutomatic,Asp@.5,FillingBottom]
Out[]=
In[]:=
(*TimeseriesforiRBC,Gametocytemia,IE*){hyy,hgg,huu}=TYGU[hiy,hiu];hyt=TimeSeries/@hyy;hut=TimeSeries/@huu;hgt=TimeSeries/@hgg;
In[]:=
(*strainlabelsinsource*)ssL=PoZ[vsL,Join@@(Keys/@so4)];(*hyy*)Block[{Lyy=Length@hyy,FiL},(*Filling*)FiL={#{yMS,{Opacity[0],Automatic}}}&/@Range@Lyy;PGE[yCut+hyt,-10,-1,Asp@.5,FrameTrue,griD=(GridLines{{},{yMS,yPCR}}),FillingFiL,pLG=PlotLegendsPlaced[ssL,{Right,Top}]]]
Out[]=
In[]:=
(*IE*)PGE[Values@hut,-2,2,PlotLegendsKeys@hut,Asp@.5,PlotTheme->"Detailed"]
Out[]=
|
In[]:=
(*Gametocyte*)PGE[yCut+hgt,-10,-1,Asp@.5,griD=(GridLines{{},{yMS,yPCR}}),pLG]
Out[]=
In[]:=
(*TP-function*)GtP=Chop/@(miP[(*20%maturegametocytes*).2Nrb#,8]&/@hgt);PRB[1-GtP,1.2,GridLinesAutomatic,Asp@.5,pLG]
Out[]=
In[]:=
(*RunTP-weightsformixedstrainsystem*)TPH[so4,AVC,Swr,8]
Out[]=
{14,13,20,0,5}41.97,{3,6,12,3,19}22.81,{17,19,16,16,1}38.95,{9,20,4,2,11}37.1,{0,2,8,13,3}19.92
Long histories with random EIR
Long histories with random EIR
Code
Code
In[]:=
(*Transmissiblegametocytehistoryestimatedfromcompletehosthistoryhos,withtransmissibleG-numberm=8,M-infectionprobabilitympb=.2*)TrGH[hos_,m_,mpb_]:=Block[{hix,hiy,hiu,hyy,hgg,hg},{hix,hiy,hiu}=Thread@hos;(*Timeseries*){hyy,hgg}=TYG[hiy];hg=Map[{#[[1]],miP[.2Nrb#[[2]],m]}&,hgg,{2}];DeleteCases[Select[#,#[[2]]>mpb&]&/@hg,{}]]
In[]:=
(*RandombitingstepwithEIR=e/cycle;#variants=nv*)SoB[e_,nv_]:=If[RandomVariate@BernoulliDistribution[e]===0,{},<|RandomChoice[RaG,nv]{yd0YiN[nv,1],0}|>]
In[]:=
(*GraphLinkswithEdgeWeight*)Lib[{a_,b_}]:=Property[ab,{EdgeWeight->Length@Intersection[a,b],EdgeStyle{Thickness[.005Length@Intersection[a,b]],GrayLevel[1-Length@Intersection[a,b]/4]}}](*GenerateCRoverlap-graphfromacollectionofsubsetsvL*)GnG[vL_]:=Block[{(*links*)sb=Subsets[vL,{2}],Sb},(*selectoverlaplinks*)Sb=Select[sb,Length[Intersection@@#]>0&];GrL=Graph[Lib/@Sb,VertexLabels"Index",VertexLabelStyle14,GraphLayout"CircularEmbedding"];VL=VertexList@GrL]
Inputs
Inputs
In[]:=
(*Replicationf-n*)RaG=Range[0,nV=20];RepF=4+#&;(*Naivestate*)InS={1,<||>,<||>};
4.
nV
In[]:=
(*Randomsourcewith25independentclones*)With[{(*InoculationSource*)so2=(SeedRandom[1235];Table[SoB[.05,(*#variants*)5],{500}])},(*InoculationSourcewithinitialinoculum*)so1=Prepend[so2,<|{4,1,13,6,8}->yd0YiN[5,1]|>]];
(*Randomsourcedrawnfrom10clones*)With[{vss=(SeedRandom[1234];RandomChoice[RaG,{10,5}])},(*inoculaetiming*)ttz=Prepend[(SeedRandom[2323];Sort@RandomInteger[{1,900},45]),2];vsb=(SeedRandom[1212];RandomChoice[vss,45]);so2=EIS[ttz,vsb,901]];
Run long history (900 cycles = 1800 days)
Run long history (900 cycles = 1800 days)
In[]:=
(*Historyof25-strainsource*){hix,hiy,hiu}=Thread@(com=FoldList[RPIM[#,ip1,1,yF1,avS[5,Swr,AVC],#2]&,InS,Normal@so1]);
In[]:=
(*Historyof10-strainsource*){hix,hiy,hiu}=Thread@(com=FoldList[RPIM[#,ip1,1,yF1,avS[5,Swr,AVC],#2]&,InS,so2]);//AbsoluteTiming
Out[]=
{0.604924,Null}
(*RBCdepletion*)PRB[hix,.5,Asp@.15,FillingBottom,GridLines{180Range@5,Automatic},FrameTicks{{Automatic,{}},{180Range@5,{}}}]
25-strain (diverse)
Out[]=
10-strain (repeated)
Out[]=
so2 = 25 random clones drawn from 10
In[]:=
(*TimeseriesforiRBCandIE*){hyy,hgg,huu}=TYGU[hiy,hiu];hyt=TimeSeries/@hyy;hut=TimeSeries/@huu;
In[]:=
(*hyy*)Block[{Lyy=Length@hyy,FiL},(*Filling*)FiL={#{yMS,{Opacity[0],Automatic}}}&/@Range@Lyy;PGE[yCut+Values@hyt,-10,-1,Asp@.15,(GridLines{180Range@5,{yMS,yPCR}}),FrameTicks{{Automatic,{}},{180Range@5,{}}},FillingFiL]]
10-strain source
Out[]=
25 diverse
Out[]=
Transmission analysis
Transmission analysis
In[]:=
(*Gamete*)hgt=TimeSeries/@hgg;(*Transmisionprobability*)GtP=miP[.2Nrb#,8]&/@hgt;(*SelectedInfectivetypes*)GtS=Select[GtP,Max[#]>.2&];
(*TP-function*)PRB[(*1-PisduetoweirdPlotPRBforRBC*)1-Values@GtS,1.2,GridLinesAutomatic,Asp@.2]
25 diverse
Out[]=
CR-graphs (immune cross-reactivity)
CR-graphs (immune cross-reactivity)
In[]:=
(*Sourceclonesforso1*)kss=Keys@<|so1|>
Out[]=
{{4,1,13,6,8},{20,6,20,6,16},{3,9,2,5,9},{15,3,0,1,18},{13,4,15,0,11},{18,12,6,4,8},{10,11,0,6,3},{15,15,16,11,17},{8,20,5,6,16},{19,0,7,15,11},{10,19,15,17,20},{15,12,3,8,3},{11,19,16,20,7},{19,6,19,2,16},{15,1,14,20,17},{3,20,16,8,1},{9,3,1,7,12},{14,7,10,18,5},{16,16,1,14,20},{2,18,3,2,15},{9,19,15,4,20},{18,2,5,5,16},{16,15,3,11,13},{14,13,13,7,10},{18,19,0,9,14}}
In[]:=
(*CR-graph*)GnG[kss];GrL
Out[]=
In[]:=
(*MeanCR*)Mean[VertexDegree[GrL,#]&/@VL]//N
Out[]=
16.8
(*Transmissiblegametofor10-source*)hgp=With[{hg=Map[{#[[1]],miP[.2Nrb#[[2]],8]}&,hgg,{2}]},DeleteCases[Select[#,#[[2]]>.2&]&/@hg,{}]];
In[]:=
(*10-strain*)ksp=Keys@hgp;GnG[ksp];GrL
Out[]=
In[]:=
(*MeanCR*)Mean[VertexDegree[GrL,#]&/@VL]//N
Out[]=
6.6
Long history lost 1/2 of mean source CR
Transmissible G history
Transmissible G history
10-strain infected periods over 900
(*Timinglabelsforselectedtransmissibleclones:8of10*)Labs=With[{(*Positionsof10clonesinthe25-longsource*)Pvs=PositionIndex[vsb]},(*timingsequence*)ttz[[#]]&/@KeyTake[Pvs,Keys@GtS]];
In[]:=
ListLinePlot[MapIndexed[(#+First@#2-1)&,Values@GtS],FillingTable[nn-1,{n,10}],PlotTheme"Scientific",GridLines{Automatic,Range@10},PlotLabelsValues@Labs]
Out[]=
In[]:=
hgp=TrGH[com,8,.0001];
In[]:=
Leg=Length@hgp;ListLinePlot[MapIndexed[(#+First@#2-1)&,Values@hgp],FillingTable[nn-1,{n,Leg}],PlotTheme"Scientific",Asp@.4,(GridLines{180Range@5,Range@Leg}),FrameTicks{{Automatic,{}},{180Range@5,{}}}]


Cite this as: David Gurarie, "Malaria Agent 2020" from the Notebook Archive (2020), https://notebookarchive.org/2020-02-bz8e8mv

Download

