make.input: Create Nemo input file

Description Usage Arguments Value Author(s) References Examples

View source: R/aNEMOne.R

Description

Makes an input file of type .ini for Nemo, an individual-based, forward time simulation program created and maintained by Fred Guillaume.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
make.input(run.mode = "overwrite", random.seed = "12345",
  log.file = "logfile.log", root.dir = NULL, filename = NULL,
  reps = NULL, gens = NULL, num.patches = NULL, patch.capacity = NULL,
  patch.capacity.fem = NULL, patch.capacity.mal = NULL, cap.temp = FALSE,
  LCE.order = NULL, mating.system = NULL, mating.proportion = NULL,
  mean.fec = NULL, self.if.alone = FALSE, always.breed.window = FALSE,
  large.kernels = FALSE, breeding.connectivity.matrix = NULL,
  breeding.kernel = NULL, dispersal.connectivity.matrix = NULL,
  dispersal.kernel = NULL, seln.trait = NULL, seln.model = NULL,
  seln.fitness.model = "absolute", seln.var = NULL, seln.trait.dim = 1,
  seln.local.optima = NULL, quanti.init = NULL, num.quanti.traits = 1,
  num.quanti.loci = NULL, quanti.mut.rate = NULL, quanti.mut.var = NULL,
  quanti.recomb.rate = 0.5, quanti.init.model = 1, quanti.env.var = 1,
  num.ntrl.loci = NULL, num.ntrl.alleles = NULL, ntrl.mut.rate = NULL,
  ntrl.recomb.rate = 0.5, ntrl.mut.model = NULL, ntrl.init.model = NULL,
  save.ntrl = NULL, save.quanti = NULL, save.stats = NULL,
  save.seln.inds = NULL, stats = NULL)

Arguments

run.mode

The mode to run the simulation in; default is "overwrite", for other options see the Nemo manual.

random.seed

Set the random seed for the run, default is 12345.

log.file

Name of the logfile to be output.

root.dir

Root directory to put run outputs.

filename

Base name of the simulation file.

reps

Number of replicates to perform.

gens

Number of generations to run the simulation.

num.patches

Number of patches on the landscape.

patch.capacity

The carrying capacity of each patch, can be specified by an integer value or an array of length num.patches.

patch.capacity.fem

If sex-specific carrying capacity, this is the female carrying capacity per patch.

patch.capacity.mal

If sex-specific carrying capacity, this is the male carrying capacity per patch.

cap.temp

If carrying capacity changes at a given generation, this is the generation at which that occurs.

LCE.order

The order of life cycle events in the simulation. Should be given as multiple character strings, in order.

mating.system

See the nemo manual for details, random mating is specified by a '1'.

mating.proportion

See the nemo manual for details, sets the proportion of non-random mating.

mean.fec

Mean fecundity per mother, may also be set to be patch-specific with an array. By default follows a Poisson distribution, see the Nemo manual for details.

self.if.alone

Boolean, if true, an individual will self if it finds no mate.

always.breed.window

Boolean, if present, the breeding window is always used. Otherwise, the breeding window is only called if no mate can be found in the focal patch.

large.kernels

Set to true if using a dispersal or breeding kernel of large size, default is false. When true, it will not hold the full matrix in R's memory and instead send to the command line to concatenate files.

breeding.connectivity.matrix

The connectivity matrix of patches matched to the breeding kernel.

breeding.kernel

The array of probabilities of searching for a mate within a given patch.

dispersal.connectivity.matrix

The connectivity matrix of patches matched to the dispersal kernel.

dispersal.kernel

The array of dispersal probabilities for forward migration.

seln.trait

The trait(s) specified to be under selection. Either "quant" or "delet" for quantitative or deleterious traits.

seln.model

The model of selection to use. See Nemo manual section 4.7 for all details on selection.

seln.fitness.model

Options are absolute, relative_global, and relative_local. Default is absolute. See Nemo manual section 4.7 for all details on selection.

seln.var

Variance in selection.

seln.trait.dim

See Nemo manual section 4.7 for all details on selection. Default is 1.

seln.local.optima

Optimal trait value per patch or for the entire landscape

quanti.init

The initial QTL value to be set; see Nemo manual section 5.3 for all details on quantitative traits.

num.quanti.traits

How many QTL traits to model, default is 1.

num.quanti.loci

How many loci underly the quantitative trait.

quanti.mut.rate

Mutation rate per QTL.

quanti.mut.var

Variance in mutation rate per QTL.

quanti.recomb.rate

Recombination rate among QTL, default is freely recombining, 0.5.

quanti.init.model

See Nemo manual section 5.3 for all details on quantitative traits. Default is 1.

quanti.env.var

Environmental variance, default is 1.

num.ntrl.loci

The number of neutral loci to simulate. See Nemo manual section 5.2 for all details on neutral markers.

num.ntrl.alleles

The number of alleles per neutral locus.

ntrl.mut.rate

The mutation rate per neutral locus.

ntrl.recomb.rate

The recombination rate among neutral loci.

ntrl.mut.model

The mutation model for neutral loci: 1 = single step, 2 = K allele model. See Nemo manual section 5.2 for all details on neutral markers.

ntrl.init.model

How to initiate the neutral allele frequencies: 0 = no initial variance, 1 = maximum initial variance. See Nemo manual section 5.2 for all details on neutral markers.

save.ntrl

How often to save the neutral marker genotype files. Files are automatically output to subdirectory "ntrl_geno". If not present, no neutral genotype output is saved.

save.quanti

How often to save the quantitative trait genotype files. Files are automatically output to subdirectory "quanti_geno". If not present, no quantitative genotype output is saved.

save.stats

How often to save the values of the parameters defined by "stats". Files are automatically output to subdirectory "stats". *If this paramter is not present, no stats are output, even if "stats" is defined.

save.seln.inds

How often to save the data from "selection_output". Files are automatically output to subdirectory "ind_seln". *If this paramter is not present, no selection data are output.

stats

Population and simlation parameters to return, see Nemo manual section 7 "Output Statistics".

Value

Write the file specified into the working directory.

Author(s)

Kimberly J Gilbert

References

Nemo is created and maintained by Fred Guillaume. The manual and source files are available online.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# population
horiz.patches <- 100
vert.patches <- 20
num.patches <- (horiz.patches*vert.patches) + 2	# plus two for the ghost and absorbing patches
cell.size <- 50
sigma <- 25

land.x <- cell.size*horiz.patches
land.y <- cell.size* vert.patches

cap <- patch.cap(6,1000, 0,2)

# simulation components
life.cycles <- c("breed", "disperse", "selection", "aging")

# mating
breed.kernel <- make.kernel.and.matrix(cell.size= cell.size, horizontal.land= land.x,
 vertical.land= land.y, dist.mean=0, dist.sd= sigma, breed.window=TRUE, two.kernels=FALSE,
 second.dist.mean=0, second.dist.sd=NULL)
breed.file <- "Breeding_ConnMatrix.txt"
breeding.connectivity.matrix <- readChar(breed.file, file.info(breed.file)$size)

# dispersal
disp.kernel <- make.kernel.and.matrix(cell.size= cell.size, horizontal.land= land.x,
 vertical.land= land.y, dist.mean=0, dist.sd= sigma, breed.window=FALSE, two.kernels=FALSE,
 second.dist.mean=0, second.dist.sd=NULL)
disp.file <- "Dispersal_ConnMatrix.txt"
dispersal.connectivity.matrix <- readChar(disp.file, file.info(disp.file)$size)

# landscape
landscape.init.optima <- make.landscape(horizontal.patches= horiz.patches,
 vertical.patches= vert.patches, range=5)
landscape.file <- "Landscape.txt"
landscape <- readChar(landscape.file, file.info(landscape.file)$size)


make.input(
	root.dir="test", filename="test",
	reps=100, gens=1000, num.patches= num.patches, patch.capacity=cap,
	LCE.order= life.cycles,
	mating.system=1, mean.fec=7,
	breeding.connectivity.matrix= breeding.connectivity.matrix,
	breeding.kernel= breed.kernel,
	dispersal.connectivity.matrix= dispersal.connectivity.matrix,
	dispersal.kernel= disp.kernel,
	seln.trait="quanti", seln.model="gaussian", seln.var=7.5, seln.trait.dim=1,	seln.local.optima= landscape,
	quanti.init= landscape.init.optima, num.quanti.loci=100, quanti.mut.rate=0.001, quanti.mut.var=0.01,
	num.ntrl.loci=100, num.ntrl.alleles=2, ntrl.mut.rate=0.001, ntrl.mut.model=1, ntrl.init.model=1,
	save.ntrl=50, save.quanti=10, save.stats=10,
	stats=c("demography", "fecundity", "migrants")
)

kjgilbert/aNEMOne documentation built on May 20, 2019, 10:25 a.m.