Learn R Programming

junctions

Individual based simulations of hybridizing populations, where the accumulation of junctions is tracked. Furthermore, mathematical equations are provided to verify simulation outcomes. Both simulations and mathematical equations are based on Janzen et al. (2018) and Janzen and Miro Pina (2022).

Branch[][]
master

references

Janzen, T. , Nolte, A. W. and Traulsen, A. (2018), The breakdown of genomic ancestry blocks in hybrid lineages given a finite number of recombination sites. Evolution, 72: 735-750. https://doi.org/10.1111/evo.13436

Lavretsky, P., Janzen, T. and McCracken, KG. (2019) Identifying hybrids & the genomics of hybridization: Mallards & American black ducks of Eastern North America. Ecology and Evolution 9: 3470-3490. https://doi.org/10.1002/ece3.4981

Janzen, T., & Miró Pina, V. (2022). Estimating the time since admixture from phased and unphased molecular data. Molecular Ecology Resources, 22, 908–926. https://doi.org/10.1111/1755-0998.13519

Updates

Version 2.1.2: Added Github website Version 2.1.1: Fixed typo in one of the examples Version 2.1 : updated tbb multithreading code, sped up tests, added NEWS file Version 2.0 : merged many functions with similar functionality, added vignette that provides overview of all functionality. Version 1.9 : added c++ versions of the unphased and phased likelihoods. Version 1.8 : added multithreading using the TBB library. Version 1.7 : Further improved the recombination function following Hanno Hildenbrandt's suggestions Version 1.6 : Improved the recombination function run twice as fast Version 1.5.1: Added option to track the true number of junctions Version 1.5 : Added simulation functions to simulate phased an unphased data, including phasing error Version 1.5 : Added support for inferring the time since admixture based on phased and unphased data. Version 1.4 : Added support for estimating the number of junctions, and simulating the number of junctions, under a backcrossing scheme, using the code supplied in Lavretsky et al. 2019. Version 1.3 : Added support for estimating the time since admixture using unphased data. Version 1.3 : Added individual based simulations returning phased and unphased data. Version 1.3 : Updated entire package to Roxygen. Version 1.2 : Added support for estimating the expected number of junctions for arbitrarily distributed markers. Version 1.1 : Updated random number generation for picking recombination sites. Previous implementation was limited to 6 digit precision, current precision is at least double that, minimizing the probability of recombination occur twice in the same location for an infinite chromosome.

Copy Link

Version

Install

install.packages('junctions')

Monthly Downloads

334

Version

2.1.3

License

GPL (>= 2)

Maintainer

Thijs Janzen

Last Published

April 9th, 2025

Functions in junctions (2.1.3)

number_of_junctions_di

Calculate the expected number of junctions between two markers separated by a given amount of recombination
junctions-package

Extending The Theory of Junctions
log_likelihood_haploid

log likelihood of the time since admixture for a haploid genome
estimate_time_one_chrom

Estimate the time since the onset of hybridization, using the observed number of junctions, taking into account the distribution of markers on a single chromosome
estimate_time_diploid

estimates the time since admixture, given diploid ancestry data.
log_likelihood_diploid

calculate the log likelihood of observing diploid ancestry data.
estimate_time_haploid

estimate time using likelihood for a single chromosome
number_of_junctions

Calculate the average number of junctions
estimate_time

Estimate the time since the onset of hybridization, using the number of junctions
number_of_junctions_backcross

Calculate the average number of junctions during backcrossing
sim_fin_chrom

Individual Based Simulation of the accumulation of junctions
sim_inf_chrom

Individual Based Simulation of the accumulation of junctions
sim_backcrossing

Function to simulate data using a back crossing scheme
number_of_junctions_markers

Calculate the expected total number of junctions in a chromosome, given the distribution of markers
time_error

Estimate the error in the time estimate
sim_phased_unphased

Individual Based Simulation of the accumulation of junctions
calc_k

Calculate the limit of the number of junctions
calculate_mat

Function to calculate the maximum accurate time