pedprobr

CRAN status

Introduction

The main content of pedprobr is an implementation of the Elston-Stewart algorithm for pedigree likelihoods. It is a reboot of the implementation in paramlink which is no longer actively developed.

pedprobr is part of the ped suite, a collection of packages for pedigree analysis in R, based on pedtools for basic handling of pedigrees and marker data. In particular, pedprobr does much of the hard work in the forrel package for relatedness analysis and forensic pedigree analysis.

The workhorse of the pedprobr package is the likelihood() function, which works in a variety of situations:

Installation

To get the current official version of pedprobr, install from CRAN as follows:

install.packages("pedprobr")

Alternatively, you can obtain the latest development version from GitHub:

# install.packages("devtools") # install devtools if needed
devtools::install_github("magnusdv/pedprobr")

Getting started

library(pedprobr)
#> Loading required package: pedtools

To set up a simple example, we first use pedtools utilities to create a pedigree and attach to it a marker object. The marker has alleles 1 and 2, with frequencies 0.2 and 0.8 respectively, and both brothers are heterozygous.

x = nuclearPed(nch = 2)
m = marker(x, '3' = 1:2, '4' = 1:2, alleles = 1:2, afreq = c(0.2, 0.8))

x = addMarkers(x, m) # attach the marker
x
#>  id fid mid sex <1>
#>   1   *   *   1 -/-
#>   2   *   *   2 -/-
#>   3   1   2   1 1/2
#>   4   1   2   1 1/2
plot(x, m)

The pedigree likelihood, i,.e., the probability of observing these genotypes given the pedigree, may now be obtained as follows:

likelihood(x, marker1 = 1)
#> [1] 0.1856

Genotype probability distributions

Besides likelihood() the most important functions in pedprobr are:

In both cases, the distributions are computed conditionally on any known genotypes at the markers in question.

For an illustration of oneMarkerDistribution() we may continue our example from above, and answer the following question: Conditional on the two heterozygous children, what is the joint distribution for the parents?

The answer is easily found as follows:

oneMarkerDistribution(x, ids = 1:2, partialmarker = 1, verbose = F)
#>            1/1        1/2       2/2
#> 1/1 0.00000000 0.01724138 0.1379310
#> 1/2 0.01724138 0.13793103 0.2758621
#> 2/2 0.13793103 0.27586207 0.0000000