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 Chowdhury et al. (2009), 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.
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("inferRecom")
library(inferRecom)
library(rtracklayer)
library(trackViewer)
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
(Dimitromanolakis et al. 2019) from HapMap CEU genotypes
(International HapMap 3 Consortium 2010) and formatted in PLINK binary format, which
inferRecom reads with snpStats (Clayton 2026). 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
Bhérer, Campbell, and Auton (2017) and are available on GitHub.
This vignette also showcases several auxiliary functions that facilitate visualization, analysis of regions of homozygosity, and chromosome-scale phasing of informative markers.
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).
# 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
#> GRanges object with 3 ranges and 6 metadata columns:
#> seqnames ranges strand | childId familyId startSnp
#> <Rle> <IRanges> <Rle> | <character> <character> <character>
#> [1] chr4 78432058-78432285 * | F6C2 F6 rs10026702
#> [2] chr4 78393878-78424195 * | F8C3 F8 rs4450960
#> [3] chr4 78084453-78100731 * | F8C5 F8 rs17327923
#> finishSnp startCm finishCm
#> <character> <numeric> <numeric>
#> [1] rs10026918 57.3462 57.3462
#> [2] rs17400095 57.3424 57.3462
#> [3] rs2645687 57.3172 57.3178
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
The output of the functions is a GRanges object (Lawrence et al. 2013)
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 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.
pat3_0cM <- xoDetect(simCEU,
mapMale,
familySize = 3,
parent = "father",
caseControl = FALSE,
cmFilter = 0
)
pat3_0cM
#> GRanges object with 5 ranges and 6 metadata columns:
#> seqnames ranges strand | childId familyId startSnp
#> <Rle> <IRanges> <Rle> | <character> <character> <character>
#> [1] chr4 78059331-78077129 * | F6C1 F6 rs12502028
#> [2] chr4 78828799-78833246 * | F6C1 F6 rs10518181
#> [3] chr4 78432058-78432285 * | F6C2 F6 rs10026702
#> [4] chr4 78393878-78424195 * | F8C3 F8 rs4450960
#> [5] chr4 78084453-78100731 * | F8C5 F8 rs17327923
#> finishSnp startCm finishCm
#> <character> <numeric> <numeric>
#> [1] rs1874564 57.2841 57.3170
#> [2] rs6836305 57.6484 57.6484
#> [3] rs10026918 57.3462 57.3462
#> [4] rs17400095 57.3424 57.3462
#> [5] rs2645687 57.3172 57.3178
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
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.
xoDetect() output with trackViewer and rtracklayerIt is straightforward to visualize recombination intervals using the
Bioconductor packages trackViewer (Ou and Zhu 2019) and rtracklayer
(Lawrence, Gentleman, and Carey 2009). Here, case and control
intervals are plotted for basic comparison using trackViewer.
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.
export(mat3CC$case, "~/path/to/caseOutput.bed", format = "BED")
export(mat3CC$control, "~/path/to/controlOutput.bed", format = "BED")
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().
sexavg_chr4 <- file.path(exampleDir, "sexavg_chr4.txt")
hzRun(simCEU, sexavg_chr4)
#> GRanges object with 1 range and 6 metadata columns:
#> seqnames ranges strand | sampleId startSnp finishSnp
#> <Rle> <IRanges> <Rle> | <character> <character> <character>
#> [1] chr4 78002267-79180440 * | F4C3 rs17261150 rs7340831
#> numSnps startCm finishCm
#> <integer> <numeric> <numeric>
#> [1] 1028 82.7108 83.7803
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths
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
(Obenchain et al. 2014), 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().
phased <- xoPhase(simCEU, pat3, mat3)
phased
#> class: CollapsedVCF
#> dim: 1162 28
#> rowRanges(vcf):
#> GRanges with 4 metadata columns: REF, ALT, QUAL, FILTER
#> info(vcf):
#> DataFrame with 0 columns:
#> geno(vcf):
#> List of length 1: GT
#> geno(header(vcf)):
#> Number Type Description
#> GT 1 String Phased genotype
f6 <- colData(phased)$familyId == "F6"
geno(phased)$GT[1158:1162, f6]
#> F6P1 F6P2 F6C1 F6C2 F6C3
#> rs17002978 "0|0" "0|0" "0|0" "0|0" "0|0"
#> rs10032397 "0|0" "0|0" "0|0" "0|0" "0|0"
#> rs17420118 "0|0" "0|0" "0|0" "0|0" "0|0"
#> rs6838661 "0|1" "0|0" "0|0" "0|0" "1|0"
#> rs17002988 "0|0" "0|0" "0|0" "0|0" "0|0"
The phased genotypes can be written to a VCF file with writeVcf().
writeVcf(phased, "~/path/to/phased.vcf")
The session information records the versions of all packages used in this vignette.
sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.5 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_GB LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: America/New_York
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] grid stats4 stats graphics grDevices utils datasets
#> [8] methods base
#>
#> other attached packages:
#> [1] trackViewer_1.50.0 rtracklayer_1.74.0
#> [3] inferRecom_1.0.0 VariantAnnotation_1.60.0
#> [5] Rsamtools_2.30.0 Biostrings_2.82.0
#> [7] XVector_0.54.0 SummarizedExperiment_1.44.0
#> [9] Biobase_2.74.0 GenomicRanges_1.66.0
#> [11] IRanges_2.48.0 S4Vectors_0.52.0
#> [13] Seqinfo_1.4.0 MatrixGenerics_1.26.0
#> [15] matrixStats_1.5.0 BiocGenerics_0.60.0
#> [17] generics_0.1.4 BiocStyle_2.42.0
#>
#> loaded via a namespace (and not attached):
#> [1] DBI_1.3.0 bitops_1.1-0 httr2_1.3.0
#> [4] biomaRt_2.70.0 rlang_1.3.0 magrittr_2.0.5
#> [7] otel_0.3.0 compiler_4.6.1 RSQLite_3.53.3
#> [10] GenomicFeatures_1.66.0 png_0.1-9 vctrs_0.7.3
#> [13] txdbmaker_1.10.0 stringr_1.6.0 pkgconfig_2.0.3
#> [16] crayon_1.5.3 fastmap_1.2.0 magick_2.9.1
#> [19] dbplyr_2.6.0 rmarkdown_2.32 UCSC.utils_1.10.0
#> [22] strawr_0.0.92 tinytex_0.61 bit_4.6.0
#> [25] xfun_0.62 cachem_1.1.0 cigarillo_1.4.0
#> [28] GenomeInfoDb_1.50.0 jsonlite_2.0.0 progress_1.2.3
#> [31] blob_1.3.0 rhdf5filters_1.26.0 DelayedArray_0.40.0
#> [34] Rhdf5lib_2.2.0 BiocParallel_1.48.0 parallel_4.6.1
#> [37] prettyunits_1.2.0 R6_2.6.1 bslib_0.12.0
#> [40] stringi_1.8.9 RColorBrewer_1.1-3 jquerylib_0.1.4
#> [43] Rcpp_1.1.2 bookdown_0.48 knitr_1.52
#> [46] BiocBaseUtils_1.16.0 Matrix_1.7-6 splines_4.6.1
#> [49] tidyselect_1.2.1 dichromat_2.0-1 abind_1.4-8
#> [52] yaml_2.3.12 codetools_0.2-20 curl_8.2.0
#> [55] lattice_0.23-1 tibble_3.3.1 InteractionSet_1.42.0
#> [58] KEGGREST_1.54.0 evaluate_1.0.5 survival_3.8-13
#> [61] BiocFileCache_3.4.0 snpStats_1.64.0 pillar_1.11.1
#> [64] BiocManager_1.30.27 filelock_1.0.3 RCurl_1.98-1.20
#> [67] hms_1.1.4 scales_1.4.0 grImport_0.9-7
#> [70] glue_1.8.1 tools_4.6.1 BiocIO_1.24.0
#> [73] BSgenome_1.82.0 GenomicAlignments_1.50.0 XML_3.99-0.25
#> [76] rhdf5_2.58.0 AnnotationDbi_1.76.0 restfulr_0.0.17
#> [79] cli_3.6.6 S4Arrays_1.14.0 dplyr_1.2.1
#> [82] sass_0.5.0 digest_0.6.39 SparseArray_1.14.0
#> [85] rjson_0.2.23 htmlwidgets_1.6.4 farver_2.1.2
#> [88] memoise_2.0.1 htmltools_0.5.9 lifecycle_1.0.5
#> [91] httr_1.4.9 bit64_4.8.6