Commit d352cb78 authored by Loup Rimbaud's avatar Loup Rimbaud Committed by demo
Browse files

Merge landsepiDev to landsepi

correction bugs
parent 7afebb42
Pipeline #233 passed with stage
in 36 minutes and 43 seconds
......@@ -4,7 +4,7 @@ package:
script:
- "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
- "R CMD build . --resave-data"
- "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
- "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
package-devel:
tags:
......@@ -12,7 +12,7 @@ package-devel:
script:
- "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
- "R CMD build . --resave-data"
- "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
- "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
package-Mac-base:
tags:
......@@ -21,7 +21,7 @@ package-Mac-base:
script:
- "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
- "R CMD build . --resave-data"
- "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
- "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
package-windows:
tags:
......@@ -31,7 +31,7 @@ package-windows:
script:
- "Rscript -e \"roxygen2::roxygenize('.',roclets=c('rd','collate','namespace'))\""
- "R CMD build . --resave-data"
- "R CMD INSTALL --build --force-biarch $(ls -rt landsepiDev_*.tar.gz |tail -1)"
- "R CMD INSTALL --build --force-biarch $(ls -rt landsepi_*.tar.gz |tail -1)"
release-win:
variables:
......@@ -43,10 +43,10 @@ release-win:
script:
- "Rscript -e \"roxygen2::roxygenize('.',roclets=c('rd','collate','namespace'))\""
- "R CMD build . --resave-data"
- "R CMD INSTALL --build --force-biarch $(ls -rt landsepiDev_*.tar.gz |tail -1)"
- "R CMD INSTALL --build --force-biarch $(ls -rt landsepi_*.tar.gz |tail -1)"
artifacts:
paths:
- "$(ls -rt landsepiDev_*.zip |tail -1)"
- "$(ls -rt landsepi_*.zip |tail -1)"
only:
- tags
......@@ -56,10 +56,10 @@ release-package:
script:
- "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
- "R CMD build . --resave-data"
- "R CMD check --as-cran $(ls -rt landsepiDev_* |tail -1)"
- "R CMD check --as-cran $(ls -rt landsepi_* |tail -1)"
artifacts:
paths:
- "$(ls -rt landsepiDev_* |tail -1)"
- "$(ls -rt landsepi_* |tail -1)"
only:
- tags
......@@ -70,10 +70,10 @@ release-Mac:
script:
- "Rscript -e \"roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))\""
- "R CMD build . --resave-data"
- "R CMD INSTALL --build $(ls -rt landsepiDev_*.tar.gz |tail -1)"
- "R CMD INSTALL --build $(ls -rt landsepi_*.tar.gz |tail -1)"
artifacts:
paths:
- "$(ls -rt landsepiDev_*.tgz | tail -1)"
- "$(ls -rt landsepi_*.tgz | tail -1)"
only:
- tags
......
Package: landsepiDev
Package: landsepi
Type: Package
Encoding: UTF-8
Title: Landscape Epidemiology and Evolution
Version: 0.0.5
Date: 2018-11-27
Version: 0.0.6
Date: 2019-01-09
Authors@R: c(person("Loup", "Rimbaud", role = "aut", email = "loup.rimbaud@inra.fr"),
person("Julien", "Papaix", role = "aut", email = "julien.papaix@inra.fr"),
person("Jean-Francois", "Rey", role = "cre", email = "jean-francois.rey@inra.fr"))
......
......@@ -34,4 +34,4 @@ importFrom(sf,st_read)
importFrom(sf,st_write)
importFrom(utils,data)
importFrom(utils,write.table)
useDynLib(landsepiDev)
useDynLib(landsepi)
......@@ -32,10 +32,10 @@
#' resistance erosion, adaptation formula).
#' @param ecoP a list of economic parameters (yield, purchase price, selling price).
#' @param graphic a logical indicating if graphics of the outputs must be generated (TRUE) or not (FALSE).
#' @param video a logical indicating if a video must be generated (TRUE) or not (FALSE). Works only if graphic is TRUE as well.
#' @param video a logical indicating if a video must be generated (TRUE) or not (FALSE). Works only if graphic is TRUE as well. Note that ffmpeg is required to generate videos.
#' @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 in the video (0 if video is not to be generated).
#' @param nMapPY an integer specifying the number of epidemic maps per year in the video (video must be TRUE).
#' @details \describe{
#' \item{\strong{Evolutionary outputs.}}{ \describe{
#' \item{\emph{Durability of qualitative resistance:}}{
......@@ -118,8 +118,8 @@ HLIRdynamics <- function(pathRES, timeP, landscape, hostP, evolP, ecoP, graphic,
#### LANDSCAPE ####
area <- landscape_tmp$area
hab1 <- landscape_tmp$habitat1
hab2 <- landscape_tmp$habitat2
hab1 <- landscape_tmp$habitat0
hab2 <- landscape_tmp$habitat1
habitat <- cbind(hab1, hab2)+1 ## +1 due to 0 as first index in C
rotation <- landscape$rotation+1
Npoly <- length(area)
......@@ -240,7 +240,7 @@ for (y in 1:nYears){
C_host[host, y] <- C0[host] * sum(area*(hab==host))
K_host[host,ts_year] <- sum(K[,host]*(hab==host))
if (strat=="MI" & host>1){
C_host[host, y] <- C_host[host, y] + sum(area*(habitat[,2]==host))
C_host[host, y] <- C_host[host, y] + C0[host] * sum(area*(habitat[,2]==host))
K_host[host,ts_year] <- K_host[host,ts_year] + sum(K[,host]*(habitat[,2]==host))
} ## if strat=="MI"
} ## for host
......@@ -801,8 +801,8 @@ if (graphic) {
title.IR <- "Proportion of diseased hosts"
invlogitbound <- 3
maxColorScale <- 1
# intvls <- maxColorScale * sort(c(0, invlogit(seq(-invlogitbound,invlogitbound,l=nCol-2)), 1), dec=FALSE) ## intervals to define coloration
intvls <- maxColorScale * sort(seq(0, 1, l=nCol), dec=FALSE)
# intvls <- maxColorScale * sort(c(0, invlogit(seq(-invlogitbound,invlogitbound,l=nCol-2)), 1), decreasing=FALSE) ## intervals to define coloration
intvls <- maxColorScale * sort(seq(0, 1, l=nCol), decreasing=FALSE)
# colMap <- heat.colors(nCol, alpha=.3) ## color for each interval (alpha = transparency)
# plot(1:nCol~rep(0,nCol),col=colMap, pch=15, cex=3)
dens.H <- c(0,8,15,12,18)[1:Nhost]
......@@ -865,7 +865,7 @@ if (graphic) {
, lty=c(1:Nhost,LTY.tot), lwd=2, pch=c(PCH,PCH.tot), pt.cex=c(rep(1,Nhost),1), col=c(GRAY, COL.tot), seg.len=2.5)
## Map dynamic of diseased hosts
plotland(landscapeTEST1, COL1[intvlsIR], dens.H[hab], angle.H[hab], COL1, dens.H, angle.H, title.IR, subtitle.H, legend.hab, legend.H, " ")
plotland(trans.landscape_tmp, COL1[intvlsIR], dens.H[hab], angle.H[hab], COL1, dens.H, angle.H, title.IR, subtitle.H, legend.hab, legend.H, " ")
dev.off()
} ## for d
} ## for y
......
......@@ -56,6 +56,6 @@
#' @references Rimbaud L., Papaïx J., Rey J.-F., Barrett L. G. and Thrall P. H. (2018). Assessing the durability and efficiency of landscape-based strategies to deploy plant resistance to pathogens. \emph{PLoS Computational Biology} 14(4):e1006067.
#' @export
model_landsepi <- function(timeP, landscape, dispersal, inits, val_seed, hostP, pathoP, evolP) {
invisible(.Call('_landsepiDev_model_landsepi', PACKAGE = 'landsepiDev', timeP, landscape, dispersal, inits, val_seed, hostP, pathoP, evolP))
invisible(.Call('_landsepi_model_landsepi', PACKAGE = 'landsepi', timeP, landscape, dispersal, inits, val_seed, hostP, pathoP, evolP))
}
......@@ -24,7 +24,7 @@
#' @description Run a demonstration of the package.
#' @param seed an integer used as seed value (for random number generator)
#' @details Run a 30-year 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.
#' high level of spatial aggregation. The generated model outputs are text files, graphics and a video.
#' @include RcppExports.R AgriLand.R graphLand.R multiN.R periodic_cov.R
#' @importFrom utils data
#' @export
......
......@@ -36,8 +36,8 @@
#' @details \tabular{ll}{
#' Package: \tab landsepi\cr
#' Type: \tab Package\cr
#' Version: \tab 0.0.5\cr
#' Date: \tab 2018-11-27\cr
#' Version: \tab 0.0.6\cr
#' Date: \tab 2019-01-09\cr
#' License: \tab GPL (>=2)\cr
#' }
#'
......@@ -111,7 +111,7 @@
#'
#' Rimbaud L., Papaïx J. and Rey J.-F. (2018). landsepi: Landscape Epidemiology and Evolution. \emph{R package}, url: https://cran.r-project.org/package=landsepi.
#' @examples \dontrun{
#' library("landsepiDev")
#' library("landsepi")
#'
#' ## 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)
......@@ -124,7 +124,7 @@
#'
#' ## (see ?simul_landsepi to help parameterise the function and simulate other scenarios)
#' }
#' @useDynLib landsepiDev
#' @useDynLib landsepi
#' @import methods
#' @import graphics
#' @import stats
......
......@@ -24,6 +24,8 @@
#' 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 nYears an integer giving the number of simulated years.
#' @param nTSpY an integer giving the number of time steps per year.
#' @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).
......@@ -32,7 +34,6 @@
#' 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)
......@@ -197,7 +198,8 @@ simul_landsepi <- function(seed=12345, nYears=5, nTSpY=120
pathRES <- getwd()
## Temporal parameters
timeP <- list(nYears=nYears,nTSpY=nTSpY)
strategies <- c("MO", "MI", "RO", "PY")
timeP <- list(nYears=nYears,nTSpY=nTSpY, strat_tmp=match(strat, strategies))
## Landscape and dispersal
dispH <- get("dispH") # Hack for cran check
......@@ -236,11 +238,11 @@ simul_landsepi <- function(seed=12345, nYears=5, nTSpY=120
reproH <- rep(0.0, Nhost)
deathH <- rep(0.0, Nhost)
if (strat=="MI") { ## Adjustment of C0 and Cmax for mixtures
C0[1] = C0[1] * (1-propRR);
C0[2] = C0[2] * propRR;
Cmax[1] = Cmax[1] * (1-propRR);
Cmax[2] = Cmax[2] * propRR;
if (strat=="MI" & Nhost==3) { ## Adjustment of C0 and Cmax for mixtures
C0[2] = C0[2] * (1-propRR);
C0[3] = C0[3] * propRR;
Cmax[2] = Cmax[2] * (1-propRR);
Cmax[3] = Cmax[3] * propRR;
}
resistance0 <- c(0,0,0,0,0,0,0,0)
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for landsepiDev 0.0.5.
# Generated by GNU Autoconf 2.69 for landsepi 0.0.6.
#
# Report bugs to <jean-francois.rey@inra.fr>.
#
......@@ -577,10 +577,10 @@ MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='landsepiDev'
PACKAGE_TARNAME='landsepidev'
PACKAGE_VERSION='0.0.5'
PACKAGE_STRING='landsepiDev 0.0.5'
PACKAGE_NAME='landsepi'
PACKAGE_TARNAME='landsepi'
PACKAGE_VERSION='0.0.6'
PACKAGE_STRING='landsepi 0.0.6'
PACKAGE_BUGREPORT='jean-francois.rey@inra.fr'
PACKAGE_URL=''
......@@ -1198,7 +1198,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures landsepiDev 0.0.5 to adapt to many kinds of systems.
\`configure' configures landsepi 0.0.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1247,7 +1247,7 @@ Fine tuning of the installation directories:
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/landsepidev]
--docdir=DIR documentation root [DATAROOTDIR/doc/landsepi]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
......@@ -1260,7 +1260,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of landsepiDev 0.0.5:";;
short | recursive ) echo "Configuration of landsepi 0.0.6:";;
esac
cat <<\_ACEOF
......@@ -1345,7 +1345,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
landsepiDev configure 0.0.5
landsepi configure 0.0.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1446,7 +1446,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by landsepiDev $as_me 0.0.5, which was
It was created by landsepi $as_me 0.0.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -3159,7 +3159,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by landsepiDev $as_me 0.0.5, which was
This file was extended by landsepi $as_me 0.0.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -3212,7 +3212,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
landsepiDev config.status 0.0.5
landsepi config.status 0.0.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -10,8 +10,8 @@ dnl #################################################################
dnl -----------------------------------------------
dnl Package name and version number (user defined)
dnl -----------------------------------------------
define([THE_PACKAGE_NAME], [landsepiDev])
define([THE_PACKAGE_VERSION], [0.0.5])
define([THE_PACKAGE_NAME], [landsepi])
define([THE_PACKAGE_VERSION], [0.0.6])
define([THE_PACKAGE_MAINTAINER], [jean-francois.rey@inra.fr])
dnl --------------------------------
......
No preview for this file type
......@@ -23,11 +23,11 @@ resistance erosion, adaptation formula).}
\item{ecoP}{a list of economic parameters (yield, purchase price, selling price).}
\item{graphic}{a logical indicating if graphics of the outputs must be generated (1) or not (0).}
\item{graphic}{a logical indicating if graphics of the outputs must be generated (TRUE) or not (FALSE).}
\item{video}{a logical indicating if a video must be generated (TRUE) or not (FALSE). Works only if graphic is TRUE as well.}
\item{video}{a logical indicating if a video must be generated (TRUE) or not (FALSE). Works only if graphic is TRUE as well. Note that ffmpeg is required to generate videos.}
\item{nMapPY}{an integer specifying the number of epidemic maps per year in the video (0 if video is not to be generated).}
\item{nMapPY}{an integer specifying the number of epidemic maps per year in the video (video must be TRUE).}
\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.}
......
......@@ -16,5 +16,5 @@ Run a demonstration of the package.
Run demo landsepi
Run a 30-year 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.
high level of spatial aggregation. The generated model outputs are text files, graphics and a video.
}
......@@ -19,7 +19,7 @@
}
\examples{
library(sp)
library(landsepiDev)
library(landsepi)
landscapeTEST1
plot(landscapeTEST1)
}
......
......@@ -19,7 +19,7 @@
}
\examples{
library(sp)
library(landsepiDev)
library(landsepi)
landscapeTEST2
plot(landscapeTEST2)
}
......
......@@ -19,7 +19,7 @@
}
\examples{
library(sp)
library(landsepiDev)
library(landsepi)
landscapeTEST3
plot(landscapeTEST3)
}
......
......@@ -19,7 +19,7 @@
}
\examples{
library(sp)
library(landsepiDev)
library(landsepi)
landscapeTEST4
plot(landscapeTEST4)
}
......
......@@ -19,7 +19,7 @@
}
\examples{
library(sp)
library(landsepiDev)
library(landsepi)
landscapeTEST5
plot(landscapeTEST5)
}
......
......@@ -17,8 +17,8 @@ architecture to simulate plant response to disease.
\tabular{ll}{
Package: \tab landsepi\cr
Type: \tab Package\cr
Version: \tab 0.0.5\cr
Date: \tab 2018-11-27\cr
Version: \tab 0.0.6\cr
Date: \tab 2019-01-09\cr
License: \tab GPL (>=2)\cr
}
......@@ -85,7 +85,7 @@ In addition, to generate videos the package will need ffmpeg.
}
\examples{
\dontrun{
library("landsepiDev")
library("landsepi")
## 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)
......
......@@ -5,21 +5,23 @@
\title{Simulation with provided data}
\usage{
simul_landsepi(seed = 12345, nYears = 5, nTSpY = 120, idLan = 1,
propSR = 2/3, isolSR = 3, propRR = 1/2, isolRR = 3,
propSR = 2/3, isolSR = 1, propRR = 1/2, isolRR = 1,
strat = "MO", Nhost = 3, pI0 = 5e-04, resistance1 = c(1, 0, 0, 0,
0, 0, 0, 0), resistance2 = c(0, 1, 0, 0, 0, 0, 0, 0),
costInfect = 0.75, costAggr = 0.5, taumut = 1e-07, probSex = 0,
costInfect = 0.75, costAggr = 0.75, taumut = 1e-07, probSex = 0,
MGeff = 1, QReff = 0.5, beta = 1, Naggr = 6, timeToQR_exp = 0,
timeToQR_var = 0, C0 = rep(0.1, Nhost), Cmax = rep(2, Nhost),
yield = cbind(H = rep(1/120, Nhost), L = rep(0, Nhost), I = rep(0,
Nhost), R = rep(0, Nhost)), purchPrice = rep(0.001, Nhost),
sellPrice = rep(0.001, Nhost), graphic = TRUE, video = FALSE)
yield = cbind(H = rep(1/(120 * 1000), Nhost), L = rep(0, Nhost), I =
rep(0, Nhost), R = rep(0, Nhost)), purchPrice = rep(0.001, Nhost),
sellPrice = rep(0.2, Nhost), graphic = TRUE, video = FALSE)
}
\arguments{
\item{seed}{an integer used as seed value (for random number generator).}
\item{nYears}{an integer giving the number of simulated years.}
\item{nTSpY}{an integer giving the number of time steps per year.}
\item{idLan}{an integer giving the index of landscape structure (1 to 5).}
\item{propSR}{proportion of fields where resistance is deployed: (RC)/(SC+RC) or (RC1+RC2)/(SC+RC1+RC2). Must be between 0 and 1.}
......@@ -169,7 +171,7 @@ The GLA and AUDPC of every cultivar as well as the whole landscape are averaged
\examples{
\donttest{
## Default parameterisation (5-year simulation of a mosaic deployment strategy of
## two resistant cultivars in balanced proportions and high level of spatial aggregation)
## two resistant cultivars in balanced proportions and low level of spatial aggregation)
simul_landsepi()
## Mosaic of two major genes
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment