simulCoalescent: Coalescent with recombination

View source: R/quantgen.R

simulCoalescentR Documentation

Coalescent with recombination

Description

Simulate haplotypes according to an approximation to the coalescent with recombination named the Sequential Coalescent with Recombination Model. Requires the scrm package (Staab et al, 2014).

Usage

simulCoalescent(
  nb.inds = 500,
  ind.ids = NULL,
  nb.reps = 10,
  pop.mut.rate = 40,
  pop.recomb.rate = 40,
  chrom.len = 5 * 10^5,
  other = NULL,
  nb.pops = 1,
  mig.rate = 5,
  get.trees = FALSE,
  get.tmrca = FALSE,
  get.alleles = FALSE,
  permute.alleles = TRUE,
  verbose = 1
)

Arguments

nb.inds

diploids (thus nb of haplotypes is 2 * nb.inds)

ind.ids

vector of identifiers (one per genotype)

nb.reps

number of independent loci that will be produced (could be seen as distinct chromosomes)

pop.mut.rate

theta = 4 N0 mu

pop.recomb.rate

rho = 4 N0 r

chrom.len

in bp

other

character vector of length 1 with other parameters to the simulator (e.g. time-specific parameters such as "-G 6.93 -eG 0.2 0.0 -eN 0.3 0.5")

nb.pops

number of populations (kmeans will then be used to pair haplotypes into diploid genotypes)

mig.rate

migration rate = 4 N0 m (will be symmetric)

get.trees

get gene genealogies in the Newick format

get.tmrca

get time to most recent common ancestor and local tree lengths

get.alleles

get fake alleles sampled in A,T,G,C

permute.alleles

if TRUE, the reference alleles are randomly chosen between ancestral and derived alleles

verbose

verbosity level (0/1/2)

Value

list with haplotypes (list), genotypes as allele doses (matrix) and SNP coordinates (data.frame)

Author(s)

Timothee Flutre

See Also

segSites2snpCoords, permuteAllelesInHaplosNum, segSites2allDoses, simulRefAltSnpAlleles, makeCrosses

Examples

## Not run: ## simulate haplotypes and genotypes in a single population
nb.genos <- 200
Ne <- 10^4
chrom.len <- 10^5
mu <- 10^(-8)
c <- 10^(-8)
genomes <- simulCoalescent(nb.inds=nb.genos,
                           pop.mut.rate=4 * Ne * mu * chrom.len,
                           pop.recomb.rate=4 * Ne * c * chrom.len,
                           chrom.len=chrom.len)

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 12, 2025, 11:35 p.m.