Learn R Programming

⚠️There's a newer version (1.0.4) of this package.Take me there.

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

258

Version

1.0.2

License

GPL-2 | file LICENSE

Maintainer

Mikkel Andersen

Last Published

June 25th, 2020

Functions in malan (1.0.2)

brothers_matching

Number of brothers with matching haplotype
calc_autosomal_genotype_conditional_cumdist

Calculate conditional genotype cumulative probabilities with theta
count_brothers

Number of brothers
construct_M

Construct M matrix
build_pedigrees

Build pedigrees from (individuals in) a population.
build_haplotype_hashmap

Build hashmap of haplotype to individuals
calc_autosomal_genotype_probs

Calculate genotype probabilities with theta
analyse_mixture_result

Analyse mixture results
as_tbl_graph.malan_pedigreelist

Get tidy graph object
analyse_mixture_results

Analyse mixture results in a vectorised fashion
delete_haplotypeids_hashmap

Delete haplotype hashmap
get_pids_in_pedigree

Get pids in pedigree
get_father

Get father
generate_get_founder_haplotype_db

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

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

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

Get individual's family information
from_igraph_rcpp

Generate paternal brothers population
get_uncles

Get uncles
get_pid

Get pid from individual
estimate_autotheta_1subpop_genotypes

Estimate autosomal theta from genotypes
father_matches

Father matches
get_zero_haplotype_generator

Generate a function to generate the zero haplotype
count_uncles

Number of uncles
get_allele_counts_genotypes

Get autosomal allele counts from subpopulations of genotypes
generate_get_founder_haplotype_ladder

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

Information about matching individuals
count_haplotype_occurrences_pedigree

Count haplotypes occurrences in pedigree
get_generation

Get individual's generation number
pedigrees_all_populate_haplotypes_custom_founders

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

Estimate autosomal theta from individuals
pedigree_haplotype_near_matches_meiosis

Information about almost matching individuals
get_haplotype

Get haplotype from an individual
get_pedigree_from_individual

Get pedigree from individual
get_children

Get children
get_nodes_edges

Get nodes and edges
meiotic_dist

Meiotic distance between two individuals
haplotype_partially_matches_individuals

Get individuals partially matching from list of individuals
get_pedigree_as_graph

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

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

Convert igraph to population
get_cousins

Get cousins
haplotypes_to_hashes

Convert haplotypes to hashes (integers)
pedigrees_all_populate_haplotypes_ladder_bounded

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

Count near haplotype matches in list of individuals
malan-package

MAle Lineage ANalysis
get_pedigree_id

Get pedigree id
count_haplotype_occurrences_individuals

Count haplotypes occurrences in list of individuals
plot.malan_pedigree

Plot pedigree
relationship_allele_diff_dist_sym

Calculate distribution of allele difference for symmetric mutation rates
mixture_info_by_individuals_3pers

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

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

Meiotic distribution
plot.malan_pedigreelist

Plot pedigree list
print_individual

Print individual
estimate_autotheta_subpops_genotypes

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

Get autosomal allele counts from subpopulations given by pids
get_brothers

Get brothers
pedigrees_all_populate_autosomal

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

Calculate distribution of allele difference
estimate_autotheta_subpops_unweighted_genotypes

Unweighted estimate of autosomal theta from subpopulations of genotypes
haplotype_matches_individuals

Get individuals matching from list of individuals
get_matching_pids_from_hashmap

Get individuals with a certain haplotype id by hashmap lookup
get_individual

Get individual by pid
get_haplotypes_pids

Get haplotypes from a vector of pids.
pedigree_as_igraph

Convert pedigree to igraph
grandfather_matches

Grandfather matches
mixture_info_by_individuals_5pers

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

Get all individuals in population
estimate_autotheta_subpops_unweighted_pids

Unweighted estimate of autosomal theta from subpopulations of individual ids
sample_autosomal_genotype

Sample genotype with theta
pedigrees_all_populate_haplotypes

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

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

Size of population
print.malan_pedigreelist

Print pedigree list
ystr_markers

Mutational information about Y-STR markers
print.malan_pedigree

Print pedigree
print.malan_population

Print population
ystr_kits

Kit information about Y-STR markers
get_pedigree_id_from_pid

Get pedigree ids from pids
get_pedigrees_tidy

Get pedigrees information in tidy format
get_haplotypes_in_pedigree

Get haplotypes in pedigree
get_haplotypes_individuals

Get haplotype matrix from list of individuals
infer_generations

Infer generation numbers from pedigrees
print.malan_population_abort

Print malan_population_abort
load_individuals

Construct a population from data
pedigree_size_generation

Size of pedigree
pedigree_size

Get pedigree size
pedigrees_count

Get number of pedigrees
test_create_population

Generate test population
[[.malan_population

Get individual from population by pid
sample_geneology_varying_size

Simulate a geneology with varying population size.
pedigrees_table

Get distribution of pedigree sizes
sample_geneology

Simulate a geneology with constant population size.
split_by_haplotypes

Split pids by haplotype
[[.malan_pedigreelist

Get pedigree from pedigree list