Title: | MAle Lineage ANalysis |
---|---|
Description: | MAle Lineage ANalysis by simulating genealogies backwards and imposing short tandem repeats (STR) mutations forwards. Intended for forensic Y chromosomal STR (Y-STR) haplotype analyses. Numerous analyses are possible, e.g. number of matches and meiotic distance to matches. Refer to papers mentioned in citation("malan") (DOI's: <doi:10.1371/journal.pgen.1007028>, <doi:10.21105/joss.00684> and <doi:10.1016/j.fsigen.2018.10.004>). |
Authors: | Mikkel Meyer Andersen [aut, cre] |
Maintainer: | Mikkel Meyer Andersen <[email protected]> |
License: | GPL-2 | file LICENSE |
Version: | 1.0.3 |
Built: | 2024-11-23 06:53:55 UTC |
Source: | CRAN |
Simulating genealogies backwards and imposing STR mutations forwards.
See vignettes and manual for documentation.
Disclaimer: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Maintainer: Mikkel Meyer Andersen [email protected]
Andersen MM, Balding DJ (2017) How convincing is a matching Y-chromosome profile? PLoS Genet 13(11): e1007028. doi:10.1371/journal.pgen.1007028.
Useful links:
Report bugs at https://github.com/mikldk/malan/issues
Get pedigree from malan_pedigreelist
generated by
build_pedigrees()
.
## S3 method for class 'malan_pedigreelist' x[[...]]
## S3 method for class 'malan_pedigreelist' x[[...]]
x |
Element id |
... |
ignored |
Pedigree
Get individual from population by pid
## S3 method for class 'malan_population' x[[...]]
## S3 method for class 'malan_population' x[[...]]
x |
pid |
... |
ignored |
Individual
Calculate LR-like quantities by haplotype counts.
analyse_mixture_result( mix_res, unique_haps_in_mixture, unique_haps_in_mixture_counts )
analyse_mixture_result( mix_res, unique_haps_in_mixture, unique_haps_in_mixture_counts )
mix_res |
Mixture result from |
unique_haps_in_mixture |
Included unique haplotypes to use as elements in contributor sets. |
unique_haps_in_mixture_counts |
Population counts of the included haplotypes |
NOTE: Only takes up to 9 contributors!
A list with numeric quantities
Refer to analyse_mixture_result()
for details.
Essentially, analyse_mixture_result()
is run on each element of mixture_results
.
analyse_mixture_results( mixture_results, unique_haps_in_mixture_list, unique_haps_in_mixture_counts_list )
analyse_mixture_results( mixture_results, unique_haps_in_mixture_list, unique_haps_in_mixture_counts_list )
mixture_results |
List of |
unique_haps_in_mixture_list |
List of |
unique_haps_in_mixture_counts_list |
List of |
NOTE: Only takes up to 9 contributors!
A list with lists of numeric quantities
Get tidy graph object tbl_graph()
, e.g.
to plot with ggraph()
.
## S3 method for class 'malan_pedigreelist' as_tbl_graph(x, ...)
## S3 method for class 'malan_pedigreelist' as_tbl_graph(x, ...)
x |
|
... |
Ignored |
tbl_graph()
object
Get individual's number of brothers that matches individual
's haplotype
brothers_matching(individual)
brothers_matching(individual)
individual |
individual |
Number of brothers that matches individual
's haplotype
Makes it possible to find all individuals' pid with a certain haplotype.
Must be used with e.g. get_matching_pids_from_hashmap()
.
build_haplotype_hashmap(individuals, progress = TRUE)
build_haplotype_hashmap(individuals, progress = TRUE)
individuals |
List of individuals to build hashmap of |
progress |
Show progress? |
External pointer to hashmap with haplotype as keys and vector of individuals' pid as value
get_matching_pids_from_hashmap()
.
In a newly simulated population, each individual only knows its father and children. Using this information, this function builds pedigrees. This makes it easier to e.g. population haplotypes, find path between two individuals (if they are not in the same pedigree, they are not connected).
build_pedigrees(population, progress = TRUE)
build_pedigrees(population, progress = TRUE)
population |
Population generated by |
progress |
Show progress. |
An object with class malan_pedigreelist
(an internal list of external pointers to pedigrees).
sample_geneology()
and sample_geneology_varying_size()
for simulating populations.
sim <- sample_geneology(100, 10) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
sim <- sample_geneology(100, 10) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
Calculate conditional genotype cumulative probabilities with theta
calc_autosomal_genotype_conditional_cumdist(allele_dist, theta)
calc_autosomal_genotype_conditional_cumdist(allele_dist, theta)
allele_dist |
Allele distribution (probabilities) – gets normalised |
theta |
Theta correction between 0 and 1 (both included) |
Matrix: row i: conditional cumulative distribution of alleles given allele i
Calculate genotype probabilities with theta
calc_autosomal_genotype_probs(allele_dist, theta)
calc_autosomal_genotype_probs(allele_dist, theta)
allele_dist |
Allele distribution (probabilities) – gets normalised |
theta |
Theta correction between 0 and 1 (both included) |
Construct M matrix
construct_M(meioses, mu_dw, mu_up)
construct_M(meioses, mu_dw, mu_up)
meioses |
number of meioses separating the two individuals |
mu_dw |
mutation rate for 1-step down-mutation |
mu_up |
mutation rate for 1-step up-mutation |
Get individual's number of brothers
count_brothers(individual)
count_brothers(individual)
individual |
individual |
Number of brothers
Counts the number of types close to haplotype
in individuals
.
count_haplotype_near_matches_individuals(individuals, haplotype, max_dist)
count_haplotype_near_matches_individuals(individuals, haplotype, max_dist)
individuals |
List of individuals to count occurrences in. |
haplotype |
Haplotype to count near-matches occurrences of. |
max_dist |
Maximum distance (0 = match, 1 = 1 STR allele difference, ...) |
Number of times that a haplotype within a radius of max_dist
of
haplotype
occurred amongst individuals
.
count_haplotype_occurrences_individuals()
,
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists()
.
Counts the number of types haplotype
appears in individuals
.
count_haplotype_occurrences_individuals(individuals, haplotype)
count_haplotype_occurrences_individuals(individuals, haplotype)
individuals |
List of individuals to count occurrences in. |
haplotype |
Haplotype to count occurrences of. |
Number of times that haplotype
occurred amongst individuals
.
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists()
,
count_haplotype_near_matches_individuals()
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(0, 0)) count_haplotype_occurrences_individuals(sim$end_generation_individuals, c(0, 0))
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(0, 0)) count_haplotype_occurrences_individuals(sim$end_generation_individuals, c(0, 0))
Counts the number of types haplotype
appears in pedigree
.
count_haplotype_occurrences_pedigree( pedigree, haplotype, generation_upper_bound_in_result = -1L )
count_haplotype_occurrences_pedigree( pedigree, haplotype, generation_upper_bound_in_result = -1L )
pedigree |
Pedigree to count occurrences in. |
haplotype |
Haplotype to count occurrences of. |
generation_upper_bound_in_result |
Only consider matches in generation 0, 1, ... generation_upper_bound_in_result. -1 means disabled, consider all generations. End generation is generation 0. Second last generation is 1. And so on. |
Number of times that haplotype
occurred in pedigree
.
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists()
.
Get individual's number of uncles
count_uncles(individual)
count_uncles(individual)
individual |
individual |
Number of uncles
Delete hashmap made by build_haplotype_hashmap()
.
delete_haplotypeids_hashmap(hashmap)
delete_haplotypeids_hashmap(hashmap)
hashmap |
Hashmap made by |
get_matching_pids_from_hashmap()
and build_haplotype_hashmap()
.
Estimate autosomal theta for one subpopulation given a sample of genotypes.
estimate_autotheta_1subpop_genotypes(genotypes, return_estimation_info = FALSE)
estimate_autotheta_1subpop_genotypes(genotypes, return_estimation_info = FALSE)
genotypes |
Matrix of genotypes: two columns (allele1 and allele2) and a row per individual |
return_estimation_info |
Whether to return the quantities used to estimate |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
List:
theta
estimate
: Vector of length 1 containing estimate of theta or NA if it could not be estimated
error
: true if an error happened, false otherwise
details
: contains description if an error happened
estimation_info
: If return_estimation_info = true
: a list with information used to estimate theta
. Else NULL
.
Estimate autosomal theta for one subpopulation given a list of individuals.
estimate_autotheta_1subpop_individuals( individuals, return_estimation_info = FALSE )
estimate_autotheta_1subpop_individuals( individuals, return_estimation_info = FALSE )
individuals |
Individuals to get haplotypes for. |
return_estimation_info |
Whether to return the quantities used to estimate |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
List:
theta
estimate
: Vector of length 1 containing estimate of theta or NA if it could not be estimated
error
: true if an error happened, false otherwise
details
: contains description if an error happened
estimation_info
: If return_estimation_info = true
: a list with information used to estimate theta
. Else NULL
.
Estimates autosomal F, theta, and f for a number of subpopulations given a list of genotypes.
estimate_autotheta_subpops_genotypes(subpops, subpops_sizes)
estimate_autotheta_subpops_genotypes(subpops, subpops_sizes)
subpops |
List of subpopulations, each a list of individuals |
subpops_sizes |
Size of each subpopulation |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
Based on Bruce S Weir, Genetic Data Analysis 2, 1996. (GDA2).
Estimates of autosomal F, theta, and f as well as additional information
Estimates autosomal F, theta, and f for a number of subpopulations given a list of individuals.
estimate_autotheta_subpops_individuals(subpops, subpops_sizes)
estimate_autotheta_subpops_individuals(subpops, subpops_sizes)
subpops |
List of subpopulations, each a list of individuals |
subpops_sizes |
Size of each subpopulation |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
Based on Bruce S Weir, Genetic Data Analysis 2, 1996. (GDA2).
Estimates of autosomal F, theta, and f as well as additional information
Estimates autosomal F, theta, and f for a number of subpopulations given a list of pids (individual ids).
estimate_autotheta_subpops_pids(population, subpops, subpops_sizes)
estimate_autotheta_subpops_pids(population, subpops, subpops_sizes)
population |
Population obtain from simulation |
subpops |
List of individual pids |
subpops_sizes |
Size of each subpopulation |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
Based on Bruce S Weir, Genetic Data Analysis 2, 1996. (GDA2).
Estimates of autosomal F, theta, and f as well as additional information
Estimates unweighted autosomal theta for a number of subpopulations given a list of subpopulations of genotypes.
estimate_autotheta_subpops_unweighted_genotypes(subpops, assume_HWE)
estimate_autotheta_subpops_unweighted_genotypes(subpops, assume_HWE)
subpops |
List of individual genotypes |
assume_HWE |
if the alleles themselves are used instead of genotypes |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
Based on Weir and Goudet, Genetics 2017: http://www.genetics.org/content/early/2017/05/26/genetics.116.198424
Estimate of autosomal theta
Estimates unweighted autosomal theta for a number of subpopulations given a list of pids (individual ids).
estimate_autotheta_subpops_unweighted_pids(population, subpops, assume_HWE)
estimate_autotheta_subpops_unweighted_pids(population, subpops, assume_HWE)
population |
Population obtain from simulation |
subpops |
List of individual pids |
assume_HWE |
if the alleles themselves are used instead of genotypes |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
Based on Weir and Goudet, Genetics 2017: http://www.genetics.org/content/early/2017/05/26/genetics.116.198424
Estimate of autosomal theta
Does the father have the same profile as individual
?
father_matches(individual)
father_matches(individual)
individual |
individual |
Whether father has the same profile as individual
or not
Convert igraph to population
from_igraph(x, ...)
from_igraph(x, ...)
x |
igraph, must be a forest of directed trees with unique positive integer names (as they will be pid's) |
... |
Ignored |
A population
g <- igraph::graph_from_literal( 2 +- 1 -+ 3, 4 -+ 5 ) plot(g) pop <- from_igraph(g) peds <- build_pedigrees(pop, progress = FALSE) plot(peds) infer_generations(peds) get_generation(get_individual(pop, 1)) get_generation(get_individual(pop, 2)) get_generation(get_individual(pop, 3)) get_generation(get_individual(pop, 4)) get_generation(get_individual(pop, 5))
g <- igraph::graph_from_literal( 2 +- 1 -+ 3, 4 -+ 5 ) plot(g) pop <- from_igraph(g) peds <- build_pedigrees(pop, progress = FALSE) plot(peds) infer_generations(peds) get_generation(get_individual(pop, 1)) get_generation(get_individual(pop, 2)) get_generation(get_individual(pop, 3)) get_generation(get_individual(pop, 4)) get_generation(get_individual(pop, 5))
Generate paternal brothers population
from_igraph_rcpp(vertices, edges)
from_igraph_rcpp(vertices, edges)
vertices |
vector of vertices |
edges |
matrix with edges |
An external pointer to the population.
Generate a function to simulate pedigree founder haplotype based on a haplotype databasep
generate_get_founder_haplotype_db(db)
generate_get_founder_haplotype_db(db)
db |
data frame or matrix with haplotypes from which the founder is randomly simulated |
Generate a function to simulate pedigree founder haplotype based on ladder information
generate_get_founder_haplotype_ladder(ladder_min, ladder_max)
generate_get_founder_haplotype_ladder(ladder_min, ladder_max)
ladder_min |
vector of minimum alleles; |
ladder_max |
vector of minimum alleles; |
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
get_allele_counts_genotypes(subpops)
get_allele_counts_genotypes(subpops)
subpops |
List of individual genotypes |
Matrix with allele counts
Assumes that pedigrees_all_populate_autosomal()
was used first to populate autosomal genotypes.
get_allele_counts_pids(population, subpops)
get_allele_counts_pids(population, subpops)
population |
Population obtain from simulation |
subpops |
List of individual pids |
Matrix with allele counts
Get individual's brothers
get_brothers(individual)
get_brothers(individual)
individual |
individual |
List with brothers
get_father()
, get_uncles()
, get_children()
, get_cousins()
Get individual's children
get_children(individual)
get_children(individual)
individual |
individual |
List with children
get_father()
, get_brothers()
, get_uncles()
, get_cousins()
Get individual's cousins
get_cousins(individual)
get_cousins(individual)
individual |
individual |
List with cousins
get_brothers()
, get_uncles()
, get_children()
Get individual's family information
get_family_info(individual)
get_family_info(individual)
individual |
individual |
List with family information
Get individual's father
get_father(individual)
get_father(individual)
individual |
individual |
Father
get_brothers()
, get_uncles()
, get_children()
, get_cousins()
Note that generation 0 is final, end generation. 1 is second last generation etc.
get_generation(individual)
get_generation(individual)
individual |
Individual |
generation
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_generation(indv)
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_generation(indv)
Requires that haplotypes are first populated, e.g.
with pedigrees_all_populate_haplotypes()
,
pedigrees_all_populate_haplotypes_custom_founders()
, or
pedigrees_all_populate_haplotypes_ladder_bounded()
.
get_haplotype(individual)
get_haplotype(individual)
individual |
Individual to get haplotypes for. |
Haplotype for individual
.
get_haplotypes_individuals()
and get_haplotypes_pids()
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotype(sim$end_generation_individuals[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotype(sim$end_generation_individuals[[1]])
Get haplotypes in pedigree
get_haplotypes_in_pedigree(ped)
get_haplotypes_in_pedigree(ped)
ped |
Pedigree |
List with haplotypes
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotypes_in_pedigree(peds[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotypes_in_pedigree(peds[[1]])
Requires that haplotypes are first populated, e.g.
with pedigrees_all_populate_haplotypes()
,
pedigrees_all_populate_haplotypes_custom_founders()
, or
pedigrees_all_populate_haplotypes_ladder_bounded()
.
get_haplotypes_individuals(individuals)
get_haplotypes_individuals(individuals)
individuals |
Individuals to get haplotypes for. |
Matrix of haplotypes where row i
is the haplotype of individuals[[i]]
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotypes_individuals(sim$end_generation_individuals)
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotypes_individuals(sim$end_generation_individuals)
Requires that haplotypes are first populated, e.g.
with pedigrees_all_populate_haplotypes()
,
pedigrees_all_populate_haplotypes_custom_founders()
, or
pedigrees_all_populate_haplotypes_ladder_bounded()
.
get_haplotypes_pids(population, pids)
get_haplotypes_pids(population, pids)
population |
Population |
pids |
Vector of pids to get haplotypes for. |
Matrix of haplotypes where row i
is the haplotype of individuals[[i]]
.
Get individual by pid
get_individual(population, pid)
get_individual(population, pid)
population |
Population |
pid |
pid |
Individual
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_pid(indv)
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_pid(indv)
Get all individuals in population
get_individuals(population)
get_individuals(population)
population |
Population |
By using hashmap made by build_haplotype_hashmap()
,
it is easy to get all individuals with a certain haplotype id.
get_matching_pids_from_hashmap(hashmap, haplotype)
get_matching_pids_from_hashmap(hashmap, haplotype)
hashmap |
Hashmap to make lookup in, made by |
haplotype |
to get individuals that has this haplotype id |
List of individuals with a given haplotype id
Get nodes and edges in malan_pedigreelist
.
For example to plot via as_tbl_graph()
.
get_nodes_edges(x, ...)
get_nodes_edges(x, ...)
x |
|
... |
Ignored |
List with entries nodes
and edges
Get pedigree information as graph (mainly intended for plotting)
get_pedigree_as_graph(ped)
get_pedigree_as_graph(ped)
ped |
Pedigree |
Get pedigree from individual
get_pedigree_from_individual(individual)
get_pedigree_from_individual(individual)
individual |
Individual |
pedigree
Get pedigree id
get_pedigree_id(ped)
get_pedigree_id(ped)
ped |
Pedigree |
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) get_pedigree_id(peds[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) get_pedigree_id(peds[[1]])
Get pedigree ids from pids
get_pedigree_id_from_pid(population, pids)
get_pedigree_id_from_pid(population, pids)
population |
Population |
pids |
Pids |
Vector with pedigree ids
Get pedigrees information in tidy format
get_pedigrees_tidy(pedigrees)
get_pedigrees_tidy(pedigrees)
pedigrees |
Pedigrees |
Get pid from individual
get_pid(individual)
get_pid(individual)
individual |
Individual to get pid of |
pid
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_pid(indv)
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_pid(indv)
Get pids in pedigree
get_pids_in_pedigree(ped)
get_pids_in_pedigree(ped)
ped |
Pedigree |
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) get_pids_in_pedigree(peds[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) get_pids_in_pedigree(peds[[1]])
Get individual's uncles
get_uncles(individual)
get_uncles(individual)
individual |
individual |
List with uncles
get_brothers()
, get_children()
, get_cousins()
Generate a function to generate the zero haplotype
get_zero_haplotype_generator(loci)
get_zero_haplotype_generator(loci)
loci |
Number of loci |
Does the frandfather have the same profile as individual
?
grandfather_matches(individual)
grandfather_matches(individual)
individual |
individual |
Whether grandfather has the same profile as individual
or not
Get the indvididuals that matches haplotype
in individuals
.
haplotype_matches_individuals(individuals, haplotype)
haplotype_matches_individuals(individuals, haplotype)
individuals |
List of individuals to count occurrences in. |
haplotype |
Haplotype to count occurrences of. |
List of individuals that matches haplotype
amongst individuals
.
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists()
.
Get the indvididuals that partially matches haplotype
in individuals
.
haplotype_partially_matches_individuals( individuals, haplotype, ignore_loci = as.integer(c()) )
haplotype_partially_matches_individuals( individuals, haplotype, ignore_loci = as.integer(c()) )
individuals |
List of individuals to count occurrences in. |
haplotype |
Haplotype to count occurrences of. |
ignore_loci |
Vector of loci to ignore (1 = ignore first locus etc.) |
List of individuals that partially matches haplotype
amongst individuals
.
Individuals with the same haplotype will have the same hash (integer) and individuals with different haplotypes will have different hashes (integers).
haplotypes_to_hashes(population, pids)
haplotypes_to_hashes(population, pids)
population |
Population obtained from simulation |
pids |
Vector of individual pids |
This can be useful if for example using haplotypes to define groups and the haplotype itself is not of interest.
Integer vector with haplotype hashes
Takes as input final generation, then moves up in pedigree and increments generation number.
infer_generation(final_generation)
infer_generation(final_generation)
final_generation |
Individuals in final generation |
Note: Only works when all final generation individuals are provided.
Infer generation numbers from pedigrees
infer_generations(peds)
infer_generations(peds)
peds |
Pedigrees infered by |
Nothing
Note that individuals loaded this way does not have information about generation.
load_haplotypes(population, pid, haplotypes, progress = TRUE)
load_haplotypes(population, pid, haplotypes, progress = TRUE)
population |
of individuals |
pid |
ID of male |
haplotypes |
|
progress |
Show progress. |
Note that individuals loaded this way does not have information about generation.
load_individuals(pid, pid_dad, progress = TRUE, error_on_pid_not_found = TRUE)
load_individuals(pid, pid_dad, progress = TRUE, error_on_pid_not_found = TRUE)
pid |
ID of male |
pid_dad |
ID of male's father, 0 if not known |
progress |
Show progress. |
error_on_pid_not_found |
Error if pid not found |
Get the distribution of number of meioses from individual
to all individuals in individual
's pedigree.
Note the generation_upper_bound_in_result
parameter.
meioses_generation_distribution( individual, generation_upper_bound_in_result = -1L )
meioses_generation_distribution( individual, generation_upper_bound_in_result = -1L )
individual |
Individual to calculate all meiotic distances from |
generation_upper_bound_in_result |
Limit on distribution; -1 means no limit. 0 is the final generation. 1 second last generation etc. |
Get the number of meioses between two individuals.
Note, that pedigrees must first have been inferred by build_pedigrees()
.
meiotic_dist(ind1, ind2)
meiotic_dist(ind1, ind2)
ind1 |
Individual 1 |
ind2 |
Individual 2 |
Number of meioses between ind1
and ind2
if they are in the same pedigree, else -1.
Get the number of meioses between two individuals.
Note, that pedigrees must first have been inferred by build_pedigrees()
.
meiotic_dist_threshold(ind1, ind2, threshold)
meiotic_dist_threshold(ind1, ind2, threshold)
ind1 |
Individual 1 |
ind2 |
Individual 2 |
threshold |
Max search radius, if exceeding, return -1 |
Number of meioses between ind1
and ind2
if they are in the same pedigree, else -1.
Get all individual IDs within a meiotic radius
Note, that pedigrees must first have been inferred by build_pedigrees()
.
meiotic_radius(ind, radius)
meiotic_radius(ind, radius)
ind |
Individual |
radius |
Max radius |
Matrix with ID and meiotic radius
Mixture information about 2 persons' mixture of donor1 and donor2.
mixture_info_by_individuals_2pers( individuals, donor1, donor2, include_genealogy_info = TRUE )
mixture_info_by_individuals_2pers( individuals, donor1, donor2, include_genealogy_info = TRUE )
individuals |
Individuals to consider as possible contributors and thereby get information from. |
donor1 |
Contributor1/donor 1 |
donor2 |
Contributor2/donor 2 |
include_genealogy_info |
Include information about meiotic distances and family info |
A list with mixture information about the mixture donor1
+donor2
+donor3
from individuals
mixture_info_by_individuals_3pers
,
mixture_info_by_individuals_4pers
,
mixture_info_by_individuals_5pers
Mixture information about 3 persons' mixture of donor1, donor2 and donor3.
mixture_info_by_individuals_3pers(individuals, donor1, donor2, donor3)
mixture_info_by_individuals_3pers(individuals, donor1, donor2, donor3)
individuals |
Individuals to consider as possible contributors and thereby get information from. |
donor1 |
Contributor1/donor 1 |
donor2 |
Contributor2/donor 2 |
donor3 |
Contributor3/donor 3 |
A list with mixture information about the mixture donor1
+donor2
+donor3
from individuals
mixture_info_by_individuals_2pers
,
mixture_info_by_individuals_4pers
,
mixture_info_by_individuals_5pers
Mixture information about 4 persons' mixture of donor1, donor2, donor3 and donor4.
mixture_info_by_individuals_4pers(individuals, donor1, donor2, donor3, donor4)
mixture_info_by_individuals_4pers(individuals, donor1, donor2, donor3, donor4)
individuals |
Individuals to consider as possible contributors and thereby get information from. |
donor1 |
Contributor1/donor 1 |
donor2 |
Contributor2/donor 2 |
donor3 |
Contributor3/donor 3 |
donor4 |
Contributor4/donor 4 |
A list with mixture information about the mixture donor1
+donor2
+donor3
from individuals
mixture_info_by_individuals_2pers
,
mixture_info_by_individuals_3pers
,
mixture_info_by_individuals_5pers
Mixture information about 5 persons' mixture of donor1, donor2, donor3, donor4 and donor5.
mixture_info_by_individuals_5pers( individuals, donor1, donor2, donor3, donor4, donor5 )
mixture_info_by_individuals_5pers( individuals, donor1, donor2, donor3, donor4, donor5 )
individuals |
Individuals to consider as possible contributors and thereby get information from. |
donor1 |
Contributor1/donor 1 |
donor2 |
Contributor2/donor 2 |
donor3 |
Contributor3/donor 3 |
donor4 |
Contributor4/donor 4 |
donor5 |
Contributor5/donor 5 |
A list with mixture information about the mixture donor1
+donor2
+donor3
from individuals
mixture_info_by_individuals_2pers
,
mixture_info_by_individuals_3pers
,
mixture_info_by_individuals_4pers
Convert pedigree to igraph
pedigree_as_igraph(x, ...)
pedigree_as_igraph(x, ...)
x |
Pedigree |
... |
ignored |
igraph
object
Gives information about all individuals in pedigree that matches an individual.
Just as count_haplotype_occurrences_individuals()
counts the number of
occurrences amongst a list of individuals,
this gives detailed information about matching individuals in the pedigree,
e.g. meiotic distances and maximum L1 distance on the path as some of these
matches may have (back)mutations between in between them (but often this will be 0).
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists( suspect, generation_upper_bound_in_result = -1L, error_on_no_haplotype = TRUE )
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists( suspect, generation_upper_bound_in_result = -1L, error_on_no_haplotype = TRUE )
suspect |
Individual that others must match the profile of. |
generation_upper_bound_in_result |
Only consider matches in generation 0, 1, ... generation_upper_bound_in_result. -1 means disabled, consider all generations. End generation is generation 0. Second last generation is 1. And so on. |
error_on_no_haplotype |
raise error or silently ignore individuals with no haplotype |
Matrix with information about matching individuals.
Columns in order: meioses (meiotic distance to suspect
),
max_L1 (on the path between the matching individual and suspect
,
what is the maximum L1 distance between the suspect
's profile and the
profiles of the individuals on the path),
pid (pid of matching individual)
count_haplotype_occurrences_individuals()
.
Gives information about all individuals in pedigree that almost matches
an individual.
Just as count_haplotype_near_matches_individuals()
counts the number of
occurrences amongst a list of individuals,
this gives detailed information about almost matching individuals in
the pedigree: for now, the meiotic distances.
pedigree_haplotype_near_matches_meiosis( suspect, max_dist, generation_upper_bound_in_result = -1L )
pedigree_haplotype_near_matches_meiosis( suspect, max_dist, generation_upper_bound_in_result = -1L )
suspect |
Individual that others must match the profile of. |
max_dist |
Maximum distance (0 = match, 1 = 1 STR allele difference, ...) |
generation_upper_bound_in_result |
Only consider matches in generation 0, 1, ... generation_upper_bound_in_result. -1 means disabled, consider all generations. End generation is generation 0. Second last generation is 1. And so on. |
Matrix with information about matching individuals.
Columns in order: 1) meioses (meiotic distance to suspect
),
2) haplotype distance, 3) pid (pid of matching individual)
count_haplotype_near_matches_individuals()
.
Get pedigree size
pedigree_size(ped)
pedigree_size(ped)
ped |
Pedigree |
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigree_size(peds[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigree_size(peds[[1]])
Get the size of the pedigree.
Note the generation_upper_bound_in_result
parameter.
pedigree_size_generation(pedigree, generation_upper_bound_in_result = -1L)
pedigree_size_generation(pedigree, generation_upper_bound_in_result = -1L)
pedigree |
Pedigree to get size of |
generation_upper_bound_in_result |
Limit on generation to include in count; -1 means no limit. 0 only include the final generation. 1 only second last generation etc. |
Populate 1-locus autosomal DNA profile from founder and down in all pedigrees. Note, that only alleles from ladder is assigned and that all founders draw type randomly.
pedigrees_all_populate_autosomal( pedigrees, allele_dist, theta, mutation_rate, progress = TRUE )
pedigrees_all_populate_autosomal( pedigrees, allele_dist, theta, mutation_rate, progress = TRUE )
pedigrees |
Pedigree list in which to populate genotypes |
allele_dist |
Allele distribution (probabilities) – gets normalised |
theta |
Theta correction between 0 and 1 (both included) |
mutation_rate |
Mutation rate between 0 and 1 (both included) |
progress |
Show progress |
Note, that pedigrees must first have been inferred by build_pedigrees()
.
pedigrees_all_populate_haplotypes_custom_founders()
and
pedigrees_all_populate_haplotypes_ladder_bounded()
.
Populate haplotypes from founder and down in all pedigrees.
Note, that haplotypes are unbounded and
that all founders get haplotype rep(0L, loci)
.
pedigrees_all_populate_haplotypes( pedigrees, loci, mutation_rates, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees_all_populate_haplotypes( pedigrees, loci, mutation_rates, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees |
Pedigree list in which to populate haplotypes |
loci |
Number of loci |
mutation_rates |
Vector with mutation rates, length |
prob_two_step |
Given a mutation happens, this is the probability that the mutation is a two-step mutation |
prob_genealogical_error |
Probability that a genealogical error happens: if so, give individual haplotype |
progress |
Show progress |
Note, that pedigrees must first have been inferred by build_pedigrees()
.
pedigrees_all_populate_haplotypes_custom_founders()
and
pedigrees_all_populate_haplotypes_ladder_bounded()
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotype(sim$end_generation_individuals[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes(peds, 2, c(1, 1)) get_haplotype(sim$end_generation_individuals[[1]])
Populate haplotypes from founder and down in all pedigrees.
Note, that haplotypes are unbounded.
All founders get a haplotype from calling the user
provided function get_founder_haplotype()
.
pedigrees_all_populate_haplotypes_custom_founders( pedigrees, mutation_rates, get_founder_haplotype = NULL, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees_all_populate_haplotypes_custom_founders( pedigrees, mutation_rates, get_founder_haplotype = NULL, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees |
Pedigree list in which to populate haplotypes |
mutation_rates |
Vector with mutation rates |
get_founder_haplotype |
Function taking no arguments returning a haplotype of |
prob_two_step |
Given a mutation happens, this is the probability that the mutation is a two-step mutation |
prob_genealogical_error |
Probability that a genealogical error happens: if so, give individual haplotype |
progress |
Show progress |
Note, that pedigrees must first have been inferred by build_pedigrees()
.
pedigrees_all_populate_haplotypes()
and
pedigrees_all_populate_haplotypes_ladder_bounded()
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes_custom_founders( peds, c(1, 1), function(x) c(10, 10)) get_haplotype(sim$end_generation_individuals[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes_custom_founders( peds, c(1, 1), function(x) c(10, 10)) get_haplotype(sim$end_generation_individuals[[1]])
Populate haplotypes from founder and down in all pedigrees.
Note, that haplotypes are bounded by ladder_min
and ladder_max
.
All founders get a haplotype from calling the user
provided function get_founder_haplotype()
.
pedigrees_all_populate_haplotypes_ladder_bounded( pedigrees, mutation_rates, ladder_min, ladder_max, get_founder_haplotype = NULL, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees_all_populate_haplotypes_ladder_bounded( pedigrees, mutation_rates, ladder_min, ladder_max, get_founder_haplotype = NULL, prob_two_step = 0, prob_genealogical_error = 0, progress = TRUE )
pedigrees |
Pedigree list in which to populate haplotypes |
mutation_rates |
Vector with mutation rates |
ladder_min |
Lower bounds for haplotypes, same length as |
ladder_max |
Upper bounds for haplotypes, same length as |
get_founder_haplotype |
Function taking no arguments returning a haplotype of |
prob_two_step |
Given a mutation happens, this is the probability that the mutation is a two-step mutation; refer to details for information about behaviour around ladder boundaries |
prob_genealogical_error |
Probability that a genealogical error happens: if so, give individual haplotype |
progress |
Show progress |
Given that a two step mutation should happen (probability specified by prob_two_step
):
With distances >= 2 to ladder bounds, mutations happen as usual.
At distance = 0 or 1 to a ladder bound, the mutation is forced to move away from the boundary.
Note, that pedigrees must first have been inferred by build_pedigrees()
.
pedigrees_all_populate_haplotypes()
and
pedigrees_all_populate_haplotypes_custom_founders()
.
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes_ladder_bounded( peds, c(1, 1), c(0L, 0L), c(10L, 10L), function(x) c(10, 10)) get_haplotype(sim$end_generation_individuals[[1]])
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_all_populate_haplotypes_ladder_bounded( peds, c(1, 1), c(0L, 0L), c(10L, 10L), function(x) c(10, 10)) get_haplotype(sim$end_generation_individuals[[1]])
Get number of pedigrees
pedigrees_count(pedigrees)
pedigrees_count(pedigrees)
pedigrees |
Pedigrees |
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_count(peds)
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_count(peds)
Get distribution of pedigree sizes
pedigrees_table(pedigrees)
pedigrees_table(pedigrees)
pedigrees |
Pedigrees |
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_table(peds)
sim <- sample_geneology(100, 10) peds <- build_pedigrees(sim$population) pedigrees_table(peds)
Plot malan_pedigree
.
## S3 method for class 'malan_pedigree' plot( x, ids = TRUE, haplotypes = FALSE, locus_sep = " ", mark_pids = NULL, label_color = "black", node_color = "lightgray", mark_color = "orange", ... )
## S3 method for class 'malan_pedigree' plot( x, ids = TRUE, haplotypes = FALSE, locus_sep = " ", mark_pids = NULL, label_color = "black", node_color = "lightgray", mark_color = "orange", ... )
x |
Pedigree |
ids |
Show pids |
haplotypes |
Show haplotypes |
locus_sep |
Locus separator in haplotypes |
mark_pids |
Vector of pids to highlight |
label_color |
Label color |
node_color |
Node color |
mark_color |
Highlight color |
... |
Passed to |
Plot malan_pedigreelist
generated by
build_pedigrees()
.
## S3 method for class 'malan_pedigreelist' plot(x, ...)
## S3 method for class 'malan_pedigreelist' plot(x, ...)
x |
Pedigree list |
... |
ignored |
Populate 1-locus autosomal DNA profile from founder and down in all pedigrees. Note, that all founders have type 0 to begin with.
population_populate_autosomal_infinite_alleles( population, mutation_rate, progress = TRUE )
population_populate_autosomal_infinite_alleles( population, mutation_rate, progress = TRUE )
population |
Population in which to populate genotypes |
mutation_rate |
Mutation rate between 0 and 1 (both included) |
progress |
Show progress |
The maternal allele is taken by random from
the 2*N[g]
alleles in the previous generation consisting of N[g]
males
with descendants in the live population.
This is also why this is not using pedigrees but instead the population.
Note, that pedigrees need not be inferred.
pedigrees_all_populate_haplotypes_custom_founders()
and
pedigrees_all_populate_haplotypes_ladder_bounded()
.
Get the size of the population.
Note the generation_upper_bound_in_result
parameter.
population_size_generation(population, generation_upper_bound_in_result = -1L)
population_size_generation(population, generation_upper_bound_in_result = -1L)
population |
Population to get size of |
generation_upper_bound_in_result |
Limit on generation to include in count; -1 means no limit. 0 only include the final generation. 1 only second last generation etc. |
Print individual
print_individual(individual)
print_individual(individual)
individual |
Individual |
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) print_individual(indv)
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) print_individual(indv)
Print pedigree
## S3 method for class 'malan_pedigree' print(x, ...)
## S3 method for class 'malan_pedigree' print(x, ...)
x |
Pedigree |
... |
ignored |
Print malan_pedigreelist
generated by
build_pedigrees()
.
## S3 method for class 'malan_pedigreelist' print(x, ...)
## S3 method for class 'malan_pedigreelist' print(x, ...)
x |
Pedigrees ( |
... |
ignored |
Print malan_population
generated by
sample_geneology()
or sample_geneology_varying_size()
.
## S3 method for class 'malan_population' print(x, ...)
## S3 method for class 'malan_population' print(x, ...)
x |
Population ( |
... |
ignored |
malan_population_abort
Print malan_population_abort
## S3 method for class 'malan_population_abort' print(x, ...)
## S3 method for class 'malan_population_abort' print(x, ...)
x |
|
... |
ignored |
Calculate distribution of allele difference after m
meioses.
relationship_allele_diff_dist(meioses, mu_dw, mu_up, method = "explicit")
relationship_allele_diff_dist(meioses, mu_dw, mu_up, method = "explicit")
meioses |
number of meioses separating the two individuals |
mu_dw |
mutation rate for 1-step down-mutation |
mu_up |
mutation rate for 1-step up-mutation |
method |
|
data.frame
with columns d
(allele difference) and p
(prob)
Calculate distribution of allele difference after m
meioses.
relationship_allele_diff_dist_sym(meioses, mu_updw, method = "explicit")
relationship_allele_diff_dist_sym(meioses, mu_updw, method = "explicit")
meioses |
number of meioses separating the two individuals |
mu_updw |
mutation rate for 1-step down- and up-mutations, i.e. total mutation rate is |
method |
|
data.frame
with columns d
(allele difference) and p
(prob)
Sample genotype with theta
sample_autosomal_genotype(allele_dist, theta)
sample_autosomal_genotype(allele_dist, theta)
allele_dist |
Allele distribution (probabilities) – gets normalised |
theta |
Theta correction between 0 and 1 (both included) |
This function simulates a geneology where the last generation has population_size
individuals.
sample_geneology( population_size, generations, generations_full = 1L, generations_return = 3L, enable_gamma_variance_extension = FALSE, gamma_parameter_shape = 5, gamma_parameter_scale = 1/5, progress = TRUE, verbose_result = FALSE )
sample_geneology( population_size, generations, generations_full = 1L, generations_return = 3L, enable_gamma_variance_extension = FALSE, gamma_parameter_shape = 5, gamma_parameter_scale = 1/5, progress = TRUE, verbose_result = FALSE )
population_size |
The size of the population. |
generations |
The number of generations to simulate:
|
generations_full |
Number of full generations to be simulated. |
generations_return |
How many generations to return (pointers to) individuals for. |
enable_gamma_variance_extension |
Enable symmetric Dirichlet (and disable standard Wright-Fisher). |
gamma_parameter_shape |
Parameter related to symmetric Dirichlet distribution for each man's probability to be father. Refer to details. |
gamma_parameter_scale |
Parameter realted to symmetric Dirichlet distribution for each man's probability to be father. Refer to details. |
progress |
Show progress. |
verbose_result |
Verbose result. |
By the backwards simulating process of the Wright-Fisher model,
individuals with no descendants in the end population are not simulated.
If for some reason additional full generations should be simulated,
the number can be specified via the generations_full
parameter.
This can for example be useful if one wants to simulate the
final 3 generations although some of these may not get (male) children.
Let be the parameter of a symmetric Dirichlet distribution
specifying each man's probability to be the father of an arbitrary
male in the next generation. When
, a man's relative probability
to be the father has 95\
constant 1 under the standard Wright-Fisher model and the standard deviation in
the number of male offspring per man is 1.10 (standard Wright-Fisher = 1).
This symmetric Dirichlet distribution is implemented by drawing
father (unscaled) probabilities from a Gamma distribution with
parameters gamma_parameter_shape
and gamma_parameter_scale
that are then normalised to sum to 1.
To obtain a symmetric Dirichlet distribution with parameter ,
the following must be used:
and
.
A malan_simulation / list with the following entries:
population
. An external pointer to the population.
generations
. Generations actually simulated, mostly useful when parameter generations = -1
.
founders
. Number of founders after the simulated generations
.
growth_type
. Growth type model.
sdo_type
. Standard deviation in a man's number of male offspring. StandardWF or GammaVariation depending on enable_gamma_variance_extension
.
end_generation_individuals
. Pointers to individuals in end generation.
individuals_generations
. Pointers to individuals in last generations_return
generation (if generations_return = 3
, then individuals in the last three generations are returned).
If verbose_result
is true, then these additional components are also returned:
individual_pids
. A matrix with pid (person id) for each individual.
father_pids
. A matrix with pid (person id) for each individual's father.
father_indices
. A matrix with indices for fathers.
sample_geneology_varying_size()
.
sim <- sample_geneology(100, 10) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
sim <- sample_geneology(100, 10) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
This function simulates a geneology with varying population size specified by a vector of population sizes, one for each generation.
sample_geneology_varying_size( population_sizes, generations_full = 1L, generations_return = 3L, enable_gamma_variance_extension = FALSE, gamma_parameter_shape = 5, gamma_parameter_scale = 1/5, progress = TRUE )
sample_geneology_varying_size( population_sizes, generations_full = 1L, generations_return = 3L, enable_gamma_variance_extension = FALSE, gamma_parameter_shape = 5, gamma_parameter_scale = 1/5, progress = TRUE )
population_sizes |
The size of the population at each generation, |
generations_full |
Number of full generations to be simulated. |
generations_return |
How many generations to return (pointers to) individuals for. |
enable_gamma_variance_extension |
Enable symmetric Dirichlet (and disable standard Wright-Fisher). |
gamma_parameter_shape |
Parameter related to symmetric Dirichlet distribution for each man's probability to be father. Refer to details. |
gamma_parameter_scale |
Parameter realted to symmetric Dirichlet distribution for each man's probability to be father. Refer to details. |
progress |
Show progress. |
By the backwards simulating process of the Wright-Fisher model,
individuals with no descendants in the end population are not simulated
If for some reason additional full generations should be simulated,
the number can be specified via the generations_full
parameter.
This can for example be useful if one wants to simulate the
final 3 generations although some of these may not get (male) children.
Let be the parameter of a symmetric Dirichlet distribution
specifying each man's probability to be the father of an arbitrary
male in the next generation. When
, a man's relative probability
to be the father has 95\
constant 1 under the standard Wright-Fisher model and the standard deviation in
the number of male offspring per man is 1.10 (standard Wright-Fisher = 1).
This symmetric Dirichlet distribution is implemented by drawing
father (unscaled) probabilities from a Gamma distribution with
parameters gamma_parameter_shape
and gamma_parameter_scale
that are then normalised to sum to 1.
To obtain a symmetric Dirichlet distribution with parameter ,
the following must be used:
and
.
A malan_simulation / list with the following entries:
population
. An external pointer to the population.
generations
. Generations actually simulated, mostly useful when parameter generations = -1
.
founders
. Number of founders after the simulated generations
.
growth_type
. Growth type model.
sdo_type
. Standard deviation in a man's number of male offspring. StandardWF or GammaVariation depending on enable_gamma_variance_extension
.
end_generation_individuals
. Pointers to individuals in end generation.
individuals_generations
. Pointers to individuals in last generations_return
generation (if generations_return = 3
, then individuals in the last three generations are returned).
sim <- sample_geneology_varying_size(10*(1:10)) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
sim <- sample_geneology_varying_size(10*(1:10)) str(sim, 1) sim$population peds <- build_pedigrees(sim$population) peds
Note that generation 0 is final, end generation. 1 is second last generation etc.
set_generation(individual, generation)
set_generation(individual, generation)
individual |
Individual |
generation |
Generation to assign |
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_generation(indv) set_generation(indv, 100) get_generation(indv)
sim <- sample_geneology(100, 10) indv <- get_individual(sim$population, 1) get_generation(indv) set_generation(indv, 100) get_generation(indv)
Individuals with the same haplotype will be in the same group and individuals with different haplotypes will be in different groups.
split_by_haplotypes(population, pids)
split_by_haplotypes(population, pids)
population |
Population obtained from simulation |
pids |
Vector of individual pids |
List of integer vector, element i is an IntegerVector
with all pids from pids
with the same haplotype
Generate test population
test_create_population()
test_create_population()
An external pointer to the population.
A dataset containing information about the Y chromosomal short tandem repeat (Y-STR) markers that are present in the kit.
ystr_kits
ystr_kits
A data frame with 88 rows and 2 variables:
name of Y-STR marker
name of Y-STR kit
A dataset from yhrd.org (and their sources) containing mutational information about Y chromosomal short tandem repeat (Y-STR) markers used in forensic genetics.
ystr_markers
ystr_markers
A data frame with 29 rows and 5 variables:
name of Y-STR marker
number of meioses observed
number of mutations observed in the corresponding number of Meioses
point estimate of mutation probability, MutProb = Mutations/Meioses
observed alleles
Note, that loci with duplications (DYS385a/b as well as DYF387S1a/b have been split into two loci).