--- title: "Detecting Homologous Recombination in Family Pedigrees" author: - name: Catherine Mahoney - name: Michael Salter-Townshend affiliation: University College Dublin - name: Denis Shields affiliation: University College Dublin output: BiocStyle::html_document: toc_float: true bibliography: references.bib vignette: > %\VignetteIndexEntry{Detecting Homologous Recombination in Family Pedigrees} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r options, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE, warning = FALSE ) ``` # Introduction Accurate detection of recombination events is essential for linkage analysis, haplotype inference, and investigating disease associations with de novo recombination. While population-based phasing methods such as *SHAPEIT* and *Beagle* achieve high accuracy over short distances, switch error rates (arising from genotyping error and small gene conversions that are not associated with the long range recombination of large chromosomal regions) accumulate over long genetic distances, limiting their utility for chromosome-scale recombination inference. The `inferRecom` package builds on work by @chowdhury2009genetic, who used analytic recombination detection to characterize recombination phenotypes and identify associated loci. This package detects recombination analytically in families with two parents and two or more children, applies a genetic distance and/or SNP-based filter to remove artifacts inconsistent with homologous recombination due to interference, implements chromosome-scale phasing at informative markers, and integrates with genomic visualization tools such as the UCSC Genome Browser and with the wider Bioconductor ecosystem. For two child families, the location of the recombination is identified, while in those with ≥3 children, the individual carrying the recombination is additionally inferred. The package has utility in nuclear family genome-wide analyses for a wide variety of applications including human disease, animal and plant studies and evolutionary research. ## Installation ```{r install, eval=FALSE} if (!requireNamespace("BiocManager", quietly = TRUE)) { install.packages("BiocManager") } BiocManager::install("inferRecom") ``` ```{r setup} library(inferRecom) library(rtracklayer) library(trackViewer) ``` # Detecting recombination `inferRecom` enables rapid, accurate detection of meiotic recombination in nuclear families. The following vignette detects recombination in a simulated set of pedigrees of varying sizes, generated using the `sim1000G` package [@dimitromanolakis2019sim1000g] from HapMap CEU genotypes [@hapmap2010integrating] and formatted in *PLINK* binary format, which `inferRecom` reads with `snpStats` [@clayton2026snpstats]. These data are for demonstration only: recombination was simulated at a much higher rate than occurs in reality, so that the short example region contains many crossovers. The scripts that produced the example data are in the package's `scripts` directory, `system.file("scripts", package = "inferRecom")`. The sex-specific recombination rate maps in Europeans used in this example were generated by @bherer2017refined and are available on [GitHub][bherer]. [bherer]: https://github.com/cbherer/Bherer_etal_SexualDimorphismRecombination This vignette also showcases several auxiliary functions that facilitate visualization, analysis of regions of homozygosity, and chromosome-scale phasing of informative markers. ## Detecting putative recombination intervals The first section demonstrates the core function `xoDetect()`, which localizes and individualizes recombination in families with both parents and three or more children, and localizes recombination in families with both parents and exactly two children. It filters artifacts arising from genotyping error and other experimental error using the default SNP-based criterion of five consecutive informative SNPs to confirm a recombination event (`snpFilter`), as well as a map-based criterion of one centiMorgan to confirm a recombination event (`cmFilter`). ```{r detect-crossovers} # Detect recombinations in families with two parents and three or more children # and families with two parents and exactly two children # Filter for recombination with SNP-based and cM-based filters at default values # Option to select for only SNPs that have an rs number is disabled by default exampleDir <- system.file("extdata", package = "inferRecom") simCEU <- file.path(exampleDir, "simCEU") mapFemale <- file.path(exampleDir, "female_chr4.txt") mapMale <- file.path(exampleDir, "male_chr4.txt") pat3 <- xoDetect(simCEU, mapMale, familySize = 3, parent = "father", caseControl = FALSE ) mat3 <- xoDetect(simCEU, mapFemale, familySize = 3, parent = "mother", caseControl = FALSE ) pat2 <- xoDetect(simCEU, mapMale, familySize = 2, parent = "father") mat2 <- xoDetect(simCEU, mapFemale, familySize = 2, parent = "mother") pat3 ``` The output of the functions is a `GRanges` object [@lawrence2013genomicranges] showing the individual/family IDs, SNP IDs, locations, and recombination rate map centiMorgan distances for each recombination. Given that families with two children do not have sufficient information to infer the recombinant child, the `childId` column is omitted in the output. If `caseControl = TRUE`, a `GRangesList` separated by case/control status is returned. The results with the default filtering parameters are shown below. ## Filtering for double recombination Filtering for closely-spaced events can remove genotyping error and other artefacts in the data that are not consistent with true homologous recombination. The default value for the SNP filter (`snpFilter`) is 5, and for the genetic-distance filter (`cmFilter`) is 1 cM. Setting `cmFilter = 0` removes the genetic distance condition altogether. For comparison, the output below shows paternal recombinations in families with three or more children without the genetic distance filter. ```{r no-cm-filter} pat3_0cM <- xoDetect(simCEU, mapMale, familySize = 3, parent = "father", caseControl = FALSE, cmFilter = 0 ) pat3_0cM ``` Removing the genetic distance filter results in the detection of two recombination intervals in child 1 in pedigree 6 that are separated by only 0.33cM (\~750kb), which is unlikely to represent a true meiotic recombination due to interference in crossing over. ## Visualizing `xoDetect()` output with `trackViewer` and `rtracklayer` It is straightforward to visualize recombination intervals using the Bioconductor packages `trackViewer` [@ou2019trackviewer] and `rtracklayer` [@lawrence2009rtracklayer]. Here, case and control intervals are plotted for basic comparison using `trackViewer`. ```{r plot-case-control} mat3CC <- xoDetect(simCEU, mapFemale, familySize = 3, parent = "mother", caseControl = TRUE ) # Add feature column for compatibility with "gene" type in trackViewer mat3CC$case$feature <- "interval" mat3CC$control$feature <- "interval" caseTrack <- new( "track", dat = mat3CC$case, type = "gene", format = "BED" ) setTrackStyleParam(caseTrack, "color", "black") controlTrack <- new( "track", dat = mat3CC$control, type = "gene", format = "BED" ) setTrackStyleParam(controlTrack, "color", "blue") tl <- trackList(caseTrack, controlTrack) viewRegion <- GRanges("chr4", IRanges(78000000, 79500000)) viewTracks(tl, gr = viewRegion, autoOptimizeStyle = TRUE) ``` While `trackViewer` provides convenient functionality for visualization entirely in an R environment, some intervals are not visible at this resolution. This and many other applications benefit from more interactive visualization directly in the UCSC Genome Browser. Example tracks as exported in the code below are shown in the browser alongside recombination maps and nearby genes. ```{r export-bed} #| eval: false export(mat3CC$case, "~/path/to/caseOutput.bed", format = "BED") export(mat3CC$control, "~/path/to/controlOutput.bed", format = "BED") ``` ```{r browser-figure} #| echo: false knitr::include_graphics("figures/example-browser.png") ``` # Runs of homozygosity One of the factors that affects the density of informative SNPs and therefore the resolution of recombination intervals is the degree of homozygosity in the sample. The function `hzRun()` is a tool to detect runs of homozygosity of a user-specified minimum length in Mb (`minMb`, default 1 Mb). To account for variation in SNP density, it also includes a criterion for the minimum number of SNPs per run (`minSnps`), with a default value of 5. Users can also provide a genetic map (`mapFile`) and specify a minimum centiMorgan length for runs (`minCm`). This example applies a sex-averaged map to all samples. As the output is a `GRanges` or `GRangesList` object, as in `xoDetect()`, the procedure to produce genome browser visualizations is identical to that of the recombination visualizations corresponding to `xoDetect()`. ```{r runs-of-homozygosity} sexavg_chr4 <- file.path(exampleDir, "sexavg_chr4.txt") hzRun(simCEU, sexavg_chr4) ``` # Chromosome-scale phasing Inferring recombination implies identity by descent in between the informative SNPs, allowing for the phasing of this subset of SNPs in the pedigrees with three or more offspring. Many population-based phasing programs are highly accurate over short distances, but phase accuracy deteriorates rapidly at distances greater than a few centiMorgans. The function `xoPhase()` implements a novel phasing algorithm to produce long-range haplotype phase information at informative SNPs. Using the information in the nuclear family structures, it is possible to obtain chromosome-scale haplotypes at the informative subset of SNPs. In these data, between 14% and 36% of SNPs are informative, depending on the family. The function `xoPhase()` uses the sets of maternal and paternal recombinations to infer haplotype phase at all informative SNPs for all members of each the nuclear families with three or more children. SNPs that are not informative are still phased where the genotypes and surrounding haplotypes allow. Where both parents are homozygous, each child's alleles follow directly. At a SNP where one or both parents are heterozygous, the child's inheritance is inferred from the nearest flanking phased SNPs, which are identical by descent unless there is a recombination between them. In these simulated data, 100% of SNPs can be phased. In real data, coverage will depend on missing data and inconsistent genotypes. There is an option to specify a subset of family IDs for phasing (`famIds`). The output is a `VCF` object from `VariantAnnotation` [@obenchain2014variantannotation], with one column per family member and phased genotypes in the `GT` field. For each child the first allele is the paternal and the second the maternal allele; for each parent the two alleles are the parent's two phased haplotypes. Family and parent IDs are stored in `colData()`. ```{r phase-haplotypes} phased <- xoPhase(simCEU, pat3, mat3) phased f6 <- colData(phased)$familyId == "F6" geno(phased)$GT[1158:1162, f6] ``` The phased genotypes can be written to a VCF file with `writeVcf()`. ```{r write-vcf, eval=FALSE} writeVcf(phased, "~/path/to/phased.vcf") ``` # References {.unnumbered} # Session Information The session information records the versions of all packages used in this vignette. ```{r sessionInfo} sessionInfo() ```