Functions to generate SNPs on given samples.
Usage
make_snp(samples, ss)
make_snp_chromosome(genealogy, segsites)
place_mutations(genealogy, segsites, v_sampled = NULL)
Arguments
- samples
A data.frame:
sample_family
or output fromgather_segments()
.- ss
A sequence of
segsites
; its length is the number of chromosome; each element is the number of segsites on a chromosome. If a named vector is given, the output is also named.- genealogy
An output from
make_gene_genealogy()
.- segsites
The number of segregating sites on a segment.
- v_sampled
The sampled vertices. Use this to fix the output order.
Details
make_snp()
generates a list of SNP matrices by calling
make_snp_chromosome()
in parallel.
Use RNGkind("L'Ecuyer-CMRG")
and set.seed()
to get reproducible results.
The number of CPU cores used can be configured via mc.cores
option.
make_snp_chromosome()
simulate a SNP matrix on a chromosome by calling
place_mutations()
and recombination()
.
place_mutations()
generates a SNP matrix by randomly placing a fixed
number of mutations on a given genealogy.
It means that all the sites are perfectly linked with each other.