Commit 91a1d67d authored by loup.rimbaud@csiro.au's avatar loup.rimbaud@csiro.au
Browse files

complete file readme.md; update R documentation

parent 6b4eb5fa
Pipeline #70 failed with stage
in 2 minutes and 58 seconds
......@@ -22,20 +22,21 @@
#' @title Landscape generation
#' @name AgriLand
#' @description Generate a landscape composed of fields where a susceptible (SC) and one (RC) or two (RC1 and RC2) resistant cultivars
#' are allocated with controlled proportions and spatio-temporal aggregation
#' @param landscape a spatialpolygon object containing field coordinates
#' @param filename output layer name
#' @param propSR proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2)
#' @param isolSR spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated)
#' @param propRR when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2)
#' @param isolRR when applicable, spatial (for mosaics) or temporal (for rotations) aggregation of fields cultivated with the second resistant cultivar (1=highly fragmented, 2=balanced, 3=highly aggregated)
#' @param strat deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding)
#' @param Nhote number of cultivars (1, 2 or 3)
#' @param nYears number of simulated years
#' @param Cmax0 carrying capacity of the susceptible cultivar
#' @param Cmax1 carrying capacity of the resistant cultivars
#' @param seed seed value (for random number generator)
#' @param graphOn if a graph of the landscape must be generated
#' are allocated with controlled proportions and spatio-temporal aggregation.
#' @param landscape a spatialpolygon object containing field coordinates.
#' @param filename a character string specifying the output layer name.
#' @param propSR proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2). Must be between 0 and 1.
#' @param isolSR an integer giving the spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated).
#' @param propRR when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2). Must be between 0 and 1.
#' @param isolRR when applicable, an integer giving the spatial (for mosaics) or temporal (for rotations) aggregation of fields
#' cultivated with the second resistant cultivar (1=highly fragmented, 2=balanced, 3=highly aggregated).
#' @param strat a character string specifying the deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding).
#' @param Nhote an integer giving the number of cultivars (1, 2 or 3).
#' @param nYears an integer giving the number of simulated years.
#' @param Cmax0 carrying capacity of the susceptible cultivar in number of hosts per meter square.
#' @param Cmax1 carrying capacity of the resistant cultivars in number of hosts per meter square.
#' @param seed an integer giving the seed value (for random number generator).
#' @param graphOn a logical indicating if a graph of the landscape must be generated (1) or not (0).
#' @details An algorithm based on latent Gaussian fields is used to allocate two different crop cultivars across the simulated landscapes
#' (e.g. a susceptible and a resistant cultivar, denoted as SC and RC, respectively). This algorithm allows the control of the proportions
#' of each cultivar in terms of surface coverage, and their level of spatial aggregation. A random vector of values is drawn from a
......@@ -56,6 +57,7 @@
#' \item Pyramiding: all candidate fields are cultivated with RC12, a resistant cultivar carrying both resistance sources.
#' }
#' }
#' @return a shapefile containing the landscape structure (i.e. coordinates of field boundaries) and composition (i.e. cultivars).
#' @importFrom sf st_as_sf
#' @importFrom sf st_write
#' @importFrom grDevices dev.off graphics.off png tiff
......
......@@ -22,22 +22,22 @@
#' @title Generation of model outputs
#' @name HLIRdynamics
#' @description Generate epidemiological and evolutionary outputs from model simulations.
#' @param pathRES path of the repository where outputs will be generated
#' @param graphOn if graphics of the outputs must be generated
#' @param times list of simulation parameters (number of years, number of time-steps per year)
#' @param landscape agricultural landscape generated through AgriLand
#' @param hostP list of host parameters (number of cultivars, growth rate of the susceptible cultivar, reproduction rate of the susceptible cultivar,
#' @param pathRES a character string indicating the path of the repository where outputs will be generated.
#' @param graphOn a logical indicating if graphics of the outputs must be generated (1) or not (0).
#' @param times a list of simulation parameters (number of years, number of time-steps per year).
#' @param landscape a shapefile containing the agricultural landscape (can be generated through function AgriLand).
#' @param hostP a list of host parameters (number of cultivars, growth rate of the susceptible cultivar, reproduction rate of the susceptible cultivar,
#' growth rate of resistant cultivars, reproduction rate of resistant cultivars, death rate, number of possible resistance sources (8)
#' , resistance formula, parameters of the sigmoid invasion function: kappa, sigma and s)
#' @param epiP list of pathogen parameters (probability to survive the off-season, infection rate
#' , resistance formula, parameters of the sigmoid invasion function: kappa, sigma and s).
#' @param epiP a list of pathogen parameters (probability to survive the off-season, infection rate
#' , reproduction rate, average latent period duration, variance of the latent period, average infectious period duration
#' , variance of the infectious period duration, parameters of the sigmoid contamination function: kappa, sigma, s)
#' @param evolP list of evolution parameters (cost of infectivity, cost of aggressiveness, mutation rate, efficiency of major
#' , variance of the infectious period duration, parameters of the sigmoid contamination function: kappa, sigma, s).
#' @param evolP a list of evolution parameters (cost of infectivity, cost of aggressiveness, mutation rate, efficiency of major
#' resistance genes, efficiency of quantitative resistance, trade-off strength, number of increments of quantitative
#' resistance erosion, adaptation formula)
#' @param th_break threshold (number of infections) above which mutant pathogen are unlikely to go extinct, used to
#' characterise resistance breakdown
#' @param nMapPY number of epidemic maps per year to generate
#' resistance erosion, adaptation formula).
#' @param th_break an integer giving the threshold (number of infections) above which mutant pathogen are unlikely to go extinct, used to
#' characterise resistance breakdown.
#' @param nMapPY an integer specifying the number of epidemic maps per year to generate.
#' @details \describe{
#' \item{\strong{Evolutionary outputs.}}{ \describe{
#' \item{\emph{Durability of qualitative resistance:}}{
......
......@@ -18,20 +18,31 @@
#' @param evolP list of evolution parameters (cost of infectivity, cost of aggressiveness, mutation rate, efficiency of major
#' resistance genes, efficiency of quantitative resistance, trade-off strength, number of increments of quantitative
#' resistance erosion, adaptation formula)
#' @details The model is stochastic, spatially explicit (the basic spatial unit is an individual field), based on a SEIR
#' @details \itemize{
#' \item The model is stochastic, spatially explicit (the basic spatial unit is an individual field), based on a SEIR
#' (‘susceptible-exposed-infectious-removed’) structure with a discrete time step. It simulates the spread and evolution
#' of a pathogen in an agricultural landscape, across cropping seasons split by host harvests which impose potential bottlenecks
#' to the pathogen. A wide array of deployment strategies can be simulated: mosaics, mixtures, rotations and pyramiding of multiple
#' to the pathogen.
#' \item A wide array of deployment strategies can be simulated: mosaics, mixtures, rotations and pyramiding of multiple
#' major resistance genes which affect pathogen infectivity, and up to four quantitative resistance traits.
#' These traits target different aggressiveness components of the pathogen, i.e. the infection rate, the duration of the latent
#' period and the infectious period, and the propagule production rate. Initially, the pathogen is not adapted to any source of
#' period and the infectious period, and the propagule production rate.
#' \item The genotype of cultivated plant cultivars is specified using
#' the "resistance formulas", i.e. a vector of size 8. the four first elements indicate whether the cultivar carries major resistance
#' genes #1, #2, #3 and #4, respectively. The following four elements indicate whether the cultivar carried a quantitative resistance
#' trait against the infection rate, the latent period duration, the sporulation rate, or the sporulation duration of the pathogen, respectively.
#' For example, the formula c(1,0,0,0,0,1,0,0) indicates the presence of major gene #1 and a quantitative resistance
#' which increases the duration of the latent period of the pathogen.
#' \item Initially, the pathogen is not adapted to any source of
#' resistance, and is only present on susceptible hosts. However, through mutation, it can evolve and may acquire infectivity
#' genes (which leads to breakdown of major resistance genes) or increase aggressiveness (which leads to the erosion of the
#' relevant quantitative resistance traits). However, evolution of a pathogen toward infectivity or increased aggressiveness on
#' relevant quantitative resistance traits).
#' \item Evolution of a pathogen toward infectivity or increased aggressiveness on
#' a resistant host is often penalised by a fitness cost on susceptible hosts. Consequently, in the present model, pathogens
#' carrying infectivity genes may have reduced infection rate (cost of infectivity) on susceptible hosts relative
#' to pathogens that do not carry these genes. Similarly, a gain in pathogen aggressiveness on quantitatively resistant hosts
#' is penalised by a decreased aggressiveness on susceptible hosts, leading to a trade-off.
#' }
#' @return A set of binary files is generated for every year of simulation and every compartment: \itemize{
#' \item H: healthy hosts,
#' \item Hjuv: juvenile healthy hosts,
......
......@@ -21,9 +21,10 @@
#' Run demo landsepi
#' @title Package demonstration
#' @name demo_landsepi
#' @description Run a simulated example of mosaic deployment strategy of two resistant cultivars in balanced proportions and
#' high level of spatial aggregation.
#' @description Run a demonstration of the package.
#' @param seed an integer used as seed value (for random number generator)
#' @details Run a simulated example of mosaic deployment strategy of two resistant cultivars in balanced proportions and
#' high level of spatial aggregation. The generated model outputs are graphics and text files.
#' @include RcppExports.R AgriLand.R graphLand.R multiN.R periodic_cov.R
#' @importFrom utils data
#' @export
......
......@@ -18,33 +18,140 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#' @title Package testing (for development)
#' @title Simulation with provided data
#' @name test_landsepi
#' @description RScript for testing.
#' @param seed an integer used as seed value (for random number generator)
#' @param idLan index of landscape (1 to 5)
#' @param propSR proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2)
#' @param isolSR spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated)
#' @param propRR when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2)
#' @param isolRR when applicable, spatial (for mosaics) or temporal (for rotations) aggregation of fields cultivated with the second resistant cultivar (1=highly fragmented, 2=balanced, 3=highly aggregated)
#' @param strat deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding)
#' @param nHost number of cultivars (1, 2 or 3)
#' @param nYears number of simulated years
#' @param pI0 initial probability of infection
#' @param resistance1 resistance formula of the 2nd cultivar (binary formula for 8 traits)
#' @param resistance2 resistance formula of the 3rd cultivar (binary formula for 8 traits)
#' @param costInfect cost of infectivity
#' @param costAggr cost of aggressiveness
#' @param taumut mutation probability
#' @param MGeff efficiency of major-gene resistance
#' @param QReff efficiency of quantitative resistance
#' @param beta trade-off strength
#' @param nAggr number of increments to completely adapt to quantitative resistance
#' @param graphOn if graphics must be generated
#' @return A set of text files containing all outputs of the simulations (see details).
#' @description Simulation of the deployment of plant resistance, using landscape structures provided with the package
#' and a parameterisation of the model to represent pathogens as typified by rusts of cereals (e.g. stripe rust, stem rust
#' , and leaf rust of wheat and barley). All parameters are optional. See details for explanations.
#' @param seed an integer used as seed value (for random number generator).
#' @param idLan an integer giving the index of landscape structure (1 to 5).
#' @param propSR proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2). Must be between 0 and 1.
#' @param isolSR an integer giving the spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated).
#' @param propRR when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2). Must be between 0 and 1.
#' @param isolRR when applicable, an integer specifying the spatial (for mosaics: 1=highly fragmented, 2=balanced, 3=highly aggregated) or
#' temporal (for rotations: 1=every year, 2=every two years, 3=every three years) aggregation of fields cultivated with the second resistant cultivar.
#' @param strat a character string specifying the deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding).
#' @param nHost an integer giving the number of cultivars (1, 2 or 3).
#' @param nYears an integer giving the number of simulated years.
#' @param pI0 initial probability of infection of the susceptible cultivar. Must be between 0 and 1.
#' @param resistance1 a logical vector of size 8 giving the resistance formula of the 2nd cultivar (see details)
#' @param resistance2 when applicable, a logical vector of size 8 giving the resistance formula of the 3rd cultivar (see details)
#' @param costInfect cost of infectivity paid by infective pathogens (i.e. adapted to plant cultivars carrying a major gene) on susceptible hosts. Must be between 0 and 1.
#' @param costAggr cost of aggressiveness paid by fully adapted pathogens (relative to plant cultivars carrying a quantitative resistance trait) on fully susceptible hosts. Must be between 0 and 1.
#' @param taumut mutation probability: probability for a propagule to change its infectivity or its aggressiveness on a resistant cultivar
#' carrying a major gene or a quantitative resistance trait. Must be above 0. If equal to 0, then the pathogen cannot evolve.
#' @param MGeff efficiency of major-gene resistance on the infection rate of non-adapted pathogens. Must be between 0 and 1.
#' @param QReff efficiency of quantitative resistance on the target aggressiveness trait (infection rate, latent period duration,
#' sporulation rate, or sporulation duration) of non-adapted pathogens. Must be between 0 and 1.
#' @param beta trade-off strength for pathogen adaptation to quantitative resistance (<1 for weak, =1 for linear, >1 for strong). Must be above 0.
#' @param nAggr an integer specifying the number of increments to completely adapt to quantitative resistance. Must be greater or equal 2.
#' @param graphOn a logical indicating if graphics must be generated (1) or not (0).
#' @details \describe{
#'
#' \item{Landscape structure}{The landscape structure is the physical structure of the area, defined as the spatial arrangement of fields.}
#'
#' \item{Deployment strategies}{Deployment strategies include the deployment of a susceptible cultivar (SC)
#' and one (RC) or two (RC1 and RC2) resistant cultivars carrying up to four major resistance genes or up to four
#' quantitative resistance traits (against infection rate, latent period, sporulation rate and sporulation duration
#' of the pathogen). In addition, the different resistance sources can be combined in time (crop rotation: recurrent
#' succession of cultivars in the same field), or space within a single cultivar (pyramiding), in different cultivars
#' of the same field (mixtures) or in different fields (mosaics).}
#'
#' \item{Resistance formulas}{The genetic resistance carried by a plant cultivar is specified by a vector of size 8: the
#' four first elements indicate whether the cultivar carries major resistance genes #1, #2, #3 and #4, respectively.
#' The following four elements indicate whether the cultivar carried a quantitative resistance trait against the
#' infection rate, the latent period duration, the sporulation rate, or the sporulation duration of the pathogen, respectively.
#' For example, the formula c(1,0,0,0,0,1,0,0) indicates the presence of major gene #1 and a quantitative resistance which
#' increases the duration of the latent period of the pathogen.}
#'
#' \item{Model outputs}{
#'
#' \describe{
#' \item{\strong{Evolutionary outputs.}}{ \describe{
#' \item{\emph{Durability of qualitative resistance:}}{
#' For a given major gene, several computations are
#' performed: \itemize{
#' \item (d1) time to first appearance of a pathogen mutant;
#' \item (d2) time to first true infection of a resistant host by such mutants; and
#' \item (d3) time when the number of infections of resistant hosts by these mutants reaches a threshold above which mutant pathogens are unlikely to go extinct.
#' }
#' }
#' \item{\emph{Erosion of quantitative resistance:}}{
#' pathogen adaptation to quantitative resistance is gradual, so the three measures described above are computed for every step
#' towards complete erosion of resistance (i.e. nAgw-1 levels).}
#' \item{\emph{Durability of a deployment strategy:}}{ a simulation run is divided into three periods: \enumerate{
#' \item the initial short-term period when all resistance sources are at their highest potential;
#' \item a transitory period during which a given deployment strategy is only partially effective; and
#' \item a longer-term period when all the resistances have been overcome or completely eroded.
#' }
#' To assess the end of the short-term period, the time to establishment (durability measure (d3)) is computed for every major gene, and every quantitative trait
#' at the first level of erosion (agw(p)=2). The minimal value of these measures, denoted by D1, delimitates short-term and transitory periods.
#' Similarly, the time to establishment is computed for every major gene, and for every quantitative trait at the highest level of erosion (agw(p)=nAgw).
#' The maximal value of these measures, termed D2, delimits transitory and long-term periods.
#' }
#' }
#' }
#' \item{\strong{Epidemiological outputs.}}{
#' The epidemiological impact of pathogen spread is evaluated by two different measures: \enumerate{
#' \item Green Leaf Area (GLA): The GLA represents the average number of productive hosts per time step and per surface unit.
#' \item Area Under Disease Progress Curve (AUDPC): The AUDPC is the average proportion of diseased hosts relative to the carrying capacity and represents disease severity.
#' }
#' \describe{
#' \item{\emph{Global epidemiological control:}}{
#' The GLA and AUDPC of every cultivar as well as the whole landscape are averaged across the whole simulation run,
#' to measure the global epidemiological performance of a deployment strategy.}
#' \item{\emph{Short-term epidemiological control:}}{
#' The average GLA and AUDPC of the susceptible
#' cultivar is computed on whole cropping seasons from the beginning of the simulation until the end of
#' the season preceding year before D1.}
#' \item{\emph{Epidemiological control during the transitory period:}}{
#' The average GLA and AUDPC of the susceptible cultivar is computed on whole seasons from the
#' beginning of the season following year after D1 to the end of the season year before preceding D2.}
#' \item{\emph{Long-term epidemiological control:}}{
#' The average GLA and AUDPC of the whole landscape is computed on whole seasons
#' from the beginning of the year after D2 to the end of the simulation.}
#' }
#' }
#' }
#' }
#' }
#' @return A set of binary files is generated for every year of simulation and every compartment: \itemize{
#' \item H: healthy hosts,
#' \item Hjuv: juvenile healthy hosts,
#' \item L: latently infected hosts,
#' \item I: infectious hosts,
#' \item R: removed hosts,
#' \item S: propagules.
#' }
#' Each file indicates for every time-step the number of individuals in each field, and when appropriate for each cultivar and pathotype)
#' These binary files are used to generate a set of text files containing all outputs of the simulations (see details).
#' A set of graphics and epidemic maps can also be generated.
#' @examples \donttest{
#' test_landsepi()
#'
#' ## Mosaic of two major genes
#' test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, propRR=1/2, isolRR=3, strat="MO", nHost=3
#' , nYears=50, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
#' , costInfect=0.5, taumut=1e-7)
#'
#' ## Mixture of two major genes
#' test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, propRR=1/2, strat="MI", nHost=3
#' , nYears=50, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
#' , costInfect=0.5, taumut=1e-7)
#'
#' ## Rotations of two major genes
#' test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, isolRR=1, strat="RO", nHost=3
#' , nYears=50, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
#' , costInfect=0.5, taumut=1e-7)
#'
#' ## Pyramiding of two major genes
#' test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, strat="PY", nHost=2
#' , nYears=50, resistance1=c(1,1,0,0,0,0,0,0), costInfect=0.5, taumut=1e-7)
#'
#' ## Combination of a major gene with a quantitative resistance against the latent period
#' test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2
#' , nYears=50, resistance1=c(1,0,0,0,0,1,0,0)
#' , costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
#' }
#' @include RcppExports.R AgriLand.R graphLand.R multiN.R periodic_cov.R
#' @importFrom utils data
......
###########################
##### R package landsepi ####
###########################
## Configuration
read file "DESCRIPTION" for configuration requirements and required library (linux and R)
## Descriptions
---
output:
pdf_document: default
html_document: default
---
# R package landsepi
Landscape Epidemiology and Evolution
## Description
A spatio-temporal stochastic model to assess resistance deployment strategies against plant pathogens.
The model is based on stochastic geometry for describing the landscape and the resistant hosts, a dispersal kernel for the dissemination of the pathogen, and a SEIR architecture to simulate plant response to disease.
## Authors
* CSIRO [[https://www.csiro.au]]
* INRA [[https://www.inra.fr]]
......@@ -19,14 +19,13 @@ read file "DESCRIPTION" for configuration requirements and required library (lin
* Jean-Francois Rey [[jean-francois.rey@inra.fr]]
## License
The package landsepi is under GNU GPL V2.
See LICENSE file.
## R package
### Dependencies
## Installation
### Configuration and dependencies
Read file "DESCRIPTION" for details on configuration requirements (with linux and R)
The package for compiling needs g++, gsl dev library and gdal dev library >= 2.0.0 .
Under Linux OS:
......@@ -56,7 +55,6 @@ install.packages(c("Rcpp","sp","rgdal","Matrix","MASS","rgeos","maptools","field
```
### Install landsepi
To install the last version :
```bash
......@@ -68,9 +66,8 @@ R CMD INSTALL landsepi_*.*.*.zip
## Development
### Before build and install
open R :
### Generate documentation before build and install
Open R :
```r
library(Rcpp)
......@@ -79,7 +76,7 @@ Rcpp::compileAttribute(pkg=".")
roxygen2::roxygenize('.', roclets=c('rd', 'namespace'))
```
### build and install
### Build and install the package
```bash
R CMD build . --resave-data
......@@ -92,13 +89,86 @@ For debug mode :
R CMD INSTALL landsepi_*.*.*.tar.gz --with-keep.source --configure-args="--enable-debug=yes"
```
### Tests
## Package users: Running simulations
No unit test add yet.
You can play the demo:
### Documentation and demonstration
A complete description of the package and its functions is provided in the R documentation.
Open R:
```r
library(landsepi)
??landsepi ## select <landsepi::landsepi-package> for a complete description of the package
```
Run a demonstration (a 30-year simulation of a mosaic deployment strategy of two resistant cultivars in balanced proportions and high level of spatial aggregation):
```r
demo_landsepi()
```
### Simulations with data included in the package
The package includes 5 landscape structures and a parameterisation to represent plant pathogens as typified by rusts of cereal crops (e.g. stripe rust, stem rust and leaf rust of wheat and barley). These data can be used to simulate the deployment of plant resistance in an agricultural lansdcape in the context of biotrophic foliar pathogens of cereal crops. The R documentation provides details on all parameters.
```r
## complete description of the parameters
?test_landsepi
## Default parameterisation
test_landsepi() ## 5-year simulation of a mosaic deployment strategy of two resistant cultivars in balanced proportions and high level of spatial aggregation
```
#### Strategies combining qualitative and quantitative resistance
Examples of combinations in a 50-year period using landscape #1:
```r
## Combination of two major resistance genes
test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2, nYears=50
, resistance1=c(1,1,0,0,0,0,0,0)
, costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
## Combination of a major gene with a quantitative resistance against the infection rate
test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2, nYears=50
, resistance1=c(1,0,0,0,1,0,0,0)
, costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
## Combination of a major gene with a quantitative resistance against the latent period
test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2, nYears=50
, resistance1=c(1,0,0,0,0,1,0,0)
, costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
## Combination of a major gene with a quantitative resistance against the sporulation rate
test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2, nYears=50
, resistance1=c(1,0,0,0,0,0,1,0)
, costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
## Combination of a major gene with a quantitative resistance against the sporulation duration
test_landsepi(seed=1, idLan=1, propSR=0.8, isolSR=1, strat="PY", nHost=2, nYears=50
, resistance1=c(1,0,0,0,0,0,0,1)
, costInfect=0.5, costAggr=0.5, taumut=1e-7, MGeff=1.0, QReff=0.5, beta=1.0, nAggr=6)
```
#### Spatiotemporal strategies to deploy 2 major resistance genes
Examples of spatiotemporal strategies in a 50-year period using landscape #1:
```r
## Mosaic
test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, propRR=1/2, isolRR=3, strat="MO", nHost=3, nYears=50
, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
, costInfect=0.5, taumut=1e-7)
## Mixture
test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, propRR=1/2, strat="MI", nHost=3, nYears=50
, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
, costInfect=0.5, taumut=1e-7)
## Rotations
test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, isolRR=1, strat="RO", nHost=3, nYears=50
, resistance1=c(1,0,0,0,0,0,0,0), resistance2=c(0,1,0,0,0,0,0,0)
, costInfect=0.5, taumut=1e-7)
## Pyramiding
test_landsepi(seed=1, idLan=1, propSR=2/3, isolSR=3, strat="PY", nHost=2, nYears=50
, resistance1=c(1,1,0,0,0,0,0,0)
, costInfect=0.5, taumut=1e-7)
```
### Simulation with other data
It is possible to use any landscape stored in a shapefile, and parameterise to model to any other pathosystem. For this, users need to use the following functions:
(1) AgriLand: to allocate the different cultivars in the fields of the landscape within a specific spatiotemporal deployment of resistance;
(2) modelLandsEPI: to run the demo-genetic simulation model;
(3) HLIRdynamics: to generate epidemiological and evolutionary outputs.
See R documentation to see how to use these functions.
```r
?AgriLand ## Allocation of cultivars in the landscape
?modelLandsEPI ## Run the demo-genetic model
?HLIRdynamics ## Generate the output
```
......@@ -8,35 +8,39 @@ AgriLand(landscape, filename = "landscapeTEST1", propSR, isolSR, propRR,
isolRR, strat, Nhote, nYears, Cmax0, Cmax1, seed, graphOn)
}
\arguments{
\item{landscape}{a spatialpolygon object containing field coordinates}
\item{landscape}{a spatialpolygon object containing field coordinates.}
\item{filename}{output layer name}
\item{filename}{a character string specifying the output layer name.}
\item{propSR}{proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2)}
\item{propSR}{proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2). Must be between 0 and 1.}
\item{isolSR}{spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated)}
\item{isolSR}{an integer giving the spatial aggregation of fields where resistance is deployed (1=highly fragmented, 2=balanced, 3=highly aggregated).}
\item{propRR}{when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2)}
\item{propRR}{when applicable (mixtures and mosaics only), relative proportion of the second resistant cultivar: (RC2)/(RC1+RC2). Must be between 0 and 1.}
\item{isolRR}{when applicable, spatial (for mosaics) or temporal (for rotations) aggregation of fields cultivated with the second resistant cultivar (1=highly fragmented, 2=balanced, 3=highly aggregated)}
\item{isolRR}{when applicable, an integer giving the spatial (for mosaics) or temporal (for rotations) aggregation of fields
cultivated with the second resistant cultivar (1=highly fragmented, 2=balanced, 3=highly aggregated).}
\item{strat}{deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding)}
\item{strat}{a character string specifying the deployment strategy ("MO"=mosaic, "MI"=mixture, "RO"=rotations, "PY"=pyramiding).}
\item{Nhote}{number of cultivars (1, 2 or 3)}
\item{Nhote}{an integer giving the number of cultivars (1, 2 or 3).}
\item{nYears}{number of simulated years}
\item{nYears}{an integer giving the number of simulated years.}
\item{Cmax0}{carrying capacity of the susceptible cultivar}
\item{Cmax0}{carrying capacity of the susceptible cultivar in number of hosts per meter square.}
\item{Cmax1}{carrying capacity of the resistant cultivars}
\item{Cmax1}{carrying capacity of the resistant cultivars in number of hosts per meter square.}
\item{seed}{seed value (for random number generator)}
\item{seed}{an integer giving the seed value (for random number generator).}
\item{graphOn}{if a graph of the landscape must be generated}
\item{graphOn}{a logical indicating if a graph of the landscape must be generated (1) or not (0).}
}
\value{
a shapefile containing the landscape structure (i.e. coordinates of field boundaries) and composition (i.e. cultivars).
}
\description{
Generate a landscape composed of fields where a susceptible (SC) and one (RC) or two (RC1 and RC2) resistant cultivars
are allocated with controlled proportions and spatio-temporal aggregation
are allocated with controlled proportions and spatio-temporal aggregation.
}
\details{
An algorithm based on latent Gaussian fields is used to allocate two different crop cultivars across the simulated landscapes
......
......@@ -8,30 +8,30 @@ HLIRdynamics(pathRES, graphOn, times, landscape, hostP, epiP, evolP,
th_break = 50000, nMapPY = 0)
}
\arguments{
\item{pathRES}{path of the repository where outputs will be generated}
\item{pathRES}{a character string indicating the path of the repository where outputs will be generated.}
\item{graphOn}{if graphics of the outputs must be generated}
\item{graphOn}{a logical indicating if graphics of the outputs must be generated (1) or not (0).}
\item{times}{list of simulation parameters (number of years, number of time-steps per year)}
\item{times}{a list of simulation parameters (number of years, number of time-steps per year).}
\item{landscape}{agricultural landscape generated through AgriLand}
\item{landscape}{a shapefile containing the agricultural landscape (can be generated through function AgriLand).}
\item{hostP}{list of host parameters (number of cultivars, growth rate of the susceptible cultivar, reproduction rate of the susceptible cultivar,
\item{hostP}{a list of host parameters (number of cultivars, growth rate of the susceptible cultivar, reproduction rate of the susceptible cultivar,
growth rate of resistant cultivars, reproduction rate of resistant cultivars, death rate, number of possible resistance sources (8)
, resistance formula, parameters of the sigmoid invasion function: kappa, sigma and s)}
, resistance formula, parameters of the sigmoid invasion function: kappa, sigma and s).}
\item{epiP}{list of pathogen parameters (probability to survive the off-season, infection rate
\item{epiP}{a list of pathogen parameters (probability to survive the off-season, infection rate
, reproduction rate, average latent period duration, variance of the latent period, average infectious period duration
, variance of the infectious period duration, parameters of the sigmoid contamination function: kappa, sigma, s)}
, variance of the infectious period duration, parameters of the sigmoid contamination function: kappa, sigma, s).}
\item{evolP}{list of evolution parameters (cost of infectivity, cost of aggressiveness, mutation rate, efficiency of major
\item{evolP}{a list of evolution parameters (cost of infectivity, cost of aggressiveness, mutation rate, efficiency of major
resistance genes, efficiency of quantitative resistance, trade-off strength, number of increments of quantitative
resistance erosion, adaptation formula)}
resistance erosion, adaptation formula).}
\item{th_break}{threshold (number of infections) above which mutant pathogen are unlikely to go extinct, used to
characterise resistance breakdown}
\item{th_break}{an integer giving the threshold (number of infections) above which mutant pathogen are unlikely to go extinct, used to
characterise resistance breakdown.}
\item{nMapPY}{number of epidemic maps per year to generate}
\item{nMapPY}{an integer specifying the number of epidemic maps per year to generate.}
}
\value{
A set of text files containing all outputs of the simulations (see details).
......
......@@ -10,9 +10,11 @@ demo_landsepi(seed = 12345)
\item{seed}{an integer used as seed value (for random number generator)}
}
\description{
Run a simulated example of mosaic deployment strategy of two resistant cultivars in balanced proportions and
high level of spatial aggregation.
Run a demonstration of the package.
}
\details{
Run demo landsepi
Run a simulated example of mosaic deployment strategy of two resistant cultivars in balanced proportions and
high level of spatial aggregation. The generated model outputs are graphics and text files.
}
......@@ -5,9 +5,8 @@
\name{landsepi-package}
\alias{landsepi-package}
\alias{_PACKAGE}
\alias{briskaRepi-package}
\alias{briskaRepi}
\title{Landscape Epidemiology & Evolution}
\alias{landsepi}
\title{Landscape Epidemiology and Evolution}
\description{
A spatio-temporal stochastic model to assess resistance deployment strategies against plant pathogens.
The model is based on stochastic geometry for describing the landscape and the resistant hosts,
......
......@@ -44,18 +44,29 @@ Each file indicates for every time-step the number of individuals in each field,
Stochastic, spatially-explicit, demo-genetic model simulating the spread and evolution of a pathogen in a heterogeneous landscape.
}
\details{
The model is stochastic, spatially explicit (the basic spatial unit is an individual field), based on a SEIR
\itemize{
\item The model is stochastic, spatially explicit (the basic spatial unit is an individual field), based on a SEIR
(‘susceptible-exposed-infectious-removed’) structure with a discrete time step. It simulates the spread and evolution
of a pathogen in an agricultural landscape, across cropping seasons split by host harvests which impose potential bottlenecks
to the pathogen. A wide array of deployment strategies can be simulated: mosaics, mixtures, rotations and pyramiding of multiple
to the pathogen.
\item A wide array of deployment strategies can be simulated: mosaics, mixtures, rotations and pyramiding of multiple
major resistance genes which affect pathogen infectivity, and up to four quantitative resistance traits.
These traits target different aggressiveness components of the pathogen, i.e. the infection rate, the duration of the latent
period and the infectious period, and the propagule production rate. Initially, the pathogen is not adapted to any source of
period and the infectious period, and the propagule production rate.
\item The genotype of cultivated plant cultivars is specified using
the "resistance formulas", i.e. a vector of size 8. the four first elements indicate whether the cultivar carries major resistance
genes #1, #2, #3 and #4, respectively. The following four elements indicate whether the cultivar carried a quantitative resistance
trait against the infection rate, the latent period duration, the sporulation rate, or the sporulation duration of the pathogen, respectively.
For example, the formula c(1,0,0,0,0,1,0,0) indicates the presence of major gene #1 and a quantitative resistance
which increases the duration of the latent period of the pathogen.
\item Initially, the pathogen is not adapted to any source of
resistance, and is only present on susceptible hosts. However, through mutation, it can evolve and may acquire infectivity
genes (which leads to breakdown of major resistance genes) or increase aggressiveness (which leads to the erosion of the
relevant quantitative resistance traits). However, evolution of a pathogen toward infectivity or increased aggressiveness on
relevant quantitative resistance traits).
\item Evolution of a pathogen toward infectivity or increased aggressiveness on
a resistant host is often penalised by a fitness cost on susceptible hosts. Consequently, in the present model, pathogens
carrying infectivity genes may have reduced infection rate (cost of infectivity) on susceptible hosts relative
to pathogens that do not carry these genes. Similarly, a gain in pathogen aggressiveness on quantitatively resistant hosts
is penalised by a decreased aggressiveness on susceptible hosts, leading to a trade-off.
}
}
......@@ -2,7 +2,7 @@
% Please edit documentation in R/test_landsepi.R
\name{test_landsepi}
\alias{test_landsepi}
\title{Package testing (for development)}
\title{Simulation with provided data}
\usage{
test_landsepi(seed = 12345, idLan = 1, propSR = 2/3, isolSR = 3,
propRR = 1/2, isolRR = 3, strat = "MO", nHost = 3, nYears = 5,
......@@ -11,55 +11,164 @@ test_landsepi(seed = 12345, idLan = 1, propSR = 2/3, isol