doesGmapCombine: Tests aggregation scheme before coalescent simulation

View source: R/testph.R

doesGmapCombineR Documentation

Tests aggregation scheme before coalescent simulation

Description

Test the gmap aggregation scheme against a landscape to see if cells with genetic samples are being combined

Usage

doesGmapCombine(gmap, landscape)

Arguments

gmap

data frame that maps forward time populations to genetic populations (from make.gmap())

landscape

the landscape object used in the forward simulation

Details

Avoid combining cells with two separate genetic samples during cell aggregation

Value

Returns a logical (TRUE or FALSE) indicating whether the aggregation scheme specified by gmap would combine two cells with genetic samples. Combining genetic samples can result in problems during subsequent coalescent simulations. If FALSE, no issues are expected.

See Also

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) 

gmap=make.gmap(ph$pophist,
               xnum=2, #number of cells to aggregate in x-direction
               ynum=2) #number of aggregate in the y-direction

doesGmapCombine(gmap, landscape)


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