-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,706 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Package: phylopomp | ||
Type: Package | ||
Title: Phylodynamic Inference for POMP Models | ||
Version: 0.14.8.0 | ||
Date: 2024-11-15 | ||
Version: 0.14.7.5 | ||
Date: 2024-11-13 | ||
Authors@R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="[email protected]",comment=c(ORCID="0000-0001-6159-3207")), | ||
person(given=c("Qianying"),family="Lin",role=c("aut"),comment=c(ORCID="0000-0001-8620-9910")) | ||
) | ||
|
@@ -26,6 +26,7 @@ Collate: | |
'diagram.R' | ||
'foreach.R' | ||
'gendat.R' | ||
'get_states.R' | ||
'lbdp.R' | ||
'lbdp_exact.R' | ||
'lbdp_pomp.R' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
##' Get population state history | ||
##' | ||
##' Retrieves the history of population states (compartment sizes over time) | ||
##' from a Markov genealogy process simulation | ||
##' | ||
##' @name get_states | ||
##' @param object A \sQuote{gpsim} object | ||
##' @return A \code{\link[tibble]{tibble}} containing the population state history | ||
##' @export | ||
get_states <- function(object) { | ||
if (!inherits(object, "gpsim")) { | ||
stop("object must be a gpsim object") | ||
} | ||
|
||
switch( | ||
paste0("model", as.character(attr(object, "model"))), | ||
modelLBDP = .Call(P_get_states_LBDP,object), | ||
modelMoran = .Call(P_get_states_Moran,object), | ||
modelS2I2R2 = .Call(P_get_states_S2I2R2,object), | ||
modelSEIR = .Call(P_get_states_SEIR,object), | ||
modelSI2R = .Call(P_get_states_SI2R,object), | ||
modelSIIR = .Call(P_get_states_SIIR,object), | ||
modelSIR = .Call(P_get_states_SIR,object), | ||
modelTIMVA = .Call(P_get_states_TIMVA,object), | ||
modelTwoSpecies = .Call(P_get_states_TwoSpecies,object), | ||
stop("unrecognized model ", sQuote(attr(object, "model"))) | ||
) |> | ||
tibble::as_tibble() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
##' Within-host viral dynamic model with ALT | ||
##' | ||
##' Within-host viral dynamics of four types of cells and the released ALT. | ||
##' | ||
##' @name timva | ||
##' @family Genealogy processes | ||
##' @aliases TIMVA | ||
##' @param lambda target cell replenishment rate | ||
##' @param d target cell death rate | ||
##' @param Beta transmission rate | ||
##' @param delta infected cell death rate | ||
##' @param p free virus particle production rate per infected cell | ||
##' @param a immune cell activation rate per infected cell | ||
##' @param kappa infected cell killing rate | ||
##' @param c free virus particle clearance rate | ||
##' @param mu immune cell death rate | ||
##' @param omega proportion of ALT release per dead infected cell | ||
##' @param s ALT replenishment rate | ||
##' @param sigma ALT decay rate | ||
##' @param psi free virus particle sampling rate | ||
##' @param f probability of getting sampled | ||
##' @param dt time step for state recording | ||
##' @param T0 initial size of target cells | ||
##' @param I0 initial size of infected cells | ||
##' @param M0 initial size of immune cells | ||
##' @param V0 initial size of free virus particles | ||
##' @param A0 initial value of ALT | ||
##' @inheritParams sir | ||
##' @return \code{runTIMVA} and \code{continueTIMVA} return objects of class \sQuote{gpsim} with \sQuote{model} attribute \dQuote{TIMVA}. | ||
##' | ||
NULL | ||
|
||
##' @rdname timva | ||
##' @export | ||
runTIMVA <- function ( | ||
time, t0 = 0, | ||
lambda = 10, d = 0, Beta = 1e-4, delta = 0.01, p = 10, a = 0.1, kappa = 0.005, c = 3, mu = 0.05, omega = 0.1, s = 3, sigma = 0.3, psi = 0.1, f = 0.1, dt = 0.1, T0 = 1000, I0 = 0, M0 = 0, V0 = 1, A0 = 0 | ||
) { | ||
params <- c(lambda=lambda,d=d,Beta=Beta,delta=delta,p=p,a=a,kappa=kappa,c=c,mu=mu,omega=omega,s=s,sigma=sigma,psi=psi,f=f,dt=dt) | ||
ivps <- c(T0=T0,I0=I0,M0=M0,V0=V0,A0=A0) | ||
x <- .Call(P_makeTIMVA,params,ivps,t0) | ||
.Call(P_runTIMVA,x,time) |> | ||
structure(model="TIMVA",class=c("gpsim","gpgen")) | ||
} | ||
|
||
##' @rdname timva | ||
##' @export | ||
continueTIMVA <- function ( | ||
object, time, | ||
lambda = NA, d = NA, Beta = NA, delta = NA, p = NA, a = NA, kappa = NA, c = NA, mu = NA, omega = NA, s = NA, sigma = NA, psi = NA, f = NA, dt = NA | ||
) { | ||
params <- c( | ||
lambda=lambda,d=d,Beta=Beta,delta=delta,p=p,a=a,kappa=kappa,c=c,mu=mu,omega=omega,s=s,sigma=sigma,psi=psi,f=f,dt=dt | ||
) | ||
x <- .Call(P_reviveTIMVA,object,params) | ||
.Call(P_runTIMVA,x,time) |> | ||
structure(model="TIMVA",class=c("gpsim","gpgen")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
/* src/init.c */ | ||
extern void R_init_phylopomp(DllInfo *); | ||
/* src/lbdp_pomp.c */ | ||
extern void lbdp_rinit(double *, const double *, double, const int *, const int *, const int *, const double *); | ||
extern void lbdp_gill(double *, const double *, const int *, const int *, const int *, const double *, double, double); | ||
extern void lbdp_dmeas(double *, const double *, const double *, const double *, int, const int *, const int *, const int *, const int *, const double *, double); | ||
/* src/seirs_pomp.c */ | ||
extern void seirs_rinit(double *, const double *, double, const int *, const int *, const int *, const double *); | ||
extern void seirs_gill(double *, const double *, const int *, const int *, const int *, const double *, double, double); | ||
extern void seirs_dmeas(double *, const double *, const double *, const double *, int, const int *, const int *, const int *, const int *, const double *, double); | ||
/* src/sirs_pomp.c */ | ||
extern void sirs_rinit(double *, const double *, double, const int *, const int *, const int *, const double *); | ||
extern void sirs_gill(double *, const double *, const int *, const int *, const int *, const double *, double, double); | ||
extern void sirs_dmeas(double *, const double *, const double *, const double *, int, const int *, const int *, const int *, const int *, const double *, double); | ||
/* src/twospecies_pomp.c */ | ||
extern void twospecies_rinit(double *, const double *, double, const int *, const int *, const int *, const double *); | ||
extern void twospecies_gill(double *, const double *, const int *, const int *, const int *, const double *, double, double); | ||
extern void twospecies_dmeas(double *, const double *, const double *, const double *, int, const int *, const int *, const int *, const int *, const double *, double); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.