plotLOAF(relatedness_example) #> No minimum number of overlapping SNPs given. #> Using default minimum of 500. #> No upper limit on number of pairs to plot given. #> Plotting first 15 pairs. plotSLICE(relatedness_example, row = 1) plotSLICE(relatedness_example, row = \"Ind1 - Ind2\") test_degree(relatedness_example, 1, 3, verbose = TRUE) #> Testing H0 : \"Ind1 - Ind2\" are 3rd-degree relatives. #> Expected PMR : 0.2044 #> Observed PMR : 0.2042 #> Estimated degree : 2.9826 #> p-value : 0.9823 #> Decision : Retain H0 #> [1] 0.9823165"},{"path":"https://jonotuke.github.io/BREADR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jono Tuke. Author, maintainer. Adam B. Rohrlach. Author. Wolfgang Haak. Author. Divyaratan Popli. Author.","code":""},{"path":"https://jonotuke.github.io/BREADR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Rohrlach AB, Tuke J, Popli D, Haak W (2023). “BREADR: R Package Bayesian Estimation Genetic Relatedness Low-coverage Genotype Data.” bioRxiv. doi:10.1101/2023.04.17.537144.","code":"@Article{, title = {BREADR: An R Package for the Bayesian Estimation of Genetic Relatedness from Low-coverage Genotype Data}, author = {Adam B. Rohrlach and Jonathan Tuke and Divyaratan Popli and Wolfgang Haak}, journal = {bioRxiv}, year = {2023}, doi = {10.1101/2023.04.17.537144}, }"},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"breadr","dir":"","previous_headings":"","what":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"goal BREADR provide easy--use method estimating degrees relatedness (second degree) extremely low-coverage data. BREADR also allows users quantify visualise level confidence estimated degrees relatedness. method requires Eigenstrat files (ind, geno snp file) begin, allowing user account DNA deamination genotyping data. information can found BREADR website.","code":""},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"install, can use usual can install development version BREADR GitHub : Also ensure BREADR install correctly, suggest installing following packages Matrix, data.table, dplyr, forcats, ggplot2, ggpubr, grDevices, magrittr, MASS, matrixStats, purrr, readr, stringr tibble.","code":"install.packages(\"BREADR\") # install.packages(\"remotes\") remotes::install_github(\"jonotuke/BREADR\")"},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"contributing-to-breadr","dir":"","previous_headings":"","what":"Contributing to BREADR","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"Please note BREADR work progress! interested project want know please feel free contact Jono Tuke (simon.tuke@adelaide.edu.au). find bug like see new improved features, please open issue GitHub repository.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":null,"dir":"","previous_headings":"","what":"Summary","title":"Summary","text":"Robust reliable estimates individuals biologically related key source information reconstructing pedigrees. combination contextual data, reconstructed pedigrees can used infer possible kinship practices prehistoric populations. However, standard methods estimate biological relatedness genome sequence data applied low coverage sequence data, common ancient DNA (aDNA) studies. Critically, statistically robust method assessing quantifying confidence classification specific degree relatedness pair individuals, using low coverage genome data, lacking. paper present R-package BREADR (Biological RElatedness Ancient DNA R), leverages -called pairwise mismatch rate, calculated optimally-filtered genome-wide pseudo-haploid sequence data, estimate genetic relatedness second degree, assuming underlying binomial distribution. BREADR also returns posterior probability degree relatedness, identical twins/individual, first-degree, second-degree “unrelated” pairs, allowing researchers quantify report uncertainty, even low-coverage data. show method accurately recovers degrees relatedness sequence data coverage low 0.04X using simulated data (produced Popli et al.[popli:2023]).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"statement-of-need","dir":"","previous_headings":"","what":"Statement of need","title":"Summary","text":"BREADR R package use ancient DNA studies, studies estimating genetic kinship extremely low-coverage DNA sequence data, forensic sciences. BREADR designed user-friendly software package, using input pseudo-haploid genotype data Eigenstrat format, common aDNA studies, allowing pre-processing quality control researchers.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"state-of-the-field","dir":"","previous_headings":"","what":"State of the Field","title":"Summary","text":"software packages estimating genetic relatedness aDNA sequence data leverage measure pairwise genetic dissimilarity, often calculated pseudo-haploid data, random call sampled site, avoid issue phasing. lcMLkin uses genotype likelihoods estimate identity--descent coefficients (k0k_0, k1k_1 k2k_2), co-ancestry coefficient can calculated, theta=k1/4+k2/2theta = k_{1}/4+k_{2}/2 [@lipatov:2015]. method requires reference panel estimate genotype likelihoods, sites unlinked. method exploratory nature, return hard classifications degrees relatedness, (currently) peer-reviewed. TKGWV2 instead estimates relatedness via method moments estimator Queller Goodnight, denoted r̂ij\\hat{r}_{ij} [@fernandes:2021]. asymmetric estimator assumes inbreeding population sites unlinked [@queller:1989]. Hence, TKGWV2 applied SNP capture data, data populations inbreeding occurred. method returns hard classifications degree relatedness based expected value rˆijrˆij observed value closest . KIN [@popli:2023] ancIBD [@ringbauer:2023] instead use spatial distribution identical--descent segments (IBDs). Like lcMLkin, KIN estimates identity--descent coefficients, using IBDs instead weighted genotype likelihoods, can identify degrees relatedness third degree. Conversely, ancIBD uses imputation increase resolution method seventh-degree. However, additional resolution comes cost requiring relatively high-coverage sequence data, approximately 0.25X whole genome sequencing, compared 0.05X, 0.026X 0.04X KIN, TKGV2 BREADR, respectively. READ READv2 use -called pairwise-mismatch rate (PMR) estimate proportion overlapping sites two individuals non-matching genotype calls [@monroy:2018; @alaccamli:2024]. PMR first introduced overcome limitations low-coverage aDNA, however, publication Kennett et al. include hard-classification method [@kennett:2017]. Kennett et al. used available overlapping sites estimate PMR, READ uses 1MB windowed approach sample distribution PMR, also account effects linkage disequilibrium (LD), allowing automated hard classification degrees relatedness. READv2, however, uses genome-wide estimate place windowed approach READ. Like READ READv2, BREARD estimates PMR, instead thins data reduce effects LD. PMR thinned data can now reasonably expected follow binomial distribution, theoretical expectations PMR derived compared observed value. , statistically rigorous measures uncertainty derived, informative diagnostic plots degree related pairs individuals can produced. Finally, although BREADR classifies degrees related second-degree, also allow tests degree tenth-degree formally tested considering potential pedigree reconstructions.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"current-applications","dir":"","previous_headings":"","what":"Current Applications","title":"Summary","text":"BREADR produces ready--publication results diagnostic plots, already seen use number publications [@rivollat:2023; @penske:2024; @gretzinger:2024; @ghalichi:2024; @pilli:2024].","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"estimating-degrees-of-relatedness","dir":"","previous_headings":"","what":"Estimating Degrees of Relatedness","title":"Summary","text":"Consider two individuals, ii jj, NijN_{ij} overlapping sites (without missingness), sites thinned (default value 1×1051\\times 10^{5}) effects LD reduced. look number pseudo-haploid genotype calls match, denoted XijX_{ij}. Hence Xij∼Bin(Nij,pij)X_{ij} \\sim \\text{Bin}(N_{ij} , p_{ij}), maximum likelihood estimator pijp_{ij} p̂ij=Xij/Nij\\hat{p}_{ij} = X_{ij} /N_{ij}. PMRs calculated, must account background relatedness, can thought expected PMR pair unrelated individuals, differ populations sequencing types (capture versus shotgun sequencing). Many choices exist value, assuming sampled dataset made mostly unrelated pairs (second degree), median PMR, denoted p‾\\bar{p} reliable estimate [@monroy:2018]. However, also allow p‾\\bar{p} user-supplied parameter, may known previous studies, can varied sensitivity analyses. Borrowing insights READ, now define expected mean PMR relationship degree k=0,1,2k = 0, 1, 2 pk=p‾(1−1k+1). p_k = \\bar{p}\\left(1 - \\frac{1}{k+1} \\right). Hence, assume degree relatedness individuals ii jj truly kkth degree, Xij∼Bin(Nij,pk)X_{ij} \\sim \\text{Bin}(N_{ij} , p_{k}). Hence, likelihood function relatedness degree kk, individuals ii jj, L(Xij|K=k,Nij)=(NijXij)pkXij(1−pk)Nij−Xij. L\\left( X_{ij} \\big| K=k, N_{ij} \\right) = \\binom{N_{ij}}{X_{ij}} p_k^{X_{ij}}(1-p_k)^{N_{ij}-X_{ij}}. let k=∞k = \\infty case two individuals “unrelated” (.e. second-degree related), also P(Xij|K≥3,Nij)=∑k=3∞P(K=k|Xij,Nij)P(K=k)=(NijXij)pkXij(1−pk)Nij−Xijfλ(k), \\begin{aligned} P\\left( X_{ij} \\big| K \\geq 3, N_{ij}\\right) &= \\sum_{k=3}^{\\infty} P\\left(K=k \\big| X_{ij},N_{ij} \\right) P\\left( K=k \\right)\\\\ &= \\binom{N_{ij}}{X_{ij}} p_k^{X_{ij}}(1-p_k)^{N_{ij}-X_{ij}} f_{\\lambda}(k), \\end{aligned} fλ(k)f_{\\lambda}(k) 3-truncated Poisson distribution form fλ(k)=1∑ℓ=02λℓe−λℓ!(λke−λk!). f_{\\lambda}(k) = \\frac{1}{\\sum_{\\ell=0}^{2} \\frac{\\lambda^\\ell e^{-\\lambda}}{\\ell!}}\\left( \\frac{\\lambda^ke^{-\\lambda}}{k!} \\right). choose 3-truncated Poisson distribution λ=10\\lambda=10 represents well unlikelihood individuals always closely related second-degree related, also captures diminishing probabilities distantly-related due finite size populations. possible calculate normalised posterior probabilities individuals ii jj kkth degree related P(K=k|Xij,Nij)=L(Xij|K=k,Nij)P(K=k)[∑ℓ=02L(Xij|K=ℓ,Nij)]+L(Xij|K≥3,Nij) P\\left( K=k \\big| X_{ij}, N_{ij} \\right) = \\frac{L\\left( X_ij | K=k,N_{ij} \\right)P\\left(K=k\\right)}{\\left[ \\sum_{\\ell=0}^{2} L\\left( X_{ij} \\big| K = \\ell, N_{ij} \\right) \\right] + L\\left(X_{ij} \\big| K\\geq 3, N_{ij} \\right)} denominator equals one, construction. Hence, P(K=k|Xij,Nij)=L(Xij|K=k,Nij)P(K=k). P\\left( K=k \\big| X_{ij}, N_{ij} \\right) = L\\left( X_ij | K=k,N_{ij} \\right)P\\left(K=k\\right). However, prior probabilities degrees relatedness unclear, vary study study, given uninformative uniform distribution default. Since user inputs, thought carefully, can explored via sensitivity analyses explore prior probabilities driving relatedness classifications. Finally, include third-degree higher relationships possible classifications, include method statistical test retaining rejecting possibility kth-degree relationship, 0≤k≤100 \\leq k \\leq 10. , perform binomial test observed number mismatches XijX_{ij}, expected probability pairwise mismatches, defined Equation 1, returning two-sided p-value estimated (non-integer) degree relatedness, found setting pk=pijp_k = p_{ij} k=k̂k = \\hat{k} Equation 2, solving kk, .e., k̂=ln(1−pij/p̂)ln(1/2), \\hat{k} = \\frac{ln(1-p_{ij}/\\hat{p})}{ln(1/2)}, pij devtools::install_github(\"jonotuke/BREADR\") > require(BREADR)"},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"preprocessing-the-eigenstrat-data-for-analysis","dir":"","previous_headings":"","what":"Preprocessing the Eigenstrat data for analysis","title":"Summary","text":"downstream functions BREADR package require preprocessing three standard Eigenstrat files: -called ind, snp geno files. first step, take list sites genome interest, chromosome name (integer) site position, pseudo-haploid genotype calls individuals (interest). , pair, take sites overlapping, non-missing calls, least user-defined number (default 5×1055\\times 10^5) positions apart (within chromosomes). Using site positions, record number filtered, overlapping sites, well number mismatches per pair. generate required genetic pairwise comparisons individuals, users apply processEigenstrat() function. function requires three input string parameters: paths three Eigenstrat files. stage pre-processing, users four additional parameters can set, reset downstream. First, filter_length parameter (default 1×1051\\times10^{5}) allows user define minimum number positions sites can considered. removing sites close one another, assumption independence site-wise comparison best attained lowering removing effects linkage disequilibrium. Second, pop_pattern parameter (default exclude nothing) allows user define set population names subset individuals compared. Third, filter_deam parameter (default ) filters C T G SNPs possible list sites potential effects post-mortem deamination accounted genotyping process. Last, since pre-processing computationally expensive step analysis, outfile parameter (default ) path-string allows user automatically save post-processed data TSV file. resulting (see ) tibble four columns: names samples/individuals compared (pair), number overlapping SNPs (nsnps) per pair, number overlapping sites pair match (mismatch) pairwise-mismatch rate (pmr).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"analysing-the-post-processed-data","dir":"","previous_headings":"","what":"Analysing the post-processed data","title":"Summary","text":"Following pre-processing step, callRelatedness() function calls relationship Same_Twins, First_Degree , Second_Degree Unrelated, additional information, output processEigenstrat() function. Additional parameters can set allow user customise analysis. class_prior parameter (default Uniform) defines prior probabilities relatedness class. average_relatedness parameter defines background relatedness estimated via (default median filtered estimates). can either: () estimated directly median PMR data, (b) single value (useful sensitivity analyses user uncertain), (c) vector values equal number rows input tibble (can useful different populations different background relatedness levels). median_co parameter (default 500) defines minimum number overlapping SNPs pair individuals must share PMR used estimating median PMR, user elected use median PMR. Finally, filter_n parameter (default 1) used simply remove pairs individuals analysis share fewer overlapping SNPs value. resulting tibble (see Figure ) additional 9 columns: row number (pair useful additional functions, highest-posterior genetic relationship (relationship), standard error estimate PMR (sd), median used calculations (med), normalised posterior probabilities four relatedness categories (Same_Twins, First_Degree, Second_Degree Unrelated)).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"visually-interpreting-results","dir":"","previous_headings":"","what":"Visually interpreting results","title":"Summary","text":"posterior probabilities degrees relatedness calculated, results can visualised two ways. First, overall picture relatedness can obtained using plotLOAF() function plots first NN (default N=50N = 50) pairs individuals, sorted ascending PMR value (see ). shape colour point estimates PMR indicate highest posterior degree relatedness assigned pair, associated 95% confidence interval represented vertical error bars. dashed coloured lines indicated expected PMR degree relatedness (given background relatedness). Note nn individuals, n(n−1)2\\frac{n(n-1)}{2} pairs individuals, grows factorially nn gets larger. Hence, plotting pairs individuals infeasible many cases, since majority pairs likely unrelated, users may wish plot closely related pairs individuals ease visualisation. can observe two genetically identical individuals, also get scale number first- second-degree related individuals. Second, diagnostic plot analysis single pair individuals can obtained using callSLICE() function (see ). default, function produces two panel plot. Panel displays distribution PMR degrees relatedness (given number overlapping sites), well observed PMR (95% confidence interval) plotted densities. Panel B displays normalised posterior probabilities possible degree relatedness, visually numerically. user can choose return just one plots, . , misclassify true second-degree relationship unrelated, however, posterior probabilities lead researcher consider second-degree relationship plausible. Finally, savesSLICES() function allows user save possible pairwise diagnosticplots (produced plotSLICE()) PDFs output path.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"testing-for-departure-from-refined-degrees-of-relatedness","dir":"","previous_headings":"","what":"Testing for departure from refined degrees of relatedness","title":"Summary","text":"resolution BREADR method allows degrees relatedness second degree assigned. However, can principle test see observed PMR consistent degree relatedness using simple binomial test. test_degree() function allows user test degree relatedness tenth degree. printResults option set TRUE, information binomial test displayed (see Figure 6). null hypothesis, expected observed PMR, estimate degree relatedness, associated p-value decision (significance level α=0.05\\alpha = 0.05) given. Figure shows case able correctly identify third-degree relationship reasonable Ind1 Ind12.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"conclusion","dir":"","previous_headings":"","what":"Conclusion","title":"Summary","text":"article describes usage functionality R package BREADR. Based well-understood metric PMR, BREADR can infer pairwise genetic relatedness individuals second degree, use binomial tests consistency PMRs higher degrees relatedness. BREADR can calculate Bayesian posterior probabilities classification genetic relationships even low-coverage, pseudohaploid sequence data, Eigenstrat data format, common aDNA studies. Additionally, BREADR provides functionality plotting overall genetic relatedness, well single plots specific pairs need exploring strength evidence alternative potential genetic relationships required. Finally, allowing researchers explore possibility potential levels genetic relatedness statistically rigorous framework, quality control analyses pedigree reconstructions can performed flexibility. concede BREADR limitations method relies estimating pairwise-mismatch: namely estimating average pairwise-mismatch rate two unrelated individuals difficult (assess), likely constant large pedigrees, across populations. also identify need consider empirical variability expected pairwise-mismatch rate k-degree relatives can observed large modern datasets. However, encourage researchers consider limitations using BREADR, well use multiple methods estimating relatedness. usefulness researchers able assign statistical confidence every estimated degree relatedness, even cases coverage extremely low, critical reconstructing pedigree. also shown BREADR misclassifies genetic relationships, due true closer genetic relationship (third-degree genetic relationships misclassified unrelated). easy--use R-implementation method makes BREADR attractive, statistically rigorous tool researchers archaeogenetics employ.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"data-description","dir":"","previous_headings":"","what":"Data Description","title":"Summary","text":"genetic data real, anonymised, ancient DNA data produced house Max Planck Institute Evolutionary Anthropology, Leipzig, Germany. data comes site dated 2350 BCE. data produced using Illumina sequencing platform, adapter trimming, reads aligned human reference genome GRCh37 using BWA[li2009fast] implemented EAGER[peltzer2016eager]. Sequence reads filtered minimum sequence length 35 mapping quality least 25. Data genotyped using pileupCaller[https://github.com/stschiff/sequenceTools/tree/master/src/SequenceTools] using random pseudohaploid call position 1240k capture assay[mathieson2015genome]. processed genotype data can found : https://github.com/jonotuke/BREADR/tree/master/data-raw/.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"author-contributions","dir":"","previous_headings":"","what":"Author Contributions","title":"Summary","text":"Adam B. Rohrlach conceived, designed implemented method, wrote paper, prepared figures, performed computation work, reviewed drafts paper edited submissions. Jonathan Tuke conceived method, created submitted package CRAN, reviewed drafts paper edited submissions. Divya Ratan Popli created implemented computations benchmarking accuracy performance method, reviewed drafts paper edited submissions. Wolfgang Haak conceived method, reviewed drafts paper edited submissions.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"acknowledgements","dir":"","previous_headings":"","what":"Acknowledgements","title":"Summary","text":"thank Harald Ringbauer, Nigel Bean Vincent Braunack-Mayer important enlightening discussions regarding manuscript.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"funding","dir":"","previous_headings":"","what":"Funding","title":"Summary","text":"research financed Max Planck Society European Research Council European Union’s Horizon 2020 research innovation programme (grant agreement numbers 771234-PALEoRIDER, W.H.; 101141408-ROAMANCE, W.H.).","code":""},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":null,"dir":"Reference","previous_headings":"","what":"callRelatedness — callRelatedness","title":"callRelatedness — callRelatedness","text":"function takes PMR observations, (given prior distribution degrees relatedness) returns posterior probabilities pairs individuals () individual/twins, (b) first-degree related, (c) second-degree related (d) \"unrelated\" (third-degree higher). highest posterior probability degree relatedness also returned hard classification. Options include setting background relatedness (using sample median), minimum number overlapping SNPs one uses sample median background relatedness, minimum number overlapping SNPs including pairs analysis.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"callRelatedness — callRelatedness","text":"","code":"callRelatedness( pmr_tibble, class_prior = rep(0.25, 4), average_relatedness = NULL, median_co = 500, filter_n = 1 )"},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"callRelatedness — callRelatedness","text":"pmr_tibble tibble output processEigenstrat function. class_prior prior probabilities /twin, 1st-degree, 2nd-degree, unrelated, respectively. average_relatedness single numeric value, vector numeric values, use average background relatedness. NULL, sample median used. median_co average_relatedness left NULL, minimum cutoff number overlapping snps included median calculation 500. filter_n minimum number overlapping SNPs pairs removed entire analysis. NULL, default 1.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"callRelatedness — callRelatedness","text":"results_tibble: tibble containing 13 columns: row: row number pair: pair individuals compared. relationship: highest posterior probability estimate degree relatedness. pmr: pairwise mismatch rate (mismatch/nsnps). sd: estimated standard deviation pmr. mismatch: number sites match pair. nsnps: number overlapping snps compared pair. ave_re;: value background relatedness used normalisation. Same_Twins: posterior probability associated individual/twins classification. First_Degree: posterior probability associated first-degree classification. Second_Degree: posterior probability associated second-degree classification. Unrelated: posterior probability associated unrelated classification. BF: strength confidence Bayes Factor associated highest posterior probability classification compared 2nd highest. (longer included)","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"callRelatedness — callRelatedness","text":"","code":"callRelatedness(counts_example, class_prior=rep(0.25,4), average_relatedness=NULL, median_co=5e2,filter_n=1 ) #> # A tibble: 15 × 12 #> row pair relationship pmr sd mismatch nsnps ave_rel Same_Twins #> #> 1 1 Ind1 - In… Unrelated 0.204 0.0103 310 1518 0.218 6.71e- 26 #> 2 2 Ind1 - In… Unrelated 0.222 0.00428 2093 9435 0.218 1.22e-214 #> 3 3 Ind1 - In… Unrelated 0.224 0.00458 1854 8283 0.218 2.00e-194 #> 4 4 Ind1 - In… Unrelated 0.235 0.0116 314 1336 0.218 2.68e- 37 #> 5 5 Ind1 - In… Unrelated 0.215 0.00867 481 2242 0.218 9.82e- 46 #> 6 6 Ind2 - In… Unrelated 0.218 0.00432 1988 9119 0.218 5.06e-195 #> 7 7 Ind2 - In… Unrelated 0.213 0.00458 1699 7984 0.218 4.95e-156 #> 8 8 Ind2 - In… Unrelated 0.229 0.0122 270 1179 0.218 1.80e- 30 #> 9 9 Ind2 - In… Unrelated 0.215 0.00927 423 1965 0.218 1.10e- 40 #> 10 10 Ind3 - In… Same_Twins 0.108 0.00214 2253 20952 0.218 1 e+ 0 #> 11 11 Ind3 - In… Unrelated 0.213 0.00458 1703 7994 0.218 6.83e-157 #> 12 12 Ind3 - In… Unrelated 0.218 0.00394 2398 10994 0.218 2.05e-235 #> 13 13 Ind4 - In… Unrelated 0.210 0.00489 1451 6924 0.218 1.92e-127 #> 14 14 Ind4 - In… Unrelated 0.220 0.00419 2141 9745 0.218 2.95e-214 #> 15 15 Ind5 - In… Unrelated 0.220 0.00994 383 1739 0.218 3.64e- 39 #> # ℹ 3 more variables: First_Degree , Second_Degree , Unrelated "},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":null,"dir":"Reference","previous_headings":"","what":"counts_example — counts_example","title":"counts_example — counts_example","text":"example tibble made processEigenstrat().","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"counts_example — counts_example","text":"","code":"counts_example"},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":"counts-example","dir":"Reference","previous_headings":"","what":"counts_example","title":"counts_example — counts_example","text":"data frame 15 rows 4 columns: pair pair individuals compared nsnps number overlapping snps compared pair. mismatch number sites match pair. pmr pairwise mismatch rate (mismatch/nsnps).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":null,"dir":"Reference","previous_headings":"","what":"get column — get_column_new","title":"get column — get_column_new","text":"get column","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get column — get_column_new","text":"","code":"get_column_new(genofile, col = 1)"},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get column — get_column_new","text":"genofile genofile col column return","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get column — get_column_new","text":"column numbers","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":null,"dir":"Reference","previous_headings":"","what":"plotLOAF — plotLOAF","title":"plotLOAF — plotLOAF","text":"Plots (sorted increasing value) observed PMR values maximum posterior probability classifications represented colour shape. Options include cut minimum number overlapping SNPs, max number pairs plot x-axis font size.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plotLOAF — plotLOAF","text":"","code":"plotLOAF(in_tibble, nsnps_cutoff = NULL, N = NULL, fntsize = 7, verbose = TRUE)"},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plotLOAF — plotLOAF","text":"in_tibble tibble output callRelatedness() function. nsnps_cutoff minimum number overlapping SNPs pairs removed plot. NULL, default 500. N number (sorted increasing PMR) pairs plot. Avoids plotting pairs (many unrelated). fntsize fontsize x-axis names. verbose TRUE, information plotting process sent console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"plotLOAF — plotLOAF","text":"ggplot object","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plotLOAF — plotLOAF","text":"","code":"relatedness_example #> # A tibble: 15 × 12 #> row pair relationship pmr sd mismatch nsnps ave_rel Same_Twins #> #> 1 1 Ind1 - In… Unrelated 0.204 0.0103 310 1518 0.218 6.71e- 26 #> 2 2 Ind1 - In… Unrelated 0.222 0.00428 2093 9435 0.218 1.22e-214 #> 3 3 Ind1 - In… Unrelated 0.224 0.00458 1854 8283 0.218 2.00e-194 #> 4 4 Ind1 - In… Unrelated 0.235 0.0116 314 1336 0.218 2.68e- 37 #> 5 5 Ind1 - In… Unrelated 0.215 0.00867 481 2242 0.218 9.82e- 46 #> 6 6 Ind2 - In… Unrelated 0.218 0.00432 1988 9119 0.218 5.06e-195 #> 7 7 Ind2 - In… Unrelated 0.213 0.00458 1699 7984 0.218 4.95e-156 #> 8 8 Ind2 - In… Unrelated 0.229 0.0122 270 1179 0.218 1.80e- 30 #> 9 9 Ind2 - In… Unrelated 0.215 0.00927 423 1965 0.218 1.10e- 40 #> 10 10 Ind3 - In… Same_Twins 0.108 0.00214 2253 20952 0.218 1 e+ 0 #> 11 11 Ind3 - In… Unrelated 0.213 0.00458 1703 7994 0.218 6.83e-157 #> 12 12 Ind3 - In… Unrelated 0.218 0.00394 2398 10994 0.218 2.05e-235 #> 13 13 Ind4 - In… Unrelated 0.210 0.00489 1451 6924 0.218 1.92e-127 #> 14 14 Ind4 - In… Unrelated 0.220 0.00419 2141 9745 0.218 2.95e-214 #> 15 15 Ind5 - In… Unrelated 0.220 0.00994 383 1739 0.218 3.64e- 39 #> # ℹ 3 more variables: First_Degree , Second_Degree , Unrelated plotLOAF(relatedness_example) #> No minimum number of overlapping SNPs given. #> Using default minimum of 500. #> No upper limit on number of pairs to plot given. #> Plotting first 15 pairs."},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":null,"dir":"Reference","previous_headings":"","what":"plotSLICE — plotSLICE","title":"plotSLICE — plotSLICE","text":"function plotting diagnostic information classifying specific pair (defined row number pair name) individuals. Output includes PDFs degree relatedness (given number overlapping SNPs) panel , normalised posterior probabilities possible degree relatedness.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plotSLICE — plotSLICE","text":"","code":"plotSLICE( in_tibble, row, title = NULL, class_prior = rep(1/4, 4), showPlot = TRUE, which_plot = 0, labels = NULL )"},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plotSLICE — plotSLICE","text":"in_tibble tibble output callRelatedness() function. row either row number pair name posterior distribution plotted. title optional title plot. NULL, pair user-defined row used. class_prior prior probabilities /twin, 1st-degree, 2nd-degree, unrelated, respectively. showPlot TRUE, display plot. FALSE, just pass plot variable. which_plot 1, returns just plot posterior distributions, 2 returns just normalised posterior values. Anything else returns plots. labels length two character vector labels plots. Default labels.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"plotSLICE — plotSLICE","text":"two-panel diagnostic ggplot object","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plotSLICE — plotSLICE","text":"","code":"plotSLICE(relatedness_example, row = 1)"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":null,"dir":"Reference","previous_headings":"","what":"process Eigenstrat data - alternative version — processEigenstrat","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"function takes paths eigenstrat trio (ind, snp geno file) returns pairwise mismatch rate pairs thinned set SNPs. Options include choosing thinning parameter, subsetting population names, filtering SNPs deamination possible.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"","code":"processEigenstrat( indfile, genofile, snpfile, filter_length = NULL, pop_pattern = NULL, filter_deam = FALSE, outfile = NULL, chromosomes = NULL, verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"indfile path eigenstrat ind file genofile path eigenstrat geno file. snpfile path eigenstrat snp file. filter_length minimum distance sites compared (reduce effect LD). pop_pattern character vector population names filter ind file populations compared. filter_deam TRUE/FALSE C->T G->sites ignored. outfile (OPTIONAL) path filename can save output function TSV, NULL, back saved. outfile, tibble returned. chromosomes chromosome filter data . verbose controls printing messages console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"out_tibble: tibble containing four columns:","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"","code":"# Use internal files to the package as an example indfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") genofile <- system.file(\"extdata\", \"example.geno.txt\", package = \"BREADR\") snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") processEigenstrat( indfile, genofile, snpfile, filter_length=1e5, pop_pattern=NULL, filter_deam=FALSE ) #> Reading in SNP data. #> Analysing chromosomes: #> 1 #> Starting to read in genotype data. #> | | | 0% | |============== | 20% | |============================ | 40% | |========================================== | 60% | |======================================================== | 80% | |======================================================================| 100% Complete. #> #> Starting to compare genotypes and calculate PMR. #> | | | 0% | |===== | 7% | |========== | 14% | |=============== | 21% | |==================== | 29% | |========================= | 36% | |============================== | 43% | |=================================== | 50% | |======================================== | 57% | |============================================= | 64% | |================================================== | 71% | |======================================================= | 79% | |============================================================ | 86% | |================================================================= | 93% | |======================================================================| 100% #> Complete. #> #> # A tibble: 15 × 4 #> pair nsnps mismatch pmr #> #> 1 Ind1 - Ind2 2 1 0.5 #> 2 Ind1 - Ind3 14 2 0.143 #> 3 Ind1 - Ind4 14 3 0.214 #> 4 Ind1 - Ind5 1 0 0 #> 5 Ind1 - Ind6 4 0 0 #> 6 Ind2 - Ind3 13 3 0.231 #> 7 Ind2 - Ind4 11 2 0.182 #> 8 Ind2 - Ind5 0 0 NA #> 9 Ind2 - Ind6 4 2 0.5 #> 10 Ind3 - Ind4 35 5 0.143 #> 11 Ind3 - Ind5 10 0 0 #> 12 Ind3 - Ind6 19 2 0.105 #> 13 Ind4 - Ind5 10 1 0.1 #> 14 Ind4 - Ind6 20 7 0.35 #> 15 Ind5 - Ind6 2 1 0.5"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":null,"dir":"Reference","previous_headings":"","what":"process Eigenstrat data — processEigenstrat_old","title":"process Eigenstrat data — processEigenstrat_old","text":"function takes paths eigenstrat trio (ind, snp geno file) returns pairwise mismatch rate pairs thinned set SNPs. Options include choosing thinning parameter, subsetting population names, filtering SNPs deamination possible.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"process Eigenstrat data — processEigenstrat_old","text":"","code":"processEigenstrat_old( indfile, genofile, snpfile, filter_length = NULL, pop_pattern = NULL, filter_deam = FALSE, outfile = NULL, chromosomes = NULL, verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"process Eigenstrat data — processEigenstrat_old","text":"indfile path eigenstrat ind file genofile path eigenstrat geno file. snpfile path eigenstrat snp file. filter_length minimum distance sites compared (reduce effect LD). pop_pattern character vector population names filter ind file populations compared. filter_deam TRUE/FALSE C->T G->sites ignored. outfile (OPTIONAL) path filename can save output function TSV, NULL, back saved. outfile, tibble returned. chromosomes chromosome filter data . verbose controls printing messages console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"process Eigenstrat data — processEigenstrat_old","text":"out_tibble: tibble containing four columns:","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"process Eigenstrat data — processEigenstrat_old","text":"","code":"# Use internal files to the package as an example indfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") genofile <- system.file(\"extdata\", \"example.geno.txt\", package = \"BREADR\") snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") processEigenstrat_old( indfile, genofile, snpfile, filter_length=1e5, pop_pattern=NULL, filter_deam=FALSE ) #> Reading in SNP data. #> Analysing chromosomes: #> 1 #> Starting to read in genotype data. #> | | | 0% | |============== | 20% | |============================ | 40% | |========================================== | 60% | |======================================================== | 80% | |======================================================================| 100% Complete. #> #> Starting to compare genotypes and calculate PMR. #> | | | 0% | |===== | 7% | |========== | 14% | |=============== | 21% | |==================== | 29% | |========================= | 36% | |============================== | 43% | |=================================== | 50% | |======================================== | 57% | |============================================= | 64% | |================================================== | 71% | |======================================================= | 79% | |============================================================ | 86% | |================================================================= | 93% | |======================================================================| 100% #> Complete. #> #> # A tibble: 15 × 4 #> pair nsnps mismatch pmr #> #> 1 Ind1 - Ind2 2 1 0.5 #> 2 Ind1 - Ind3 14 2 0.143 #> 3 Ind1 - Ind4 14 3 0.214 #> 4 Ind1 - Ind5 1 0 0 #> 5 Ind1 - Ind6 4 0 0 #> 6 Ind2 - Ind3 13 3 0.231 #> 7 Ind2 - Ind4 11 2 0.182 #> 8 Ind2 - Ind5 0 0 NA #> 9 Ind2 - Ind6 4 2 0.5 #> 10 Ind3 - Ind4 35 5 0.143 #> 11 Ind3 - Ind5 10 0 0 #> 12 Ind3 - Ind6 19 2 0.105 #> 13 Ind4 - Ind5 10 1 0.1 #> 14 Ind4 - Ind6 20 7 0.35 #> 15 Ind5 - Ind6 2 1 0.5"},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":null,"dir":"Reference","previous_headings":"","what":"read_ind — read_ind","title":"read_ind — read_ind","text":"read_ind","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_ind — read_ind","text":"","code":"read_ind(filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_ind — read_ind","text":"filename IND text file.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_ind — read_ind","text":"tibble column headings: ind (CHR), sex (CHR), pop (CHR)","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_ind — read_ind","text":"","code":"ind_snpfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") read_ind(ind_snpfile) #> # A tibble: 6 × 3 #> ind sex pop #> #> 1 Ind1 U Pop1 #> 2 Ind2 U Pop1 #> 3 Ind3 U Pop1 #> 4 Ind4 U Pop1 #> 5 Ind5 U Pop2 #> 6 Ind6 U Pop2"},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":null,"dir":"Reference","previous_headings":"","what":"read_snp — read_snp","title":"read_snp — read_snp","text":"read_snp","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_snp — read_snp","text":"","code":"read_snp(filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_snp — read_snp","text":"filename SNP text file.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_snp — read_snp","text":"tibble column headings: snp (CHR), chr (DBL), pos (DBL), site (DBL), anc (CHR), der (CHR).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_snp — read_snp","text":"","code":"std_snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") broken_snpfile <- system.file(\"extdata\", \"broken.snp.txt\", package = \"BREADR\") read_snp(std_snpfile) #> # A tibble: 1,000 × 6 #> snp chr pos site anc der #> #> 1 rs3094315 1 0 752566 G A #> 2 rs7419119 1 0 842013 T G #> 3 rs13302957 1 0 891021 G A #> 4 rs6696609 1 0 903426 C T #> 5 rs8997 1 0 949654 A G #> 6 rs9442372 1 0 1018704 A G #> 7 rs147606383 1 0 1045331 G A #> 8 rs4970405 1 0 1048955 A G #> 9 rs11807848 1 0 1061166 T C #> 10 rs4970421 1 0 1108637 G A #> # ℹ 990 more rows read_snp(broken_snpfile) #> # A tibble: 100 × 6 #> snp chr pos site anc der #> #> 1 1_14.570829090394763 1 0 14 A X #> 2 1_31.762980536196316 1 0 31 X X #> 3 1_58.40133360272569 1 0.000001 58 A X #> 4 1_146.13704767420893 1 0.000001 146 X X #> 5 1_350.25559508884965 1 0.000003 350 A X #> 6 1_373.54266589096653 1 0.000004 373 X X #> 7 1_376.1963053157634 1 0.000004 376 X X #> 8 1_402.00713564772997 1 0.000004 402 A X #> 9 1_473.15441796651334 1 0.000005 473 A X #> 10 1_608.1074747673024 1 0.000006 608 X X #> # ℹ 90 more rows"},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":null,"dir":"Reference","previous_headings":"","what":"relatedness_example — relatedness_example","title":"relatedness_example — relatedness_example","text":"example tibble made callRelatedness()","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"relatedness_example — relatedness_example","text":"","code":"relatedness_example"},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":"relatedness-example","dir":"Reference","previous_headings":"","what":"relatedness_example","title":"relatedness_example — relatedness_example","text":"data frame 15 rows 13 columns: row row number pair pair individuals compared. relationship highest posterior probability estimate degree relatedness. pmr pairwise mismatch rate (mismatch/nsnps). sd estimated standard deviation pmr. mismatch number sites match pair. nsnps number overlapping snps compared pair. ave_re value background relatedness used normalisation. Same_Twins posterior probability associated individual/twins classification. First_Degree posterior probability associated first-degree classification. Second_Degree posterior probability associated second-degree classification. Unrelated posterior probability associated unrelated classification. BF strength confidence Bayes Factor associated highest posterior probability classification compared 2nd highest.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":null,"dir":"Reference","previous_headings":"","what":"saveSLICES — saveSLICES","title":"saveSLICES — saveSLICES","text":"Plots pairwise diagnostic plots (tibble output callRelatedness), produced plotSLICE, folder. Options include width height output files, units dimensions measured.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"saveSLICES — saveSLICES","text":"","code":"saveSLICES( in_tibble, outFolder = NULL, width = 297, height = 210, units = \"mm\", verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"saveSLICES — saveSLICES","text":"in_tibble tibble output callRelatedness() function. outFolder folder diagnostic plots saved width width output PDFs. height height output PDFs. units units height width output PDFs. verbose Controls printing progress console.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"saveSLICES — saveSLICES","text":"nothing","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"saveSLICES — saveSLICES","text":"","code":"# \\donttest{ saveSLICES(relatedness_example[1:3, ], outFolder = tempdir()) #> Starting pairwise plot creation. #> | | | 0% #> | |=================================== | 50% #> | |======================================================================| 100% #> Completed #> All plots in: /var/folders/2y/pt9dy6bd42b370x_69yj9q8c0000gn/T//RtmphEcqBO/ #> [1] TRUE # }"},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":null,"dir":"Reference","previous_headings":"","what":"sim_geno — sim_geno","title":"sim_geno — sim_geno","text":"Simulated geno file eigenstrat format","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sim_geno — sim_geno","text":"","code":"sim_geno(n_ind, n_snp, filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"sim_geno — sim_geno","text":"n_ind number individuals n_snp number SNPs filename filename export","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"sim_geno — sim_geno","text":"NULL exports file","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"sim_geno — sim_geno","text":"","code":"if (FALSE) { # \\dontrun{ sim_geno(10, 5, \"geno.txt\") } # }"},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":null,"dir":"Reference","previous_headings":"","what":"split line — split_line","title":"split line — split_line","text":"takes line SNP file splits parts.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"split line — split_line","text":"","code":"split_line(x)"},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"split line — split_line","text":"x line SNP file","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"split line — split_line","text":"tibble 6 columns.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"split line — split_line","text":"","code":"split_line(\"1_14.570829090394763 1 0.000000 14 A X\") #> # A tibble: 1 × 6 #> snp chr pos site anc der #> #> 1 1_14.570829090394763 1 0 14 A X split_line(\"rs3094315 1 0.0 752566 G A\") #> # A tibble: 1 × 6 #> snp chr pos site anc der #> #> 1 rs3094315 1 0 752566 G A"},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":null,"dir":"Reference","previous_headings":"","what":"test_degree — test_degree","title":"test_degree — test_degree","text":"Test degree relatedness consistent observed PMR","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"test_degree — test_degree","text":"","code":"test_degree(in_tibble, row, degree, verbose = TRUE)"},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"test_degree — test_degree","text":"in_tibble tibble output callRelatedness() function. row either row number pair name posterior distribution plotted. degree degree relatedness tested. verbose logical (boolean) whether test output printed screen.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"test_degree — test_degree","text":"associated p-value test","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"test_degree — test_degree","text":"","code":"test_degree(relatedness_example, 1, 1) #> Testing H0 : \"Ind1 - Ind2\" are 1st-degree relatives. #> Expected PMR : 0.1635 #> Observed PMR : 0.2042 #> Estimated degree : 2.9826 #> p-value : 2.666909e-05 #> Decision : Reject H0 #> [1] 2.666909e-05"},{"path":[]},{"path":[]},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-103-1","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.3","title":"BREADR 1.0.3","text":"Reviewer JOSS noticed needed later version description due call Matrix package. added later R version requirement.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-102","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.2","title":"BREADR 1.0.2","text":"CRAN release: 2024-09-09 Problem processEigenstrat used bash cut function native linux mac, available Windows. old version still available processEigenstrat_old. Change callRelatedness use function Problem plotLoaf showing legend level missing - fixed.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-101","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.1","title":"BREADR 1.0.1","text":"CRAN release: 2023-04-12 Patch error read files causing miscalculation PMR.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-100","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.0","title":"BREADR 1.0.0","text":"CRAN release: 2023-04-07 version released CRAN.","code":""},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"major-changes-0-0-0-9000","dir":"Changelog","previous_headings":"","what":"Major changes","title":"BREADR 0.0.0.9000","text":"first development version. primary functions. Also set pkgdown website support.","code":""}]
+[{"path":"https://jonotuke.github.io/BREADR/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 BREADR authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://jonotuke.github.io/BREADR/articles/example-pipeline.html","id":"example","dir":"Articles","previous_headings":"","what":"Example","title":"Example pipeline","text":"basic example shows analyse real (anonymised) ancient DNA data set. analysis normally start defining paths three Eigenstrat files, .e., preprocess data using processEigenstrat() function, Since step computationally expensive, include option automatically save output TSV upon completion preprocessing, .e, avoid repeating preprocessing Also included options change minimum distance overlapping sites (filter_length) default 1×105,1\\times 10^5, option include individuals (pop_pattern) certain populations (defined ind file) option remove C->T G->SNPs avoid effects deamination. Note since Eigenstrat files large include, provide pre-processed data set called counts_example product running processEigenstrat() real data (although raw Eigenstrat files can found Github page). now load counts_example tibble. can can estimate degrees relatedness raw counts using callRelatedness() function. Users option change prior probability degree relatedness (class_prior) default uniform prior, define expected PMR (average_relatedness) pair unrelated individuals default sample median, set minimum number overlapping SNPs required pair individuals (filter_n) included analysis default 1. user decides use sample median estimate expected PMR pair unrelated individuals, minimum number overlapping SNPs pair (median_co) can changed default 500. overall picture relatedness individuals can created, displays highest posterior probability degree relatedness pair individuals, indicated colour shape points 95% confidence intervals. dashed horizontal lines indicated expected values degree relatedness. Users can choose remove individuals less user-defined number overlapping SNPs (nsnps_cutoff). large data sets, expected vast majority individuals unrelated, user may wish plot closely related individuals. end, user may choose plot first NN individuals (using input parameter N), sorted PMR value, ascending order. plot assignment “Unrelated” degree relatedness individuals Ind1 Ind2 can produced shows diagnostic information estimated genetic relatedness single pair individuals. left panel, distribution PMR values degree relatedness, given number overlapping SNPs, observed PMR (95% confidence interval) displayed . right panel normalised posterior probabilities degrees relatedness, indicating certainty degree relatedness highest posterior probability chosen. Alternatively can choose row using full pair name instead row number. can test whether observed PMR Ind1 Ind2 consistent 3rd-degree genetic relationship, , degree relatedness 0 10 can investigated. function returns p-value associated binomial test, setting verbose TRUE, diagnostic output test can displayed","code":"ind_path <- \"path/to/eigenstrat/indfile\" snp_path <- \"path/to/eigenstrat/snpfile\" geno_path <- \"path/to/eigenstrat/genofile\" counts_example <- processEigenstrat( indfile = ind_path, snpfile = snp_path, genofile = geno_path ) counts_example <- processEigenstrat( indfile = ind_path, snpfile = snp_path, genofile = geno_path, outfile = \"path_to_save_tsv\" ) library(BREADR) counts_example #> pair nsnps mismatch pmr #> 1 Ind1 - Ind2 1518 310 0.2042161 #> 2 Ind1 - Ind3 9435 2093 0.2218336 #> 3 Ind1 - Ind4 8283 1854 0.2238319 #> 4 Ind1 - Ind5 1336 314 0.2350299 #> 5 Ind1 - Ind6 2242 481 0.2145406 #> 6 Ind2 - Ind3 9119 1988 0.2180064 #> 7 Ind2 - Ind4 7984 1699 0.2128006 #> 8 Ind2 - Ind5 1179 270 0.2290076 #> 9 Ind2 - Ind6 1965 423 0.2152672 #> 10 Ind3 - Ind4 20952 2253 0.1075315 #> 11 Ind3 - Ind5 7994 1703 0.2130348 #> 12 Ind3 - Ind6 10994 2398 0.2181190 #> 13 Ind4 - Ind5 6924 1451 0.2095609 #> 14 Ind4 - Ind6 9745 2141 0.2197024 #> 15 Ind5 - Ind6 1739 383 0.2202415 relatedness_example <- callRelatedness(counts_example) relatedness_example #> # A tibble: 15 × 12 #> row pair relationship pmr sd mismatch nsnps ave_rel Same_Twins #> #> 1 1 Ind1 - In… Unrelated 0.204 0.0103 310 1518 0.218 6.71e- 26 #> 2 2 Ind1 - In… Unrelated 0.222 0.00428 2093 9435 0.218 1.22e-214 #> 3 3 Ind1 - In… Unrelated 0.224 0.00458 1854 8283 0.218 2.00e-194 #> 4 4 Ind1 - In… Unrelated 0.235 0.0116 314 1336 0.218 2.68e- 37 #> 5 5 Ind1 - In… Unrelated 0.215 0.00867 481 2242 0.218 9.82e- 46 #> 6 6 Ind2 - In… Unrelated 0.218 0.00432 1988 9119 0.218 5.06e-195 #> 7 7 Ind2 - In… Unrelated 0.213 0.00458 1699 7984 0.218 4.95e-156 #> 8 8 Ind2 - In… Unrelated 0.229 0.0122 270 1179 0.218 1.80e- 30 #> 9 9 Ind2 - In… Unrelated 0.215 0.00927 423 1965 0.218 1.10e- 40 #> 10 10 Ind3 - In… Same_Twins 0.108 0.00214 2253 20952 0.218 1 e+ 0 #> 11 11 Ind3 - In… Unrelated 0.213 0.00458 1703 7994 0.218 6.83e-157 #> 12 12 Ind3 - In… Unrelated 0.218 0.00394 2398 10994 0.218 2.05e-235 #> 13 13 Ind4 - In… Unrelated 0.210 0.00489 1451 6924 0.218 1.92e-127 #> 14 14 Ind4 - In… Unrelated 0.220 0.00419 2141 9745 0.218 2.95e-214 #> 15 15 Ind5 - In… Unrelated 0.220 0.00994 383 1739 0.218 3.64e- 39 #> # ℹ 3 more variables: First_Degree , Second_Degree , Unrelated plotLOAF(relatedness_example) #> No minimum number of overlapping SNPs given. #> Using default minimum of 500. #> No upper limit on number of pairs to plot given. #> Plotting first 15 pairs. plotSLICE(relatedness_example, row = 1) plotSLICE(relatedness_example, row = \"Ind1 - Ind2\") test_degree(relatedness_example, 1, 3, verbose = TRUE) #> Testing H0 : \"Ind1 - Ind2\" are 3rd-degree relatives. #> Expected PMR : 0.2044 #> Observed PMR : 0.2042 #> Estimated degree : 2.9826 #> p-value : 0.9823 #> Decision : Retain H0 #> [1] 0.9823165"},{"path":"https://jonotuke.github.io/BREADR/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jono Tuke. Author, maintainer. Adam B. Rohrlach. Author. Wolfgang Haak. Author. Divyaratan Popli. Author.","code":""},{"path":"https://jonotuke.github.io/BREADR/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Rohrlach AB, Tuke J, Popli D, Haak W (2023). “BREADR: R Package Bayesian Estimation Genetic Relatedness Low-coverage Genotype Data.” bioRxiv. doi:10.1101/2023.04.17.537144.","code":"@Article{, title = {BREADR: An R Package for the Bayesian Estimation of Genetic Relatedness from Low-coverage Genotype Data}, author = {Adam B. Rohrlach and Jonathan Tuke and Divyaratan Popli and Wolfgang Haak}, journal = {bioRxiv}, year = {2023}, doi = {10.1101/2023.04.17.537144}, }"},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"breadr","dir":"","previous_headings":"","what":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"goal BREADR provide easy--use method estimating degrees relatedness (second degree) extremely low-coverage data. BREADR also allows users quantify visualise level confidence estimated degrees relatedness. method requires Eigenstrat files (ind, geno snp file) begin, allowing user account DNA deamination genotyping data. information can found BREADR website.","code":""},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"install, can use usual can install development version BREADR GitHub : Also ensure BREADR install correctly, suggest installing following packages Matrix, data.table, dplyr, forcats, ggplot2, ggpubr, grDevices, magrittr, MASS, matrixStats, purrr, readr, stringr tibble.","code":"install.packages(\"BREADR\") # install.packages(\"remotes\") remotes::install_github(\"jonotuke/BREADR\")"},{"path":"https://jonotuke.github.io/BREADR/index.html","id":"contributing-to-breadr","dir":"","previous_headings":"","what":"Contributing to BREADR","title":"Estimates Degrees of Relatedness (Up to the Second Degree) for Extreme Low-Coverage Data","text":"Please note BREADR work progress! interested project want know please feel free contact Jono Tuke (simon.tuke@adelaide.edu.au). find bug like see new improved features, please open issue GitHub repository.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":null,"dir":"","previous_headings":"","what":"Summary","title":"Summary","text":"Robust reliable estimates individuals biologically related key source information reconstructing pedigrees. combination contextual data, reconstructed pedigrees can used infer possible kinship practices prehistoric populations. However, standard methods estimate biological relatedness genome sequence data applied low coverage sequence data, common ancient DNA (aDNA) studies. Critically, statistically robust method assessing quantifying confidence classification specific degree relatedness pair individuals, using low coverage genome data, lacking. paper present R-package BREADR (Biological RElatedness Ancient DNA R), leverages -called pairwise mismatch rate, calculated optimally-filtered genome-wide pseudo-haploid sequence data, estimate genetic relatedness second degree, assuming underlying binomial distribution. BREADR also returns posterior probability degree relatedness, identical twins/individual, first-degree, second-degree “unrelated” pairs, allowing researchers quantify report uncertainty, even low-coverage data. show method accurately recovers degrees relatedness sequence data coverage low 0.04X using simulated data (produced Popli et al.[@popli:2023]).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"statement-of-need","dir":"","previous_headings":"","what":"Statement of need","title":"Summary","text":"BREADR R package use ancient DNA studies, studies estimating genetic kinship extremely low-coverage DNA sequence data, forensic sciences. BREADR designed user-friendly software package, using input pseudo-haploid genotype data Eigenstrat format, common aDNA studies, allowing pre-processing quality control researchers.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"state-of-the-field","dir":"","previous_headings":"","what":"State of the Field","title":"Summary","text":"software packages estimating genetic relatedness aDNA sequence data leverage measure pairwise genetic dissimilarity, often calculated pseudo-haploid data, random call sampled site, avoid issue phasing. lcMLkin uses genotype likelihoods estimate identity--descent coefficients (k0k_0, k1k_1 k2k_2), co-ancestry coefficient can calculated, theta=k1/4+k2/2theta = k_{1}/4+k_{2}/2 [@lipatov:2015]. method requires reference panel estimate genotype likelihoods, sites unlinked. method exploratory nature, return hard classifications degrees relatedness, (currently) peer-reviewed. TKGWV2 instead estimates relatedness via method moments estimator Queller Goodnight, denoted r̂ij\\hat{r}_{ij} [@fernandes:2021]. asymmetric estimator assumes inbreeding population sites unlinked [@queller:1989]. Hence, TKGWV2 applied SNP capture data, data populations inbreeding occurred. method returns hard classifications degree relatedness based expected value rˆijrˆij observed value closest . KIN [@popli:2023] ancIBD [@ringbauer:2023] instead use spatial distribution identical--descent segments (IBDs). Like lcMLkin, KIN estimates identity--descent coefficients, using IBDs instead weighted genotype likelihoods, can identify degrees relatedness third degree. Conversely, ancIBD uses imputation increase resolution method seventh-degree. However, additional resolution comes cost requiring relatively high-coverage sequence data, approximately 0.25X whole genome sequencing, compared 0.05X, 0.026X 0.04X KIN, TKGV2 BREADR, respectively. READ READv2 use -called pairwise-mismatch rate (PMR) estimate proportion overlapping sites two individuals non-matching genotype calls [@monroy:2018; @alaccamli:2024]. PMR first introduced overcome limitations low-coverage aDNA, however, publication Kennett et al. include hard-classification method [@kennett:2017]. Kennett et al. used available overlapping sites estimate PMR, READ uses 1MB windowed approach sample distribution PMR, also account effects linkage disequilibrium (LD), allowing automated hard classification degrees relatedness. READv2, however, uses genome-wide estimate place windowed approach READ. Like READ READv2, BREARD estimates PMR, instead thins data reduce effects LD. PMR thinned data can now reasonably expected follow binomial distribution, theoretical expectations PMR derived compared observed value. , statistically rigorous measures uncertainty derived, informative diagnostic plots degree related pairs individuals can produced. Finally, although BREADR classifies degrees related second-degree, also allow tests degree tenth-degree formally tested considering potential pedigree reconstructions.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"current-applications","dir":"","previous_headings":"","what":"Current Applications","title":"Summary","text":"BREADR produces ready--publication results diagnostic plots, already seen use number publications [@rivollat:2023; @penske:2024; @gretzinger:2024; @ghalichi:2024; @pilli:2024].","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"estimating-degrees-of-relatedness","dir":"","previous_headings":"","what":"Estimating Degrees of Relatedness","title":"Summary","text":"Consider two individuals, ii jj, NijN_{ij} overlapping sites (without missingness), sites thinned (default value 1×1051\\times 10^{5}) effects LD reduced. look number pseudo-haploid genotype calls match, denoted XijX_{ij}. Hence Xij∼Bin(Nij,pij)X_{ij} \\sim \\text{Bin}(N_{ij} , p_{ij}), maximum likelihood estimator pijp_{ij} p̂ij=Xij/Nij\\hat{p}_{ij} = X_{ij} /N_{ij}. PMRs calculated, must account background relatedness, can thought expected PMR pair unrelated individuals, differ populations sequencing types (capture versus shotgun sequencing). Many choices exist value, assuming sampled dataset made mostly unrelated pairs (second degree), median PMR, denoted p‾\\bar{p} reliable estimate [@monroy:2018]. However, also allow p‾\\bar{p} user-supplied parameter, may known previous studies, can varied sensitivity analyses. Borrowing insights READ, now define expected mean PMR relationship degree k=0,1,2k = 0, 1, 2 pk=p‾(1−1k+1). p_k = \\bar{p}\\left(1 - \\frac{1}{k+1} \\right). Hence, assume degree relatedness individuals ii jj truly kkth degree, Xij∼Bin(Nij,pk)X_{ij} \\sim \\text{Bin}(N_{ij} , p_{k}). Hence, likelihood function relatedness degree kk, individuals ii jj, L(Xij|K=k,Nij)=(NijXij)pkXij(1−pk)Nij−Xij. L\\left( X_{ij} \\big| K=k, N_{ij} \\right) = \\binom{N_{ij}}{X_{ij}} p_k^{X_{ij}}(1-p_k)^{N_{ij}-X_{ij}}. let k=∞k = \\infty case two individuals “unrelated” (.e. second-degree related), also P(Xij|K≥3,Nij)=∑k=3∞P(K=k|Xij,Nij)P(K=k)=(NijXij)pkXij(1−pk)Nij−Xijfλ(k), \\begin{aligned} P\\left( X_{ij} \\big| K \\geq 3, N_{ij}\\right) &= \\sum_{k=3}^{\\infty} P\\left(K=k \\big| X_{ij},N_{ij} \\right) P\\left( K=k \\right)\\\\ &= \\binom{N_{ij}}{X_{ij}} p_k^{X_{ij}}(1-p_k)^{N_{ij}-X_{ij}} f_{\\lambda}(k), \\end{aligned} fλ(k)f_{\\lambda}(k) 3-truncated Poisson distribution form fλ(k)=1∑ℓ=02λℓe−λℓ!(λke−λk!). f_{\\lambda}(k) = \\frac{1}{\\sum_{\\ell=0}^{2} \\frac{\\lambda^\\ell e^{-\\lambda}}{\\ell!}}\\left( \\frac{\\lambda^ke^{-\\lambda}}{k!} \\right). choose 3-truncated Poisson distribution λ=10\\lambda=10 represents well unlikelihood individuals always closely related second-degree related, also captures diminishing probabilities distantly-related due finite size populations. possible calculate normalised posterior probabilities individuals ii jj kkth degree related P(K=k|Xij,Nij)=L(Xij|K=k,Nij)P(K=k)[∑ℓ=02L(Xij|K=ℓ,Nij)]+L(Xij|K≥3,Nij) P\\left( K=k \\big| X_{ij}, N_{ij} \\right) = \\frac{L\\left( X_ij | K=k,N_{ij} \\right)P\\left(K=k\\right)}{\\left[ \\sum_{\\ell=0}^{2} L\\left( X_{ij} \\big| K = \\ell, N_{ij} \\right) \\right] + L\\left(X_{ij} \\big| K\\geq 3, N_{ij} \\right)} denominator equals one, construction. Hence, P(K=k|Xij,Nij)=L(Xij|K=k,Nij)P(K=k). P\\left( K=k \\big| X_{ij}, N_{ij} \\right) = L\\left( X_ij | K=k,N_{ij} \\right)P\\left(K=k\\right). However, prior probabilities degrees relatedness unclear, vary study study, given uninformative uniform distribution default. Since user inputs, thought carefully, can explored via sensitivity analyses explore prior probabilities driving relatedness classifications. Finally, include third-degree higher relationships possible classifications, include method statistical test retaining rejecting possibility kth-degree relationship, 0≤k≤100 \\leq k \\leq 10. , perform binomial test observed number mismatches XijX_{ij}, expected probability pairwise mismatches, defined Equation 1, returning two-sided p-value estimated (non-integer) degree relatedness, found setting pk=pijp_k = p_{ij} k=k̂k = \\hat{k} Equation 2, solving kk, .e., k̂=ln(1−pij/p̂)ln(1/2), \\hat{k} = \\frac{ln(1-p_{ij}/\\hat{p})}{ln(1/2)}, pij devtools::install_github(\"jonotuke/BREADR\") > require(BREADR)"},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"preprocessing-the-eigenstrat-data-for-analysis","dir":"","previous_headings":"","what":"Preprocessing the Eigenstrat data for analysis","title":"Summary","text":"downstream functions BREADR package require preprocessing three standard Eigenstrat files: -called ind, snp geno files. first step, take list sites genome interest, chromosome name (integer) site position, pseudo-haploid genotype calls individuals (interest). , pair, take sites overlapping, non-missing calls, least user-defined number (default 5×1055\\times 10^5) positions apart (within chromosomes). Using site positions, record number filtered, overlapping sites, well number mismatches per pair. generate required genetic pairwise comparisons individuals, users apply processEigenstrat() function. function requires three input string parameters: paths three Eigenstrat files. stage pre-processing, users four additional parameters can set, reset downstream. First, filter_length parameter (default 1×1051\\times10^{5}) allows user define minimum number positions sites can considered. removing sites close one another, assumption independence site-wise comparison best attained lowering removing effects linkage disequilibrium. Second, pop_pattern parameter (default exclude nothing) allows user define set population names subset individuals compared. Third, filter_deam parameter (default ) filters C T G SNPs possible list sites potential effects post-mortem deamination accounted genotyping process. Last, since pre-processing computationally expensive step analysis, outfile parameter (default ) path-string allows user automatically save post-processed data TSV file. resulting (see ) tibble four columns: names samples/individuals compared (pair), number overlapping SNPs (nsnps) per pair, number overlapping sites pair match (mismatch) pairwise-mismatch rate (pmr).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"analysing-the-post-processed-data","dir":"","previous_headings":"","what":"Analysing the post-processed data","title":"Summary","text":"Following pre-processing step, callRelatedness() function calls relationship Same_Twins, First_Degree , Second_Degree Unrelated, additional information, output processEigenstrat() function. Additional parameters can set allow user customise analysis. class_prior parameter (default Uniform) defines prior probabilities relatedness class. average_relatedness parameter defines background relatedness estimated via (default median filtered estimates). can either: () estimated directly median PMR data, (b) single value (useful sensitivity analyses user uncertain), (c) vector values equal number rows input tibble (can useful different populations different background relatedness levels). median_co parameter (default 500) defines minimum number overlapping SNPs pair individuals must share PMR used estimating median PMR, user elected use median PMR. Finally, filter_n parameter (default 1) used simply remove pairs individuals analysis share fewer overlapping SNPs value. resulting tibble (see Figure ) additional 9 columns: row number (pair useful additional functions, highest-posterior genetic relationship (relationship), standard error estimate PMR (sd), median used calculations (med), normalised posterior probabilities four relatedness categories (Same_Twins, First_Degree, Second_Degree Unrelated)).","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"visually-interpreting-results","dir":"","previous_headings":"","what":"Visually interpreting results","title":"Summary","text":"posterior probabilities degrees relatedness calculated, results can visualised two ways. First, overall picture relatedness can obtained using plotLOAF() function plots first NN (default N=50N = 50) pairs individuals, sorted ascending PMR value (see ). shape colour point estimates PMR indicate highest posterior degree relatedness assigned pair, associated 95% confidence interval represented vertical error bars. dashed coloured lines indicated expected PMR degree relatedness (given background relatedness). Note nn individuals, n(n−1)2\\frac{n(n-1)}{2} pairs individuals, grows factorially nn gets larger. Hence, plotting pairs individuals infeasible many cases, since majority pairs likely unrelated, users may wish plot closely related pairs individuals ease visualisation. can observe two genetically identical individuals, also get scale number first- second-degree related individuals. Second, diagnostic plot analysis single pair individuals can obtained using callSLICE() function (see ). default, function produces two panel plot. Panel displays distribution PMR degrees relatedness (given number overlapping sites), well observed PMR (95% confidence interval) plotted densities. Panel B displays normalised posterior probabilities possible degree relatedness, visually numerically. user can choose return just one plots, . , misclassify true second-degree relationship unrelated, however, posterior probabilities lead researcher consider second-degree relationship plausible. Finally, savesSLICES() function allows user save possible pairwise diagnosticplots (produced plotSLICE()) PDFs output path.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"testing-for-departure-from-refined-degrees-of-relatedness","dir":"","previous_headings":"","what":"Testing for departure from refined degrees of relatedness","title":"Summary","text":"resolution BREADR method allows degrees relatedness second degree assigned. However, can principle test see observed PMR consistent degree relatedness using simple binomial test. test_degree() function allows user test degree relatedness tenth degree. printResults option set TRUE, information binomial test displayed (see Figure 6). null hypothesis, expected observed PMR, estimate degree relatedness, associated p-value decision (significance level α=0.05\\alpha = 0.05) given. Figure shows case able correctly identify third-degree relationship reasonable Ind1 Ind12.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"conclusion","dir":"","previous_headings":"","what":"Conclusion","title":"Summary","text":"article describes usage functionality R package BREADR. Based well-understood metric PMR, BREADR can infer pairwise genetic relatedness individuals second degree, use binomial tests consistency PMRs higher degrees relatedness. BREADR can calculate Bayesian posterior probabilities classification genetic relationships even low-coverage, pseudohaploid sequence data, Eigenstrat data format, common aDNA studies. Additionally, BREADR provides functionality plotting overall genetic relatedness, well single plots specific pairs need exploring strength evidence alternative potential genetic relationships required. Finally, allowing researchers explore possibility potential levels genetic relatedness statistically rigorous framework, quality control analyses pedigree reconstructions can performed flexibility. concede BREADR limitations method relies estimating pairwise-mismatch: namely estimating average pairwise-mismatch rate two unrelated individuals difficult (assess), likely constant large pedigrees, across populations. also identify need consider empirical variability expected pairwise-mismatch rate k-degree relatives can observed large modern datasets. However, encourage researchers consider limitations using BREADR, well use multiple methods estimating relatedness. usefulness researchers able assign statistical confidence every estimated degree relatedness, even cases coverage extremely low, critical reconstructing pedigree. also shown BREADR misclassifies genetic relationships, due true closer genetic relationship (third-degree genetic relationships misclassified unrelated). easy--use R-implementation method makes BREADR attractive, statistically rigorous tool researchers archaeogenetics employ.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"data-description","dir":"","previous_headings":"","what":"Data Description","title":"Summary","text":"genetic data real, anonymised, ancient DNA data produced house Max Planck Institute Evolutionary Anthropology, Leipzig, Germany. data comes site dated 2350 BCE. data produced using Illumina sequencing platform, adapter trimming, reads aligned human reference genome GRCh37 using BWA[@li2009fast] implemented EAGER[@peltzer2016eager]. Sequence reads filtered minimum sequence length 35 mapping quality least 25. Data genotyped using pileupCaller[https://github.com/stschiff/sequenceTools/tree/master/src/SequenceTools] using random pseudohaploid call position 1240k capture assay[@mathieson2015genome]. processed genotype data can found : https://github.com/jonotuke/BREADR/tree/master/data-raw/.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"author-contributions","dir":"","previous_headings":"","what":"Author Contributions","title":"Summary","text":"Adam B. Rohrlach conceived, designed implemented method, wrote paper, prepared figures, performed computation work, reviewed drafts paper edited submissions. Jonathan Tuke conceived method, created submitted package CRAN, reviewed drafts paper edited submissions. Divya Ratan Popli created implemented computations benchmarking accuracy performance method, reviewed drafts paper edited submissions. Wolfgang Haak conceived method, reviewed drafts paper edited submissions.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"acknowledgements","dir":"","previous_headings":"","what":"Acknowledgements","title":"Summary","text":"thank Harald Ringbauer, Nigel Bean Vincent Braunack-Mayer important enlightening discussions regarding manuscript.","code":""},{"path":"https://jonotuke.github.io/BREADR/paper.html","id":"funding","dir":"","previous_headings":"","what":"Funding","title":"Summary","text":"research financed Max Planck Society European Research Council European Union’s Horizon 2020 research innovation programme (grant agreement numbers 771234-PALEoRIDER, W.H.; 101141408-ROAMANCE, W.H.).","code":""},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":null,"dir":"Reference","previous_headings":"","what":"callRelatedness — callRelatedness","title":"callRelatedness — callRelatedness","text":"function takes PMR observations, (given prior distribution degrees relatedness) returns posterior probabilities pairs individuals () individual/twins, (b) first-degree related, (c) second-degree related (d) \"unrelated\" (third-degree higher). highest posterior probability degree relatedness also returned hard classification. Options include setting background relatedness (using sample median), minimum number overlapping SNPs one uses sample median background relatedness, minimum number overlapping SNPs including pairs analysis.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"callRelatedness — callRelatedness","text":"","code":"callRelatedness( pmr_tibble, class_prior = rep(0.25, 4), average_relatedness = NULL, median_co = 500, filter_n = 1 )"},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"callRelatedness — callRelatedness","text":"pmr_tibble tibble output processEigenstrat function. class_prior prior probabilities /twin, 1st-degree, 2nd-degree, unrelated, respectively. average_relatedness single numeric value, vector numeric values, use average background relatedness. NULL, sample median used. median_co average_relatedness left NULL, minimum cutoff number overlapping snps included median calculation 500. filter_n minimum number overlapping SNPs pairs removed entire analysis. NULL, default 1.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"callRelatedness — callRelatedness","text":"results_tibble: tibble containing 13 columns: row: row number pair: pair individuals compared. relationship: highest posterior probability estimate degree relatedness. pmr: pairwise mismatch rate (mismatch/nsnps). sd: estimated standard deviation pmr. mismatch: number sites match pair. nsnps: number overlapping snps compared pair. ave_re;: value background relatedness used normalisation. Same_Twins: posterior probability associated individual/twins classification. First_Degree: posterior probability associated first-degree classification. Second_Degree: posterior probability associated second-degree classification. Unrelated: posterior probability associated unrelated classification. BF: strength confidence Bayes Factor associated highest posterior probability classification compared 2nd highest. (longer included)","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/callRelatedness.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"callRelatedness — callRelatedness","text":"","code":"callRelatedness(counts_example, class_prior=rep(0.25,4), average_relatedness=NULL, median_co=5e2,filter_n=1 ) #> # A tibble: 15 × 12 #> row pair relationship pmr sd mismatch nsnps ave_rel Same_Twins #> #> 1 1 Ind1 - In… Unrelated 0.204 0.0103 310 1518 0.218 6.71e- 26 #> 2 2 Ind1 - In… Unrelated 0.222 0.00428 2093 9435 0.218 1.22e-214 #> 3 3 Ind1 - In… Unrelated 0.224 0.00458 1854 8283 0.218 2.00e-194 #> 4 4 Ind1 - In… Unrelated 0.235 0.0116 314 1336 0.218 2.68e- 37 #> 5 5 Ind1 - In… Unrelated 0.215 0.00867 481 2242 0.218 9.82e- 46 #> 6 6 Ind2 - In… Unrelated 0.218 0.00432 1988 9119 0.218 5.06e-195 #> 7 7 Ind2 - In… Unrelated 0.213 0.00458 1699 7984 0.218 4.95e-156 #> 8 8 Ind2 - In… Unrelated 0.229 0.0122 270 1179 0.218 1.80e- 30 #> 9 9 Ind2 - In… Unrelated 0.215 0.00927 423 1965 0.218 1.10e- 40 #> 10 10 Ind3 - In… Same_Twins 0.108 0.00214 2253 20952 0.218 1 e+ 0 #> 11 11 Ind3 - In… Unrelated 0.213 0.00458 1703 7994 0.218 6.83e-157 #> 12 12 Ind3 - In… Unrelated 0.218 0.00394 2398 10994 0.218 2.05e-235 #> 13 13 Ind4 - In… Unrelated 0.210 0.00489 1451 6924 0.218 1.92e-127 #> 14 14 Ind4 - In… Unrelated 0.220 0.00419 2141 9745 0.218 2.95e-214 #> 15 15 Ind5 - In… Unrelated 0.220 0.00994 383 1739 0.218 3.64e- 39 #> # ℹ 3 more variables: First_Degree , Second_Degree , Unrelated "},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":null,"dir":"Reference","previous_headings":"","what":"counts_example — counts_example","title":"counts_example — counts_example","text":"example tibble made processEigenstrat().","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"counts_example — counts_example","text":"","code":"counts_example"},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/counts_example.html","id":"counts-example","dir":"Reference","previous_headings":"","what":"counts_example","title":"counts_example — counts_example","text":"data frame 15 rows 4 columns: pair pair individuals compared nsnps number overlapping snps compared pair. mismatch number sites match pair. pmr pairwise mismatch rate (mismatch/nsnps).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":null,"dir":"Reference","previous_headings":"","what":"get column — get_column_new","title":"get column — get_column_new","text":"get column","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get column — get_column_new","text":"","code":"get_column_new(genofile, col = 1)"},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get column — get_column_new","text":"genofile genofile col column return","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/get_column_new.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get column — get_column_new","text":"column numbers","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":null,"dir":"Reference","previous_headings":"","what":"plotLOAF — plotLOAF","title":"plotLOAF — plotLOAF","text":"Plots (sorted increasing value) observed PMR values maximum posterior probability classifications represented colour shape. Options include cut minimum number overlapping SNPs, max number pairs plot x-axis font size.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plotLOAF — plotLOAF","text":"","code":"plotLOAF(in_tibble, nsnps_cutoff = NULL, N = NULL, fntsize = 7, verbose = TRUE)"},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plotLOAF — plotLOAF","text":"in_tibble tibble output callRelatedness() function. nsnps_cutoff minimum number overlapping SNPs pairs removed plot. NULL, default 500. N number (sorted increasing PMR) pairs plot. Avoids plotting pairs (many unrelated). fntsize fontsize x-axis names. verbose TRUE, information plotting process sent console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"plotLOAF — plotLOAF","text":"ggplot object","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotLOAF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plotLOAF — plotLOAF","text":"","code":"relatedness_example #> # A tibble: 15 × 12 #> row pair relationship pmr sd mismatch nsnps ave_rel Same_Twins #> #> 1 1 Ind1 - In… Unrelated 0.204 0.0103 310 1518 0.218 6.71e- 26 #> 2 2 Ind1 - In… Unrelated 0.222 0.00428 2093 9435 0.218 1.22e-214 #> 3 3 Ind1 - In… Unrelated 0.224 0.00458 1854 8283 0.218 2.00e-194 #> 4 4 Ind1 - In… Unrelated 0.235 0.0116 314 1336 0.218 2.68e- 37 #> 5 5 Ind1 - In… Unrelated 0.215 0.00867 481 2242 0.218 9.82e- 46 #> 6 6 Ind2 - In… Unrelated 0.218 0.00432 1988 9119 0.218 5.06e-195 #> 7 7 Ind2 - In… Unrelated 0.213 0.00458 1699 7984 0.218 4.95e-156 #> 8 8 Ind2 - In… Unrelated 0.229 0.0122 270 1179 0.218 1.80e- 30 #> 9 9 Ind2 - In… Unrelated 0.215 0.00927 423 1965 0.218 1.10e- 40 #> 10 10 Ind3 - In… Same_Twins 0.108 0.00214 2253 20952 0.218 1 e+ 0 #> 11 11 Ind3 - In… Unrelated 0.213 0.00458 1703 7994 0.218 6.83e-157 #> 12 12 Ind3 - In… Unrelated 0.218 0.00394 2398 10994 0.218 2.05e-235 #> 13 13 Ind4 - In… Unrelated 0.210 0.00489 1451 6924 0.218 1.92e-127 #> 14 14 Ind4 - In… Unrelated 0.220 0.00419 2141 9745 0.218 2.95e-214 #> 15 15 Ind5 - In… Unrelated 0.220 0.00994 383 1739 0.218 3.64e- 39 #> # ℹ 3 more variables: First_Degree , Second_Degree , Unrelated plotLOAF(relatedness_example) #> No minimum number of overlapping SNPs given. #> Using default minimum of 500. #> No upper limit on number of pairs to plot given. #> Plotting first 15 pairs."},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":null,"dir":"Reference","previous_headings":"","what":"plotSLICE — plotSLICE","title":"plotSLICE — plotSLICE","text":"function plotting diagnostic information classifying specific pair (defined row number pair name) individuals. Output includes PDFs degree relatedness (given number overlapping SNPs) panel , normalised posterior probabilities possible degree relatedness.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"plotSLICE — plotSLICE","text":"","code":"plotSLICE( in_tibble, row, title = NULL, class_prior = rep(1/4, 4), showPlot = TRUE, which_plot = 0, labels = NULL )"},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"plotSLICE — plotSLICE","text":"in_tibble tibble output callRelatedness() function. row either row number pair name posterior distribution plotted. title optional title plot. NULL, pair user-defined row used. class_prior prior probabilities /twin, 1st-degree, 2nd-degree, unrelated, respectively. showPlot TRUE, display plot. FALSE, just pass plot variable. which_plot 1, returns just plot posterior distributions, 2 returns just normalised posterior values. Anything else returns plots. labels length two character vector labels plots. Default labels.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"plotSLICE — plotSLICE","text":"two-panel diagnostic ggplot object","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/plotSLICE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"plotSLICE — plotSLICE","text":"","code":"plotSLICE(relatedness_example, row = 1)"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":null,"dir":"Reference","previous_headings":"","what":"process Eigenstrat data - alternative version — processEigenstrat","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"function takes paths eigenstrat trio (ind, snp geno file) returns pairwise mismatch rate pairs thinned set SNPs. Options include choosing thinning parameter, subsetting population names, filtering SNPs deamination possible.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"","code":"processEigenstrat( indfile, genofile, snpfile, filter_length = NULL, pop_pattern = NULL, filter_deam = FALSE, outfile = NULL, chromosomes = NULL, verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"indfile path eigenstrat ind file genofile path eigenstrat geno file. snpfile path eigenstrat snp file. filter_length minimum distance sites compared (reduce effect LD). pop_pattern character vector population names filter ind file populations compared. filter_deam TRUE/FALSE C->T G->sites ignored. outfile (OPTIONAL) path filename can save output function TSV, NULL, back saved. outfile, tibble returned. chromosomes chromosome filter data . verbose controls printing messages console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"out_tibble: tibble containing four columns:","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"process Eigenstrat data - alternative version — processEigenstrat","text":"","code":"# Use internal files to the package as an example indfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") genofile <- system.file(\"extdata\", \"example.geno.txt\", package = \"BREADR\") snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") processEigenstrat( indfile, genofile, snpfile, filter_length=1e5, pop_pattern=NULL, filter_deam=FALSE ) #> Reading in SNP data. #> Analysing chromosomes: #> 1 #> Starting to read in genotype data. #> | | | 0% | |============== | 20% | |============================ | 40% | |========================================== | 60% | |======================================================== | 80% | |======================================================================| 100% Complete. #> #> Starting to compare genotypes and calculate PMR. #> | | | 0% | |===== | 7% | |========== | 14% | |=============== | 21% | |==================== | 29% | |========================= | 36% | |============================== | 43% | |=================================== | 50% | |======================================== | 57% | |============================================= | 64% | |================================================== | 71% | |======================================================= | 79% | |============================================================ | 86% | |================================================================= | 93% | |======================================================================| 100% #> Complete. #> #> # A tibble: 15 × 4 #> pair nsnps mismatch pmr #> #> 1 Ind1 - Ind2 2 1 0.5 #> 2 Ind1 - Ind3 14 2 0.143 #> 3 Ind1 - Ind4 14 3 0.214 #> 4 Ind1 - Ind5 1 0 0 #> 5 Ind1 - Ind6 4 0 0 #> 6 Ind2 - Ind3 13 3 0.231 #> 7 Ind2 - Ind4 11 2 0.182 #> 8 Ind2 - Ind5 0 0 NA #> 9 Ind2 - Ind6 4 2 0.5 #> 10 Ind3 - Ind4 35 5 0.143 #> 11 Ind3 - Ind5 10 0 0 #> 12 Ind3 - Ind6 19 2 0.105 #> 13 Ind4 - Ind5 10 1 0.1 #> 14 Ind4 - Ind6 20 7 0.35 #> 15 Ind5 - Ind6 2 1 0.5"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":null,"dir":"Reference","previous_headings":"","what":"process Eigenstrat data — processEigenstrat_old","title":"process Eigenstrat data — processEigenstrat_old","text":"function takes paths eigenstrat trio (ind, snp geno file) returns pairwise mismatch rate pairs thinned set SNPs. Options include choosing thinning parameter, subsetting population names, filtering SNPs deamination possible.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"process Eigenstrat data — processEigenstrat_old","text":"","code":"processEigenstrat_old( indfile, genofile, snpfile, filter_length = NULL, pop_pattern = NULL, filter_deam = FALSE, outfile = NULL, chromosomes = NULL, verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"process Eigenstrat data — processEigenstrat_old","text":"indfile path eigenstrat ind file genofile path eigenstrat geno file. snpfile path eigenstrat snp file. filter_length minimum distance sites compared (reduce effect LD). pop_pattern character vector population names filter ind file populations compared. filter_deam TRUE/FALSE C->T G->sites ignored. outfile (OPTIONAL) path filename can save output function TSV, NULL, back saved. outfile, tibble returned. chromosomes chromosome filter data . verbose controls printing messages console","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"process Eigenstrat data — processEigenstrat_old","text":"out_tibble: tibble containing four columns:","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/processEigenstrat_old.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"process Eigenstrat data — processEigenstrat_old","text":"","code":"# Use internal files to the package as an example indfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") genofile <- system.file(\"extdata\", \"example.geno.txt\", package = \"BREADR\") snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") processEigenstrat_old( indfile, genofile, snpfile, filter_length=1e5, pop_pattern=NULL, filter_deam=FALSE ) #> Reading in SNP data. #> Analysing chromosomes: #> 1 #> Starting to read in genotype data. #> | | | 0% | |============== | 20% | |============================ | 40% | |========================================== | 60% | |======================================================== | 80% | |======================================================================| 100% Complete. #> #> Starting to compare genotypes and calculate PMR. #> | | | 0% | |===== | 7% | |========== | 14% | |=============== | 21% | |==================== | 29% | |========================= | 36% | |============================== | 43% | |=================================== | 50% | |======================================== | 57% | |============================================= | 64% | |================================================== | 71% | |======================================================= | 79% | |============================================================ | 86% | |================================================================= | 93% | |======================================================================| 100% #> Complete. #> #> # A tibble: 15 × 4 #> pair nsnps mismatch pmr #> #> 1 Ind1 - Ind2 2 1 0.5 #> 2 Ind1 - Ind3 14 2 0.143 #> 3 Ind1 - Ind4 14 3 0.214 #> 4 Ind1 - Ind5 1 0 0 #> 5 Ind1 - Ind6 4 0 0 #> 6 Ind2 - Ind3 13 3 0.231 #> 7 Ind2 - Ind4 11 2 0.182 #> 8 Ind2 - Ind5 0 0 NA #> 9 Ind2 - Ind6 4 2 0.5 #> 10 Ind3 - Ind4 35 5 0.143 #> 11 Ind3 - Ind5 10 0 0 #> 12 Ind3 - Ind6 19 2 0.105 #> 13 Ind4 - Ind5 10 1 0.1 #> 14 Ind4 - Ind6 20 7 0.35 #> 15 Ind5 - Ind6 2 1 0.5"},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":null,"dir":"Reference","previous_headings":"","what":"read_ind — read_ind","title":"read_ind — read_ind","text":"read_ind","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_ind — read_ind","text":"","code":"read_ind(filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_ind — read_ind","text":"filename IND text file.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_ind — read_ind","text":"tibble column headings: ind (CHR), sex (CHR), pop (CHR)","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_ind.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_ind — read_ind","text":"","code":"ind_snpfile <- system.file(\"extdata\", \"example.ind.txt\", package = \"BREADR\") read_ind(ind_snpfile) #> # A tibble: 6 × 3 #> ind sex pop #> #> 1 Ind1 U Pop1 #> 2 Ind2 U Pop1 #> 3 Ind3 U Pop1 #> 4 Ind4 U Pop1 #> 5 Ind5 U Pop2 #> 6 Ind6 U Pop2"},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":null,"dir":"Reference","previous_headings":"","what":"read_snp — read_snp","title":"read_snp — read_snp","text":"read_snp","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"read_snp — read_snp","text":"","code":"read_snp(filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"read_snp — read_snp","text":"filename SNP text file.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"read_snp — read_snp","text":"tibble column headings: snp (CHR), chr (DBL), pos (DBL), site (DBL), anc (CHR), der (CHR).","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/read_snp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"read_snp — read_snp","text":"","code":"std_snpfile <- system.file(\"extdata\", \"example.snp.txt\", package = \"BREADR\") broken_snpfile <- system.file(\"extdata\", \"broken.snp.txt\", package = \"BREADR\") read_snp(std_snpfile) #> # A tibble: 1,000 × 6 #> snp chr pos site anc der #> #> 1 rs3094315 1 0 752566 G A #> 2 rs7419119 1 0 842013 T G #> 3 rs13302957 1 0 891021 G A #> 4 rs6696609 1 0 903426 C T #> 5 rs8997 1 0 949654 A G #> 6 rs9442372 1 0 1018704 A G #> 7 rs147606383 1 0 1045331 G A #> 8 rs4970405 1 0 1048955 A G #> 9 rs11807848 1 0 1061166 T C #> 10 rs4970421 1 0 1108637 G A #> # ℹ 990 more rows read_snp(broken_snpfile) #> # A tibble: 100 × 6 #> snp chr pos site anc der #> #> 1 1_14.570829090394763 1 0 14 A X #> 2 1_31.762980536196316 1 0 31 X X #> 3 1_58.40133360272569 1 0.000001 58 A X #> 4 1_146.13704767420893 1 0.000001 146 X X #> 5 1_350.25559508884965 1 0.000003 350 A X #> 6 1_373.54266589096653 1 0.000004 373 X X #> 7 1_376.1963053157634 1 0.000004 376 X X #> 8 1_402.00713564772997 1 0.000004 402 A X #> 9 1_473.15441796651334 1 0.000005 473 A X #> 10 1_608.1074747673024 1 0.000006 608 X X #> # ℹ 90 more rows"},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":null,"dir":"Reference","previous_headings":"","what":"relatedness_example — relatedness_example","title":"relatedness_example — relatedness_example","text":"example tibble made callRelatedness()","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"relatedness_example — relatedness_example","text":"","code":"relatedness_example"},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/reference/relatedness_example.html","id":"relatedness-example","dir":"Reference","previous_headings":"","what":"relatedness_example","title":"relatedness_example — relatedness_example","text":"data frame 15 rows 13 columns: row row number pair pair individuals compared. relationship highest posterior probability estimate degree relatedness. pmr pairwise mismatch rate (mismatch/nsnps). sd estimated standard deviation pmr. mismatch number sites match pair. nsnps number overlapping snps compared pair. ave_re value background relatedness used normalisation. Same_Twins posterior probability associated individual/twins classification. First_Degree posterior probability associated first-degree classification. Second_Degree posterior probability associated second-degree classification. Unrelated posterior probability associated unrelated classification. BF strength confidence Bayes Factor associated highest posterior probability classification compared 2nd highest.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":null,"dir":"Reference","previous_headings":"","what":"saveSLICES — saveSLICES","title":"saveSLICES — saveSLICES","text":"Plots pairwise diagnostic plots (tibble output callRelatedness), produced plotSLICE, folder. Options include width height output files, units dimensions measured.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"saveSLICES — saveSLICES","text":"","code":"saveSLICES( in_tibble, outFolder = NULL, width = 297, height = 210, units = \"mm\", verbose = TRUE )"},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"saveSLICES — saveSLICES","text":"in_tibble tibble output callRelatedness() function. outFolder folder diagnostic plots saved width width output PDFs. height height output PDFs. units units height width output PDFs. verbose Controls printing progress console.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"saveSLICES — saveSLICES","text":"nothing","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/saveSLICES.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"saveSLICES — saveSLICES","text":"","code":"# \\donttest{ saveSLICES(relatedness_example[1:3, ], outFolder = tempdir()) #> Starting pairwise plot creation. #> | | | 0% #> | |=================================== | 50% #> | |======================================================================| 100% #> Completed #> All plots in: /var/folders/8v/h3b6ltws5mx62f7d2mr3mzwr0000gn/T//RtmpKCZJqx/ #> [1] TRUE # }"},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":null,"dir":"Reference","previous_headings":"","what":"sim_geno — sim_geno","title":"sim_geno — sim_geno","text":"Simulated geno file eigenstrat format","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"sim_geno — sim_geno","text":"","code":"sim_geno(n_ind, n_snp, filename)"},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"sim_geno — sim_geno","text":"n_ind number individuals n_snp number SNPs filename filename export","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"sim_geno — sim_geno","text":"NULL exports file","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/sim_geno.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"sim_geno — sim_geno","text":"","code":"if (FALSE) { # \\dontrun{ sim_geno(10, 5, \"geno.txt\") } # }"},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":null,"dir":"Reference","previous_headings":"","what":"split line — split_line","title":"split line — split_line","text":"takes line SNP file splits parts.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"split line — split_line","text":"","code":"split_line(x)"},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"split line — split_line","text":"x line SNP file","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"split line — split_line","text":"tibble 6 columns.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/split_line.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"split line — split_line","text":"","code":"split_line(\"1_14.570829090394763 1 0.000000 14 A X\") #> # A tibble: 1 × 6 #> snp chr pos site anc der #> #> 1 1_14.570829090394763 1 0 14 A X split_line(\"rs3094315 1 0.0 752566 G A\") #> # A tibble: 1 × 6 #> snp chr pos site anc der #> #> 1 rs3094315 1 0 752566 G A"},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":null,"dir":"Reference","previous_headings":"","what":"test_degree — test_degree","title":"test_degree — test_degree","text":"Test degree relatedness consistent observed PMR","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"test_degree — test_degree","text":"","code":"test_degree(in_tibble, row, degree, verbose = TRUE)"},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"test_degree — test_degree","text":"in_tibble tibble output callRelatedness() function. row either row number pair name posterior distribution plotted. degree degree relatedness tested. verbose logical (boolean) whether test output printed screen.","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"test_degree — test_degree","text":"associated p-value test","code":""},{"path":"https://jonotuke.github.io/BREADR/reference/test_degree.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"test_degree — test_degree","text":"","code":"test_degree(relatedness_example, 1, 1) #> Testing H0 : \"Ind1 - Ind2\" are 1st-degree relatives. #> Expected PMR : 0.1635 #> Observed PMR : 0.2042 #> Estimated degree : 2.9826 #> p-value : 2.666909e-05 #> Decision : Reject H0 #> [1] 2.666909e-05"},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-103","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.3","title":"BREADR 1.0.3","text":"CRAN release: 2025-04-14","code":""},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-103-1","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.3","title":"BREADR 1.0.3","text":"CRAN release: 2025-04-14 Reviewer JOSS noticed needed later version description due call Matrix package. added later R version requirement.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-102","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.2","title":"BREADR 1.0.2","text":"CRAN release: 2024-09-09 Problem processEigenstrat used bash cut function native linux mac, available Windows. old version still available processEigenstrat_old. Change callRelatedness use function Problem plotLoaf showing legend level missing - fixed.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-101","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.1","title":"BREADR 1.0.1","text":"CRAN release: 2023-04-12 Patch error read files causing miscalculation PMR.","code":""},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"breadr-100","dir":"Changelog","previous_headings":"","what":"BREADR 1.0.0","title":"BREADR 1.0.0","text":"CRAN release: 2023-04-07 version released CRAN.","code":""},{"path":[]},{"path":"https://jonotuke.github.io/BREADR/news/index.html","id":"major-changes-0-0-0-9000","dir":"Changelog","previous_headings":"","what":"Major changes","title":"BREADR 0.0.0.9000","text":"first development version. primary functions. Also set pkgdown website support.","code":""}]