Learn R Programming

malan: MAle Lineage ANalysis

An R package (https://www.r-project.org/) to perform 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: https://doi.org/10.1371/journal.pgen.1007028, https://doi.org/10.21105/joss.00684 and https://doi.org/10.1016/j.fsigen.2018.10.004).

Installation

You first need R (https://www.r-project.org/). Then you can install malan from GitHub by using the remotes package (https://CRAN.R-project.org/package=remotes):

# install.packages("remotes")
remotes::install_github("mikldk/malan")

For Mac OS users

Some Mac OSX configurations may have installation problems (for example missing gfortran libraries). In such cases, it may help to use Conda package management system. See also the discussion in issue #14.

Getting started

See documentation included in package (vignettes and manual) at https://mikldk.github.io/malan/. The introduction vignette is available at https://mikldk.github.io/malan/articles/introduction.html.

You can also get an overview of the included vignettes by the following R command:

vignette(package = "malan")

To read a vignette, type:

vignette("introduction", package = "malan")

Running tests

Note that to also install the tests, you need to install the package as follows:

# install.packages("remotes")
remotes::install_github("mikldk/malan", INSTALL_opts="--install-tests")

You can now run the tests:

library(malan)
library(testthat)
test_package('malan')

Contribute, issues, and support

Please use the issue tracker at https://github.com/mikldk/malan/issues if you want to notify us of an issue or need support. If you want to contribute, please either create an issue or make a pull request.

Dependencies

This package depends on R (https://www.r-project.org/) and the following R packages: Rcpp, RcppProgress, RcppArmadillo, igraph, tibble, magrittr, dplyr, and tidygraph.

References

Andersen MM, Balding DJ (2017). How convincing is a matching Y-chromosome profile?. PLoS Genet 13(11): e1007028. https://doi.org/10.1371/journal.pgen.1007028.

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.

License

License: GPL-2.

Badges

The Journal of Open Source Software:

Zenodo:

Travis CI:

Copy Link

Version

Install

install.packages('malan')

Monthly Downloads

157

Version

1.0.3

License

GPL-2 | file LICENSE

Maintainer

Mikkel Andersen

Last Published

November 28th, 2023

Functions in malan (1.0.3)

calc_autosomal_genotype_probs

Calculate genotype probabilities with theta
delete_haplotypeids_hashmap

Delete haplotype hashmap
estimate_autotheta_1subpop_genotypes

Estimate autosomal theta from genotypes
count_haplotype_near_matches_individuals

Count near haplotype matches in list of individuals
count_haplotype_occurrences_pedigree

Count haplotypes occurrences in pedigree
estimate_autotheta_subpops_individuals

Estimate autosomal F, theta, and f from subpopulations of individuals
estimate_autotheta_subpops_pids

Estimate autosomal F, theta, and f from subpopulations of individual ids
from_igraph_rcpp

Generate paternal brothers population
estimate_autotheta_subpops_unweighted_genotypes

Unweighted estimate of autosomal theta from subpopulations of genotypes
estimate_autotheta_subpops_unweighted_pids

Unweighted estimate of autosomal theta from subpopulations of individual ids
get_cousins

Get cousins
get_children

Get children
count_uncles

Number of uncles
generate_get_founder_haplotype_ladder

Generate a function to simulate pedigree founder haplotype based on ladder information
get_allele_counts_genotypes

Get autosomal allele counts from subpopulations of genotypes
get_generation

Get individual's generation number
get_haplotypes_pids

Get haplotypes from a vector of pids.
get_haplotype

Get haplotype from an individual
estimate_autotheta_1subpop_individuals

Estimate autosomal theta from individuals
count_haplotype_occurrences_individuals

Count haplotypes occurrences in list of individuals
get_allele_counts_pids

Get autosomal allele counts from subpopulations given by pids
generate_get_founder_haplotype_db

Generate a function to simulate pedigree founder haplotype based on a haplotype databasep
get_brothers

Get brothers
estimate_autotheta_subpops_genotypes

Estimate autosomal F, theta, and f from subpopulations of genotypes
get_nodes_edges

Get nodes and edges
get_pedigree_as_graph

Get pedigree information as graph (mainly intended for plotting)
get_pedigree_id_from_pid

Get pedigree ids from pids
get_pedigrees_tidy

Get pedigrees information in tidy format
print.malan_population

Print population
haplotype_partially_matches_individuals

Get individuals partially matching from list of individuals
haplotypes_to_hashes

Convert haplotypes to hashes (integers)
mixture_info_by_individuals_5pers

Mixture information about 5 persons' mixture of donor1, donor2, donor3, donor4 and donor5.
father_matches

Father matches
get_family_info

Get individual's family information
from_igraph

Convert igraph to population
get_father

Get father
print.malan_population_abort

Print malan_population_abort
pedigree_as_igraph

Convert pedigree to igraph
meiotic_radius

Meiotic radius
get_pid

Get pid from individual
get_pids_in_pedigree

Get pids in pedigree
set_generation

Set individual's generation number
get_individual

Get individual by pid
get_haplotypes_in_pedigree

Get haplotypes in pedigree
infer_generation

Infer individual's generation number
pedigrees_all_populate_haplotypes_custom_founders

Populate haplotypes in pedigrees (custom founder/unbounded).
population_populate_autosomal_infinite_alleles

Populate 1-locus autosomal DNA profile in pedigrees with infinite alleles mutation model.
infer_generations

Infer generation numbers from pedigrees
mixture_info_by_individuals_2pers

Mixture information about 2 persons' mixture of donor1 and donor2.
pedigrees_all_populate_haplotypes_ladder_bounded

Populate haplotypes in pedigrees (custom founder/bounded).
get_pedigree_from_individual

Get pedigree from individual
get_pedigree_id

Get pedigree id
population_size_generation

Size of population
print.malan_pedigreelist

Print pedigree list
get_haplotypes_individuals

Get haplotype matrix from list of individuals
sample_autosomal_genotype

Sample genotype with theta
get_uncles

Get uncles
get_zero_haplotype_generator

Generate a function to generate the zero haplotype
mixture_info_by_individuals_4pers

Mixture information about 4 persons' mixture of donor1, donor2, donor3 and donor4.
mixture_info_by_individuals_3pers

Mixture information about 3 persons' mixture of donor1, donor2 and donor3.
pedigree_haplotype_matches_in_pedigree_meiosis_L1_dists

Information about matching individuals
ystr_markers

Mutational information about Y-STR markers
grandfather_matches

Grandfather matches
split_by_haplotypes

Split pids by haplotype
pedigree_size

Get pedigree size
pedigrees_all_populate_autosomal

Populate 1-locus autosomal DNA profile in pedigrees with single-step mutation model.
pedigrees_all_populate_haplotypes

Populate haplotypes in pedigrees (0-founder/unbounded).
plot.malan_pedigreelist

Plot pedigree list
plot.malan_pedigree

Plot pedigree
print_individual

Print individual
pedigree_haplotype_near_matches_meiosis

Information about almost matching individuals
haplotype_matches_individuals

Get individuals matching from list of individuals
relationship_allele_diff_dist

Calculate distribution of allele difference
pedigrees_table

Get distribution of pedigree sizes
sample_geneology_varying_size

Simulate a geneology with varying population size.
sample_geneology

Simulate a geneology with constant population size.
get_individuals

Get all individuals in population
load_haplotypes

Load haplotypes to individuals
get_matching_pids_from_hashmap

Get individuals with a certain haplotype id by hashmap lookup
[[.malan_pedigreelist

Get pedigree from pedigree list
load_individuals

Construct a population from data
meiotic_dist

Meiotic distance between two individuals
meiotic_dist_threshold

Meiotic distance between two individuals (with threshold)
pedigree_size_generation

Size of pedigree
[[.malan_population

Get individual from population by pid
relationship_allele_diff_dist_sym

Calculate distribution of allele difference for symmetric mutation rates
pedigrees_count

Get number of pedigrees
malan-package

MAle Lineage ANalysis
meioses_generation_distribution

Meiotic distribution
ystr_kits

Kit information about Y-STR markers
print.malan_pedigree

Print pedigree
test_create_population

Generate test population
brothers_matching

Number of brothers with matching haplotype
construct_M

Construct M matrix
as_tbl_graph.malan_pedigreelist

Get tidy graph object
analyse_mixture_result

Analyse mixture results
build_haplotype_hashmap

Build hashmap of haplotype to individuals
count_brothers

Number of brothers
calc_autosomal_genotype_conditional_cumdist

Calculate conditional genotype cumulative probabilities with theta
build_pedigrees

Build pedigrees from (individuals in) a population.
analyse_mixture_results

Analyse mixture results in a vectorised fashion