Learn R Programming

⚠️There's a newer version (2.8.1) of this package.Take me there.

pedtools

Introduction

The goal of pedtools is to provide a lightweight, but comprehensive tool set for creating, manipulating and visualizing pedigrees with or without marker data. Common pedigree structures are quickly produced with tailor-made functions, while a range of utilities enable modifications like adding or removing individuals, extracting subsets, loop breaking, and merging pedigrees. The plotting functionality is imported from the kinship2 package.

pedtools is the hub of the ped suite, a collection of R packages for pedigree analysis, including applications in forensic and medical genetics. The ped suite has its own GitHub repository and a dedicated website offering more information.

Try the QuickPed app for building and analysing pedigrees here: https://magnusdv.shinyapps.io/quickped/

Installation

To get pedtools, install from CRAN as follows:

install.packages("pedtools")

Alternatively, fetch the latest development version from GitHub:

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

Example

The following example illustrates a step-by-step creation of a pedigree with a marker object.

library(pedtools)

# Start with two half brothers
x = halfSibPed(type = "paternal")

# Make 5 female
x = swapSex(x, 5)

# Add 6 as a sister to 5
x = addChildren(x, father = 2, mother = 3, nch = 1, sex = 2)

# Add inbred child
x = addChildren(x, father = 4, mother = 5, nch = 1)

# Create marker
m = marker(x, "7" = "a/b", alleles = c("a", "b"))

# Plot pedigree with genotypes
plot(x, marker = m, hatched = 7)

The process of building pedigrees is perfectly suited for the pipe operator |> recently introduced in R. For example, the above pedigree could have been created as follows:

x = halfSibPed(type = "paternal") |>
  swapSex(5) |>
  addChildren(father = 2, mother = 3, nch = 1, sex = 2) |>
  addChildren(father = 4, mother = 5, nch = 1)

For details about what pedtools can do, and many other examples, the vignette is a good place to start.

Copy Link

Version

Install

install.packages('pedtools')

Monthly Downloads

707

Version

1.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Magnus Vigeland

Last Published

March 30th, 2022

Functions in pedtools (1.2.0)

connectedComponents

Connected pedigree components
as.data.frame.ped

Convert ped to data.frame
getComponent

Pedigree component
as.ped

Conversions to ped objects
founderInbreeding

Inbreeding coefficients of founders
distributeMarkers

Distribute markers evenly along a set of chromosomes
getAlleles

Allele matrix manipulation
famid

Family identifier
as.matrix.ped

Convert ped to matrix
freqDatabase

Allele frequency database
marker_attach

Attach markers to pedigrees
marker_select

Select or remove attached markers
marker_setattr

Set marker attributes
marker_getattr

Get marker attributes
locusAttributes

Get or set locus attributes
ped_basic

Create simple pedigrees
ped_complex

Complex pedigree structures
mendelianCheck

Check for Mendelian errors
mergePed

Merge two pedigrees
marker

Marker objects
plotPedList

Plot a collection of pedigrees.
is.marker

Test if something is a marker
getSex

Get or set the sex of pedigree members
getGenotypes

Genotype matrix
inbreedingLoops

Pedigree loops
setSNPs

Attach SNP loci to a pedigree
sortGenotypes

Sort the alleles in each genotype
print.nucleus

S3 methods
ped_internal

Internal ordering of pedigree members
marker_inplace

Set marker attributes
readPed

Read a pedigree from file
ped_modify

Add/remove pedigree members
marker_prop

Marker properties
getMap

Tabulate marker positions
newPed

Internal ped constructor
pedtools

pedtools: Tools for working with pedigrees in R
ped

Pedigree construction
plot.ped

Plot pedigrees with genotypes
is.ped

Is an object a ped object?
relabel

Get or modify pedigree labels
ped_utils

Pedigree utilities
randomPed

Random pedigree
ped_subgroups

Pedigree subgroups
print.ped

Printing pedigrees
writePed

Write a pedigree to file
newMarker

Internal marker constructor
nMarkers

The number of markers attached to a pedigree
transferMarkers

Transfer marker data
validatePed

Pedigree errors