testPophist: Test pophist object before coalescent simulation

View source: R/testph.R

testPophistR Documentation

Test pophist object before coalescent simulation

Description

Function to take output from getpophist_cells and def_grid and test for cell occupancy

Usage

testPophist(ph, landscape)

Arguments

ph

a pophist object, output by getpophist2.cells()

landscape

the landscape object used in the forward simulation

Details

All cells with population genetic samples must be colonized during the forward simulation. Simulations that do not fully colonize sampled populations are discarded. This function tests three aspects of the lansdcape produced in the forward demographic simulation:

  • All populations with genetic samples are colonized during the forward simulation.

  • Habitat suitability is non-zero at the last simulation time step in all cells with genetic samples.

  • The spatial extent of the simulated landscape matches that of the genetic samples.

Value

Returns a logical (T or F) indicating whether all sampled cells are occupied at the end of the forward simulation.

See Also

ashSetupLandscape, getpophist2.cells, make.gmap, pophist.aggregate, runFSC_step_agg3

Examples

library(holoSimCell)
parms <- drawParms(control = system.file("extdata/ashpaper","Ash_priors.csv",package="holoSimCell"))
load(file=paste0(system.file(package="holoSimCell"),"/extdata/landscapes/",pollenPulls[[1]]$file))
refpops <- pollenPulls[[1]]$refs
avgCellsz <- mean(c(res(landscape$sumrast)))

ph = getpophist2.cells(h = landscape$details$ncells, xdim = landscape$details$x.dim, ydim = landscape$details$y.dim,
                       landscape=landscape,
                       refs=refpops,   
                       refsz=parms$ref_Ne,
                       lambda=parms$lambda,
                       mix=parms$mix,  
                       shortscale=parms$shortscale*avgCellsz,  
                       shortshape=parms$shortshape, 
                       longmean=parms$longmean*avgCellsz,  
                       ysz=res(landscape$sumrast)[2], 
                       xsz=res(landscape$sumrast)[1], 
                       K = parms$Ne) 
testPophist(ph, landscape)


stranda/holoSimCell documentation built on Aug. 4, 2023, 1:12 p.m.